Skip to content

Commit 02ca2e4

Browse files
authored
Merge pull request #1 from VenkateshwaranSaravanakumar/master
Documentation(SE-104579):Created Individual Sample for Sql-server-databinding topic in Scheduler.
2 parents d3f1997 + f679995 commit 02ca2e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1848
-0
lines changed

App.razor

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>

AppData/AppointmentDataDB.mdf

8 MB
Binary file not shown.

AppData/AppointmentDataDB_log.ldf

8 MB
Binary file not shown.

Data/AppointmentData.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.ComponentModel.DataAnnotations;
2+
3+
namespace SqlServerDataBinding.Data
4+
{
5+
public class AppointmentData
6+
{
7+
[Key]
8+
public int RecordID { get; set; }
9+
public int Id { get; set; }
10+
public string? UserID { get; set; }
11+
public string? EventCategory { get; set; }
12+
public string? CategoryColor { get; set; }
13+
public string? EventType { get; set; }
14+
public string? OwnerType { get; set; }
15+
public string? OwnerId { get; set; }
16+
public string? Subject { get; set; }
17+
public DateTime StartTime { get; set; }
18+
public DateTime EndTime { get; set; }
19+
public string? StartTimezone { get; set; }
20+
public string? EndTimezone { get; set; }
21+
public string? Location { get; set; }
22+
public string? Description { get; set; }
23+
public bool IsAllDay { get; set; } = false;
24+
public int? RecurrenceID { get; set; }
25+
public string? RecurrenceRule { get; set; }
26+
public string? RecurrenceException { get; set; }
27+
public bool? IsReadOnly { get; set; }
28+
public bool? IsBlock { get; set; }
29+
public string? CssClass { get; set; }
30+
}
31+
public class Params
32+
{
33+
public string? UserID { get; set; }
34+
public DateTime StartTime { get; set; }
35+
public DateTime EndTime { get; set; }
36+
}
37+
}

Data/AppointmentDataContext.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.EntityFrameworkCore;
2+
3+
namespace SqlServerDataBinding.Data
4+
{
5+
public class AppointmentDataContext: DbContext
6+
{
7+
public AppointmentDataContext(DbContextOptions<AppointmentDataContext> options) : base(options)
8+
{
9+
}
10+
protected override void OnModelCreating(ModelBuilder modelBuilder)
11+
{
12+
modelBuilder.Entity<AppointmentData>().HasData(
13+
new AppointmentData
14+
{
15+
RecordID = 1,
16+
Id = 1,
17+
Subject = "Meeting",
18+
StartTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 10, 0, 0),
19+
EndTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 12, 0, 0),
20+
Location = "Tamilnadu"
21+
}
22+
);
23+
}
24+
public DbSet<AppointmentData> AppointmentDatas { get; set; }
25+
}
26+
}

Data/WeatherForecast.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace SqlServerDataBinding.Data
2+
{
3+
public class WeatherForecast
4+
{
5+
public DateOnly Date { get; set; }
6+
7+
public int TemperatureC { get; set; }
8+
9+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
10+
11+
public string? Summary { get; set; }
12+
}
13+
}

Data/WeatherForecastService.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace SqlServerDataBinding.Data
2+
{
3+
public class WeatherForecastService
4+
{
5+
private static readonly string[] Summaries = new[]
6+
{
7+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
8+
};
9+
10+
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
11+
{
12+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
13+
{
14+
Date = startDate.AddDays(index),
15+
TemperatureC = Random.Shared.Next(-20, 55),
16+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
17+
}).ToArray());
18+
}
19+
}
20+
}

Migrations/20230525030615_SqlServerDataBinding.Data.AppointmentDataContext.Designer.cs

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
#nullable disable
5+
6+
namespace SqlServerDataBinding.Migrations
7+
{
8+
public partial class SqlServerDataBindingDataAppointmentDataContext : Migration
9+
{
10+
protected override void Up(MigrationBuilder migrationBuilder)
11+
{
12+
migrationBuilder.CreateTable(
13+
name: "AppointmentDatas",
14+
columns: table => new
15+
{
16+
RecordID = table.Column<int>(type: "int", nullable: false)
17+
.Annotation("SqlServer:Identity", "1, 1"),
18+
Id = table.Column<int>(type: "int", nullable: false),
19+
UserID = table.Column<string>(type: "nvarchar(max)", nullable: true),
20+
EventCategory = table.Column<string>(type: "nvarchar(max)", nullable: true),
21+
CategoryColor = table.Column<string>(type: "nvarchar(max)", nullable: true),
22+
EventType = table.Column<string>(type: "nvarchar(max)", nullable: true),
23+
OwnerType = table.Column<string>(type: "nvarchar(max)", nullable: true),
24+
OwnerId = table.Column<string>(type: "nvarchar(max)", nullable: true),
25+
Subject = table.Column<string>(type: "nvarchar(max)", nullable: true),
26+
StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
27+
EndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
28+
StartTimezone = table.Column<string>(type: "nvarchar(max)", nullable: true),
29+
EndTimezone = table.Column<string>(type: "nvarchar(max)", nullable: true),
30+
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
31+
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
32+
IsAllDay = table.Column<bool>(type: "bit", nullable: false),
33+
RecurrenceID = table.Column<int>(type: "int", nullable: true),
34+
RecurrenceRule = table.Column<string>(type: "nvarchar(max)", nullable: true),
35+
RecurrenceException = table.Column<string>(type: "nvarchar(max)", nullable: true),
36+
IsReadOnly = table.Column<bool>(type: "bit", nullable: true),
37+
IsBlock = table.Column<bool>(type: "bit", nullable: true),
38+
CssClass = table.Column<string>(type: "nvarchar(max)", nullable: true)
39+
},
40+
constraints: table =>
41+
{
42+
table.PrimaryKey("PK_AppointmentDatas", x => x.RecordID);
43+
});
44+
45+
migrationBuilder.InsertData(
46+
table: "AppointmentDatas",
47+
columns: new[] { "RecordID", "CategoryColor", "CssClass", "Description", "EndTime", "EndTimezone", "EventCategory", "EventType", "Id", "IsAllDay", "IsBlock", "IsReadOnly", "Location", "OwnerId", "OwnerType", "RecurrenceException", "RecurrenceID", "RecurrenceRule", "StartTime", "StartTimezone", "Subject", "UserID" },
48+
values: new object[] { 1, null, null, null, new DateTime(2023, 5, 25, 12, 0, 0, 0, DateTimeKind.Unspecified), null, null, null, 1, false, null, null, "Tamilnadu", null, null, null, null, null, new DateTime(2023, 5, 25, 10, 0, 0, 0, DateTimeKind.Unspecified), null, "Meeting", null });
49+
}
50+
51+
protected override void Down(MigrationBuilder migrationBuilder)
52+
{
53+
migrationBuilder.DropTable(
54+
name: "AppointmentDatas");
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)