Skip to content

Commit 7155bf8

Browse files
Merge pull request #18 from SyncfusionExamples/1008849-IntegrationSample
1008849: Need to clear warnings in existing integration samples
2 parents 82142a6 + 10dfa89 commit 7155bf8

File tree

16 files changed

+28
-39
lines changed

16 files changed

+28
-39
lines changed

Bindind SQL database using EF and UrlAdaptor/Grid_EF_UrlAdaptor/Grid_EF_UrlAdaptor/Components/Pages/Home.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
@{
2929
var aggregate = (context as AggregateTemplateContext);
3030
<div>
31-
<p>Sum: @aggregate.Sum</p>
31+
<p>Sum: @aggregate?.Sum</p>
3232
</div>
3333
}
3434
</GroupFooterTemplate>
3535
<FooterTemplate>
3636
@{
3737
var aggregate = (context as AggregateTemplateContext);
3838
<div>
39-
<p>Sum: @aggregate.Sum</p>
39+
<p>Sum: @aggregate?.Sum</p>
4040
</div>
4141
}
4242
</FooterTemplate>

Bindind SQL database using EF and UrlAdaptor/Grid_EF_UrlAdaptor/Grid_EF_UrlAdaptor/Controllers/GridController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void Insert([FromBody] CRUDModel<Order> value)
8686
{
8787
try
8888
{
89-
_context.Orders.Add(value.Value);
89+
_context.Orders.Add(value.Value!);
9090
_context.SaveChanges();
9191
}
9292
catch (Exception ex)
@@ -104,10 +104,10 @@ public void Update([FromBody] CRUDModel<Order> value)
104104
{
105105
try
106106
{
107-
var existingOrder = _context.Orders.Find(value.Value.OrderID);
107+
var existingOrder = _context.Orders.Find(value.Value?.OrderID);
108108
if (existingOrder != null)
109109
{
110-
_context.Entry(existingOrder).CurrentValues.SetValues(value.Value);
110+
_context.Entry(existingOrder).CurrentValues.SetValues(value.Value!);
111111
_context.SaveChanges();
112112
}
113113
}
@@ -128,7 +128,7 @@ public void Delete([FromBody] CRUDModel<Order> value)
128128
{
129129
//int orderId = Convert.ToInt32(value.Key);
130130
//int orderId = value.Key is System.Text.Json.JsonElement je ? Convert.ToInt32(je.GetInt32()) : Convert.ToInt32(value.Key);
131-
int orderId = Convert.ToInt32(value.Key.ToString());
131+
int orderId = Convert.ToInt32(value.Key?.ToString());
132132
var order = _context.Orders.Find(orderId);
133133
if (order != null)
134134
{

Binding Dapper using CustomAdaptor/Blazor Web App/Grid_Dapper/Components/App.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
<body>
2020
<Routes @rendermode="InteractiveServer"/>
21-
<ReconnectModal />
2221
<script src="@Assets["_framework/blazor.web.js"]"></script>
2322
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
2423
</body>

Binding Dapper using CustomAdaptor/Blazor Web App/Grid_Dapper/Components/Pages/Home.razor

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@page "/"
22
@using System.Collections
3-
@using Grid_Dapper.Data
43
@inject ReservationRepository ReservationService
54

65
<section class="bg-gray-50 dark:bg-gray-950">
@@ -83,7 +82,6 @@
8382

8483
@code{
8584
private CustomAdaptor? _customAdaptor;
86-
private string? _validationErrorMessage;
8785

8886
protected override void OnInitialized()
8987
{
@@ -106,7 +104,7 @@
106104
/// <summary>
107105
/// Reads data from the repository with filtering, sorting, and paging support
108106
/// </summary>
109-
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string Key = null)
107+
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string? Key = null)
110108
{
111109
try
112110
{
@@ -288,7 +286,7 @@
288286
/// <summary>
289287
/// CSS class for payment status styling
290288
/// </summary>
291-
private string GetPaymentStatusClass(string paymentStatus)
289+
private string GetPaymentStatusClass(string? paymentStatus)
292290
{
293291
return paymentStatus?.ToLower() switch
294292
{
@@ -303,7 +301,7 @@
303301
/// <summary>
304302
/// CSS class for reservation status styling
305303
/// </summary>
306-
private string GetReservationStatusClass(string reservationStatus)
304+
private string GetReservationStatusClass(string? reservationStatus)
307305
{
308306
return reservationStatus?.ToLower() switch
309307
{

Binding Dapper using CustomAdaptor/Blazor Web App/Grid_Dapper/Data/ReservationRepository.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private async Task<string> GenerateReservationIdAsync()
9292
/// Generates ReservationId before insert and auto-calculates NoOfDays and TotalAmount based on dates
9393
/// </summary>
9494
/// <param name="value">The reservation model to add</param>
95-
public async Task AddReservationAsync(Reservation value)
95+
public async Task AddReservationAsync(Reservation? value)
9696
{
9797
try
9898
{
@@ -112,7 +112,7 @@ public async Task AddReservationAsync(Reservation value)
112112

113113
if (value.CheckInDate != default && value.CheckOutDate != default)
114114
{
115-
value.NoOfDays = CalculateNoOfDays((DateTime)value.CheckInDate, (DateTime)value.CheckOutDate);
115+
value.NoOfDays = CalculateNoOfDays((DateTime)value.CheckInDate, (DateTime)value.CheckOutDate!);
116116
}
117117

118118
if (value.AmountPerDay.HasValue && value.NoOfDays.HasValue && value.NoOfDays > 0)
@@ -148,7 +148,7 @@ INSERT INTO [dbo].[Rooms]
148148
/// Auto-calculates NoOfDays based on dates and TotalAmount if AmountPerDay changed
149149
/// </summary>
150150
/// <param name="value">The reservation model with updated values</param>
151-
public async Task UpdateReservationAsync(Reservation value)
151+
public async Task UpdateReservationAsync(Reservation? value)
152152
{
153153
try
154154
{
@@ -166,7 +166,7 @@ public async Task UpdateReservationAsync(Reservation value)
166166

167167
if (value.CheckInDate != default && value.CheckOutDate != default)
168168
{
169-
value.NoOfDays = CalculateNoOfDays((DateTime)value.CheckInDate, (DateTime)value.CheckOutDate);
169+
value.NoOfDays = CalculateNoOfDays((DateTime)value.CheckInDate!, (DateTime)value.CheckOutDate!);
170170
}
171171

172172
if (value.AmountPerDay.HasValue && value.NoOfDays.HasValue && value.NoOfDays > 0)

Binding MS SQL database using CustomAdaptor/Blazor Web app/Grid_MSSQL/Components/Pages/Home.razor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@page "/"
22
@using System.Collections
3-
@using Grid_MSSQL.Data
43
@inject TicketRepository TicketService
54
<PageTitle>Network Support Ticket System</PageTitle>
65

@@ -116,7 +115,7 @@
116115
/// <param name="DataManagerRequest">DataManagerRequest contains the information regarding paging, grouping, filtering, searching, sorting which is handled on the Blazor DataGrid component side</param>
117116
/// <param name="Key">An optional parameter that can be used to perform additional data operations.</param>
118117
/// <returns>The data collection's type is determined by how this method has been implemented.</returns>
119-
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string Key = null)
118+
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string? Key = null)
120119
{
121120
IEnumerable dataSource = await _ticketService!.GetTicketsDataAsync();
122121

Binding MS SQL database using CustomAdaptor/Blazor Web app/Grid_MSSQL/Components/_Imports.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
@using Syncfusion.Blazor
1414
@using Syncfusion.Blazor.Grids
1515
@using Syncfusion.Blazor.DropDowns
16-
@using Syncfusion.Blazor.Navigations
1716
@using Syncfusion.Blazor.Data

Binding MS SQL database using CustomAdaptor/Blazor Web app/Grid_MSSQL/Data/TicketRepository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private async Task<string> GeneratePublicTicketIdAsync()
5353
.Where(ticket => !string.IsNullOrEmpty(ticket.PublicTicketId) && ticket.PublicTicketId.StartsWith(PublicTicketIdPrefix))
5454
.Select(ticket =>
5555
{
56-
string numberPart = ticket.PublicTicketId.Substring((PublicTicketIdPrefix + PublicTicketIdSeparator).Length);
56+
string numberPart = ticket.PublicTicketId!.Substring((PublicTicketIdPrefix + PublicTicketIdSeparator).Length);
5757
if (int.TryParse(numberPart, out int number))
5858
return number;
5959
return 0;
@@ -77,7 +77,7 @@ private async Task<string> GeneratePublicTicketIdAsync()
7777
/// Generates PublicTicketId before insert
7878
/// </summary>
7979
/// <param name="value">The ticket model to add</param>
80-
public async Task AddTicketAsync(Tickets value)
80+
public async Task AddTicketAsync(Tickets? value)
8181
{
8282
try
8383
{
@@ -113,7 +113,7 @@ public async Task AddTicketAsync(Tickets value)
113113
/// Updates an existing ticket
114114
/// </summary>
115115
/// <param name="value">The ticket model with updated values</param>
116-
public async Task UpdateTicketAsync(Tickets value)
116+
public async Task UpdateTicketAsync(Tickets? value)
117117
{
118118
try
119119
{

Binding MySQL database using CustomAdaptor/Blazor Web App/Grid_MySQL/Components/Pages/Home.razor

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
@page "/"
22
@rendermode InteractiveServer
33
@using System.Collections
4-
@using Grid_MySQL.Data
5-
@using Syncfusion.Blazor.Data
6-
@using Syncfusion.Blazor.Grids
7-
@using Syncfusion.Blazor.DropDowns
84
@inject TransactionRepository TransactionService
95

106
<SfGrid TValue="TransactionModel" AllowSorting="true" AllowFiltering="true" AllowGrouping="true" AllowPaging="true"

Binding MySQL database using CustomAdaptor/Blazor Web App/Grid_MySQL/Components/_Imports.razor

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
@using Microsoft.JSInterop
99
@using Grid_MySQL
1010
@using Grid_MySQL.Components
11+
@using Grid_MySQL.Data
1112
@using Syncfusion.Blazor
1213
@using Syncfusion.Blazor.Grids
14+
@using Syncfusion.Blazor.Data
15+
@using Syncfusion.Blazor.DropDowns

0 commit comments

Comments
 (0)