Compare commits
2 Commits
89376ac2d4
...
4f97dcec4c
| Author | SHA1 | Date |
|---|---|---|
|
|
4f97dcec4c | |
|
|
1a15ab4128 |
|
|
@ -4,6 +4,8 @@ namespace TIAM.Services;
|
|||
|
||||
public class SignalRTags : AcSignalRTags
|
||||
{
|
||||
public const int None = 0;
|
||||
|
||||
public const int GetTransfer = 3;
|
||||
public const int GetTransfers = 4;
|
||||
public const int GetTransfersByContextId = 5;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@
|
|||
|
||||
PageSize="12"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
ValidationEnabled="false"
|
||||
DetailRowDisplayMode="GridDetailRowDisplayMode.Always"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditRow"
|
||||
KeyboardNavigationEnabled="true">
|
||||
|
|
@ -83,6 +84,11 @@
|
|||
<DxGridDataColumn FieldName="OwnerId" MinWidth="80" />
|
||||
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
<text>@(((Company)context.DataItem).Profile.Address.AddressText)</text>
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
</CompanyGrid>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using AyCode.Interfaces.Addresses
|
||||
@using AyCode.Core
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject IUserDataService userDataService
|
||||
@inject ITransferDataService transferDataService
|
||||
|
|
@ -37,15 +38,14 @@
|
|||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="false">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="AddressText" />
|
||||
<DxGridDataColumn FieldName="IsValid" Width="40" />
|
||||
<DxGridDataColumn FieldName="IsHelper" Width="40"/>
|
||||
<DxGridDataColumn FieldName="IsValid" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="IsHelper" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="Latitude" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Longitude" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Created" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Modified" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
||||
</Columns>
|
||||
<EditFormTemplate>
|
||||
@{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
@using TIAM.Entities.Addresses
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||
@using AyCode.Core
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject IUserDataService userDataService
|
||||
@inject ITransferDataService transferDataService
|
||||
|
|
@ -30,11 +31,11 @@
|
|||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="AddressText" />
|
||||
<DxGridDataColumn FieldName="IsValid" Width="40" />
|
||||
<DxGridDataColumn FieldName="IsHelper" Width="40"/>
|
||||
<DxGridDataColumn FieldName="IsValid" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="IsHelper" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="Latitude" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Longitude" Width="40"/>
|
||||
<DxGridDataColumn FieldName="Created" Width="40"/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
@using AyCode.Core.Extensions;
|
||||
@using TIAM.Entities.Addresses
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@using AyCode.Core
|
||||
@layout AdminLayout
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
|
|
@ -92,29 +93,29 @@
|
|||
KeyFieldName="Id">
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="Name" />
|
||||
<DxGridDataColumn FieldName="OwnerId">
|
||||
<DxGridDataColumn FieldName="OwnerId" DisplayFormat="N">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
var keyField = context.Value as Guid?;
|
||||
var keyItem = (Company)context.DataItem;
|
||||
|
||||
if (keyField.IsNullOrEmpty())
|
||||
{
|
||||
<DxButton Click="() => SetOwnerPopup(keyItem)" Text="Set owner" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
<DxButton Click="() => SetOwnerPopup((Company)context.DataItem)" Text="Set owner" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@keyField</span>
|
||||
<text>@keyField.Value.ToString("N")</text>
|
||||
}
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="AffiliateId" />
|
||||
<DxGridDataColumn FieldName="AffiliateId" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||
<DxGridDataColumn FieldName="Created" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
||||
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
||||
@* <DxGridDataColumn FieldName="ContactEmail">
|
||||
|
||||
</DxGridDataColumn> *@
|
||||
|
|
|
|||
|
|
@ -104,22 +104,22 @@
|
|||
KeyFieldName="Id">
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" SortIndex="0" />
|
||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="OrderId">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
var idKeyField = ((Transfer)context.DataItem).Id as Guid?;
|
||||
var editUri = $"mytransfers/{idKeyField}";
|
||||
var idKeyField = ((Transfer)context.DataItem).Id;
|
||||
var editUri = $"mytransfers/{idKeyField:N}";
|
||||
<NavLink href="@editUri">
|
||||
<span>@context.Value</span>
|
||||
<text>@context.Value</text>
|
||||
</NavLink> }
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="PaymentId" />
|
||||
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="FromAddress" />
|
||||
<DxGridDataColumn FieldName="ToAddress" />
|
||||
<DxGridDataColumn FieldName="Appointment" DisplayFormat="f" />
|
||||
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140" />
|
||||
<DxGridDataColumn FieldName="FullName" />
|
||||
<DxGridDataColumn FieldName="ContactPhone" />
|
||||
<DxGridDataColumn FieldName="ContactEmail">
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
|
||||
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == Convert.ToInt16(context.Value));
|
||||
string transferStatusText = keyField.StatusName;
|
||||
<p>@transferStatusText</p>
|
||||
<text>@transferStatusText</text>
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
|
|
@ -156,16 +156,15 @@
|
|||
<MessageDetailGrid
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextId="((Transfer)context.DataItem).Id"
|
||||
TextWrapEnabled="true">
|
||||
ContextId="((Transfer)context.DataItem).Id">
|
||||
|
||||
<Columns>
|
||||
<DxGridDataColumn FieldName="Id" />
|
||||
<DxGridDataColumn FieldName="ContextId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="ContextId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||
<DxGridDataColumn FieldName="EmailAddress" />
|
||||
<DxGridDataColumn FieldName="Subject" />
|
||||
<DxGridDataColumn FieldName="Text" />
|
||||
<DxGridDataColumn FieldName="Created" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
||||
</Columns>
|
||||
</MessageDetailGrid>
|
||||
</DxTabPage>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Loggers
|
||||
@using AyCode.Core
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject IUserDataService userDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Loggers
|
||||
@using AyCode.Core
|
||||
@inject IServiceProviderDataService ServiceProviderDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
||||
|
|
@ -27,8 +28,8 @@
|
|||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using AyCode.Core.Enums
|
||||
@using AyCode.Core.Extensions
|
||||
@using AyCode.Core
|
||||
@inject IUserDataService UserDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
|
|
@ -34,7 +35,7 @@
|
|||
ShowFilterRow="false">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="CarId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="LicencePlate" />
|
||||
</Columns>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
@using TIAM.Core.Loggers
|
||||
@using AyCode.Core.Loggers
|
||||
@using AyCode.Services.Loggers
|
||||
@using AyCode.Core
|
||||
@inject IServiceProviderDataService ServiceProviderDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ using AyCode.Core.Enums;
|
|||
using AyCode.Core.Extensions;
|
||||
using AyCode.Core.Helpers;
|
||||
using AyCode.Core.Interfaces;
|
||||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Services.SignalRs;
|
||||
using AyCode.Utils.Extensions;
|
||||
using DevExpress.Blazor;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using TIAMWebApp.Shared.Application.Services;
|
||||
using TIAMWebApp.Shared.Application.Utility;
|
||||
|
||||
|
|
@ -16,7 +18,8 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
public class GridDataItemChangingEventArgs<TDataItem> : GridDataItemChangedEventArgs<TDataItem> where TDataItem : class, IId<Guid>
|
||||
{
|
||||
internal GridDataItemChangingEventArgs(TiamGrid<TDataItem> grid, TDataItem dataItem, DataChangeMode dataChangeMode) : base(grid, dataItem, dataChangeMode)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsCanceled { get; set; }
|
||||
}
|
||||
|
|
@ -42,7 +45,8 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
private string _gridLogName;
|
||||
|
||||
public TiamGrid() : base()
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
[Parameter] public LoggerClient Logger { get; set; }
|
||||
[Parameter] public string GridName { get; set; }
|
||||
|
|
@ -56,7 +60,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
[Parameter] public int RemoveMessageTag { get; set; }
|
||||
|
||||
protected new EventCallback<GridDataItemDeletingEventArgs> DataItemDeleting { get; set; }
|
||||
[Parameter] public EventCallback<GridDataItemDeletingEventArgs> OnDataItemDeleting{ get; set; }
|
||||
[Parameter] public EventCallback<GridDataItemDeletingEventArgs> OnDataItemDeleting { get; set; }
|
||||
|
||||
protected new EventCallback<GridEditModelSavingEventArgs> EditModelSaving { get; set; }
|
||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnEditModelSaving { get; set; }
|
||||
|
|
@ -111,6 +115,8 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
if (firstRender)
|
||||
{
|
||||
if (_dataSource == null || _dataSource.Count == 0) RefreshDataSourceAsync().Forget();
|
||||
|
||||
//AutoFitColumnWidths();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +130,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
public Task RemoveDataItem(TDataItem dataItem, int messageTag) => PostDataToServerAsync(dataItem, messageTag, DataChangeMode.Remove);
|
||||
|
||||
public Task RemoveDataItem(Guid id) => RemoveDataItem(id, RemoveMessageTag);
|
||||
|
||||
public Task RemoveDataItem(Guid id, int messageTag)
|
||||
{
|
||||
var dataItem = _dataSource.FirstOrDefault(x => x.Id == id);
|
||||
|
|
@ -161,7 +168,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
Logger.Debug($"{_gridLogName} OnItemDeleting canceled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var dataItem = (e.DataItem as TDataItem)!;
|
||||
await RemoveDataItem(dataItem);
|
||||
}
|
||||
|
|
@ -187,10 +194,10 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
|
||||
protected virtual async Task PostDataToServerAsync(TDataItem dataItem, int messageTag, DataChangeMode dataChangeMode)
|
||||
{
|
||||
var eventArgs = new GridDataItemChangingEventArgs<TDataItem>(this, dataItem, dataChangeMode);
|
||||
await OnDataItemChanging.InvokeAsync(eventArgs);
|
||||
var changingEventArgs = new GridDataItemChangingEventArgs<TDataItem>(this, dataItem, dataChangeMode);
|
||||
await OnDataItemChanging.InvokeAsync(changingEventArgs);
|
||||
|
||||
if (eventArgs.IsCanceled)
|
||||
if (changingEventArgs.IsCanceled)
|
||||
{
|
||||
Logger.Debug($"{_gridLogName} OnDataItemChanging canceled");
|
||||
return;
|
||||
|
|
@ -204,30 +211,47 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
|
||||
_dataSource.UpdateCollection(dataItem, dataChangeMode == DataChangeMode.Remove); //egyből látszódik a változás a grid-ben, nem csak a callback lefutásakor! felhasználóbarátabb... - J.
|
||||
|
||||
SignalRClient.PostDataAsync(messageTag, dataItem, async repsonse =>
|
||||
SignalRClient.PostDataAsync(messageTag, dataItem, async response =>
|
||||
{
|
||||
if (repsonse.Status != SignalResponseStatus.Success || repsonse.ResponseData == null)
|
||||
if (response.Status != SignalResponseStatus.Success || response.ResponseData == null)
|
||||
{
|
||||
RefreshDataSourceAsync().Forget();
|
||||
return;
|
||||
}
|
||||
|
||||
_dataSource.UpdateCollection(repsonse.ResponseData, dataChangeMode == DataChangeMode.Remove);
|
||||
_dataSource.UpdateCollection(response.ResponseData, dataChangeMode == DataChangeMode.Remove);
|
||||
|
||||
var changedEventArgs = new GridDataItemChangedEventArgs<TDataItem>(this, response.ResponseData, dataChangeMode);
|
||||
await OnDataItemChanged.InvokeAsync(changedEventArgs);
|
||||
|
||||
await OnDataItemChanged.InvokeAsync(eventArgs);
|
||||
InvokeAsync(StateHasChanged).Forget();
|
||||
}).Forget();
|
||||
|
||||
//transfer = await devAdminSignalClient.PostDataAsync(SignalRTags.UpdateTransferAsync, transfer);
|
||||
}
|
||||
|
||||
|
||||
private void OnCustomizeElement(GridCustomizeElementEventArgs e)
|
||||
{
|
||||
if (e.ElementType == GridElementType.DetailCell)
|
||||
{
|
||||
e.Style = "padding: 0.5rem; opacity: 0.75";
|
||||
}
|
||||
else if (false && e.ElementType == GridElementType.DataCell && e.Column.Name == nameof(IId<Guid>.Id))
|
||||
{
|
||||
e.Column.Visible = AcDomain.IsDeveloperVersion;
|
||||
e.Column.ShowInColumnChooser = AcDomain.IsDeveloperVersion;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||
{
|
||||
if (!IsFirstInitializeParameters)
|
||||
{
|
||||
base.DataItemDeleting = EventCallback.Factory.Create<GridDataItemDeletingEventArgs>(this, OnItemDeleting);
|
||||
base.EditModelSaving = EventCallback.Factory.Create<GridEditModelSavingEventArgs>(this, OnItemSaving);
|
||||
|
||||
CustomizeElement += OnCustomizeElement;
|
||||
|
||||
//ShowFilterRow = true;
|
||||
//PageSize = 4;
|
||||
//ShowGroupPanel = true;
|
||||
|
|
@ -235,7 +259,6 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
|
||||
TextWrapEnabled = false;
|
||||
|
||||
//var columns = GetColumns();
|
||||
//var dataColumns = GetDataColumns();
|
||||
|
||||
//var idColumn = dataColumns.FirstOrDefault(x => x.FieldName == nameof(IId<Guid>.Id));
|
||||
|
|
@ -251,6 +274,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
|||
return base.SetParametersAsyncCore(parameters);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ using System.Runtime.CompilerServices;
|
|||
using MessagePack;
|
||||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Entities.Profiles;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.Collections.Generic;
|
||||
using TIAM.Entities.Emails;
|
||||
using TIAM.Services.Server;
|
||||
|
||||
namespace TIAMWebApp.Server.Services;
|
||||
|
||||
|
|
@ -57,7 +61,11 @@ public class DynamicMethodCallModel<TAttribute> where TAttribute : TagAttribute
|
|||
public object InstanceObject { get; init; }
|
||||
public ConcurrentDictionary<int, MethodInfoModel<TAttribute>> MethodsByMessageTag { get; init; } = new();
|
||||
|
||||
public DynamicMethodCallModel(Type instanceObjectType) : this(Activator.CreateInstance(instanceObjectType)!)
|
||||
|
||||
public DynamicMethodCallModel(Type instanceObjectType) : this(instanceObjectType, null!)
|
||||
{ }
|
||||
|
||||
public DynamicMethodCallModel(Type instanceObjectType, params object[] constructorParams) : this(Activator.CreateInstance(instanceObjectType, constructorParams)!)
|
||||
{ }
|
||||
|
||||
public DynamicMethodCallModel(object instanceObject)
|
||||
|
|
@ -75,7 +83,7 @@ public class DynamicMethodCallModel<TAttribute> where TAttribute : TagAttribute
|
|||
|
||||
public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServer
|
||||
{
|
||||
private readonly List<DynamicMethodCallModel<SignalRAttribute>> _dynamicMethodCallModels = new();
|
||||
private readonly List<DynamicMethodCallModel<SignalRAttribute>> _dynamicMethodCallModels = [];
|
||||
private readonly TIAM.Core.Loggers.Logger<DevAdminSignalRHub> _logger;
|
||||
|
||||
private readonly AdminDal _adminDal;
|
||||
|
|
@ -93,6 +101,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
|||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(serviceProviderApiController));
|
||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(transferDataApiController));
|
||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(messageApiController));
|
||||
//_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(typeof(AdminDal)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,13 +94,16 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
public virtual Task GetByIdAsync<TResponseData>(int messageTag, Guid id, Action<ISignalResponseMessage<TResponseData?>> responseCallback)
|
||||
=> SendMessageToServerAsync(messageTag, new SignalPostJsonDataMessage<IdMessage>(new IdMessage(id)), responseCallback);
|
||||
|
||||
public virtual Task<TResponse?> GetAllAsync<TResponse>(int messageTag) where TResponse : class
|
||||
=> SendMessageToServerAsync<TResponse>(messageTag);
|
||||
public virtual Task<TResponseData?> GetAllAsync<TResponseData>(int messageTag) where TResponseData : class
|
||||
=> SendMessageToServerAsync<TResponseData>(messageTag);
|
||||
public virtual Task GetAllAsync<TResponseData>(int messageTag, Action<ISignalResponseMessage<TResponseData?>> responseCallback)
|
||||
=> SendMessageToServerAsync(messageTag, null, responseCallback);
|
||||
public virtual Task GetAllAsync<TResponseData>(int messageTag, Guid? contextId, Action<ISignalResponseMessage<TResponseData?>> responseCallback)
|
||||
=> SendMessageToServerAsync(messageTag, (contextId.IsNullOrEmpty() ? null : new SignalPostJsonDataMessage<IdMessage>(new IdMessage(contextId.Value))), responseCallback);
|
||||
|
||||
public virtual Task<TResponseData?> GetAllAsync<TResponseData>(int messageTag, Guid? contextId) where TResponseData : class
|
||||
=> SendMessageToServerAsync<TResponseData>(messageTag, contextId.IsNullOrEmpty() ? null : new SignalPostJsonDataMessage<IdMessage>(new IdMessage(contextId.Value)), AcDomain.NextUniqueInt32);
|
||||
|
||||
public virtual Task<TPostData?> PostDataAsync<TPostData>(int messageTag, TPostData postData) where TPostData : class
|
||||
=> SendMessageToServerAsync<TPostData>(messageTag, new SignalPostJsonDataMessage<TPostData>(postData), AcDomain.NextUniqueInt32);
|
||||
public virtual Task PostDataAsync<TPostData>(int messageTag, TPostData postData, Action<ISignalResponseMessage<TPostData?>> responseCallback) where TPostData : class
|
||||
|
|
|
|||
|
|
@ -0,0 +1,380 @@
|
|||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using AyCode.Core.Enums;
|
||||
using AyCode.Core.Extensions;
|
||||
using AyCode.Core.Interfaces;
|
||||
using AyCode.Services.SignalRs;
|
||||
using TIAM.Services;
|
||||
using TIAMWebApp.Shared.Application.Services;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Utility
|
||||
{
|
||||
public class ChangeTracking<T>(DataChangeMode dataChangeMode, T newItem, T originalItem = default(T))where T: class, IId<Guid>
|
||||
{
|
||||
public DataChangeMode DataChangeMode { get; init; } = dataChangeMode;
|
||||
public T NewItem { get; init; } = newItem;
|
||||
public T OriginalItem { get; init; } = originalItem;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
public class SignalRDataSource<T> : IList<T>, IList, IReadOnlyList<T> where T: class, IId<Guid>
|
||||
{
|
||||
protected readonly List<T> InnerList = [];
|
||||
private readonly object _syncRoot = new();
|
||||
|
||||
protected Guid? ContextId;
|
||||
protected AcSignalRClientBase SignalRClient;
|
||||
protected readonly SignalRCrudTags SignalRCrudTags;
|
||||
|
||||
public SignalRDataSource(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, Guid? contextId = null, bool autoLoadDataSource = true)
|
||||
{
|
||||
ContextId = contextId;
|
||||
|
||||
SignalRCrudTags = signalRCrudTags;
|
||||
SignalRClient = signalRClient;
|
||||
|
||||
if (autoLoadDataSource) LoadDataSource();
|
||||
}
|
||||
|
||||
public bool IsSynchronized => true;
|
||||
public object SyncRoot => _syncRoot;
|
||||
public bool IsFixedSize => false;
|
||||
|
||||
/// <summary>
|
||||
/// GetAllMessageTag
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
/// <exception cref="NullReferenceException"></exception>
|
||||
public void LoadDataSource()
|
||||
{
|
||||
if (SignalRCrudTags.GetAllMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.GetAllMessageTag == SignalRTags.None;");
|
||||
|
||||
lock (_syncRoot)
|
||||
{
|
||||
var resultList = SignalRClient.GetAllAsync<List<T>>(SignalRCrudTags.GetAllMessageTag, ContextId).GetAwaiter().GetResult() ?? throw new NullReferenceException();
|
||||
|
||||
Clear();
|
||||
InnerList.AddRange(resultList);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set: UpdateMessageTag
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public T this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((uint)index >= (uint)Count) throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
lock (_syncRoot)
|
||||
{
|
||||
return InnerList[index];
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
Update(index, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_syncRoot) return InnerList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AddMessageTag
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public void Add(T item)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (Contains(item))
|
||||
throw new ArgumentException($@"It already contains this Id! Id: {item.Id}", nameof(item));
|
||||
|
||||
UnsafeAdd(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AddMessageTag or UpdateMessageTag
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public T AddOrUpdate(T item)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
var index = IndexOf(item);
|
||||
|
||||
return index > -1 ? Update(index, item) : UnsafeAdd(item);
|
||||
}
|
||||
}
|
||||
|
||||
//public void AddRange(IEnumerable<T> collection)
|
||||
//{
|
||||
// lock (_syncRoot)
|
||||
// {
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
private T UnsafeAdd(T item)
|
||||
{
|
||||
if (SignalRCrudTags.AddMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.AddMessageTag == SignalRTags.None;");
|
||||
|
||||
var result = SignalRClient.PostDataAsync(SignalRCrudTags.AddMessageTag, item).GetAwaiter().GetResult() ?? throw new NullReferenceException();
|
||||
InnerList.Add(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AddMessageTag
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
/// <exception cref="NullReferenceException"></exception>
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
if (SignalRCrudTags.AddMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.AddMessageTag == SignalRTags.None;");
|
||||
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (Contains(item))
|
||||
throw new ArgumentException($@"It already contains this Id! Id: {item.Id}", nameof(item));
|
||||
|
||||
var result = SignalRClient.PostDataAsync(SignalRCrudTags.AddMessageTag, item).GetAwaiter().GetResult() ?? throw new NullReferenceException();
|
||||
InnerList.Insert(index, result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UpdateMessageTag
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public T Update(T item) => Update(IndexOf(item), item);
|
||||
|
||||
/// <summary>
|
||||
/// UpdateMessageTag
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="item"></param>
|
||||
/// /// <exception cref="ArgumentException"></exception>
|
||||
/// /// <exception cref="NullReferenceException"></exception>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public T Update(int index, T item)
|
||||
{
|
||||
if (SignalRCrudTags.UpdateMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.UpdateMessageTag == SignalRTags.None;");
|
||||
|
||||
if (default(T) != null && item == null) throw new NullReferenceException(nameof(item));
|
||||
if (item.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(item), "Update->item.Id.IsNullOrEmpty()");
|
||||
if ((uint)index >= (uint)Count) throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (InnerList[index].Id != item.Id)
|
||||
throw new ArgumentException($@"_list[index].Id != item.Id! Id: {item.Id}", nameof(item));
|
||||
|
||||
var result = SignalRClient.PostDataAsync(SignalRCrudTags.UpdateMessageTag, item).GetAwaiter().GetResult() ?? throw new NullReferenceException();
|
||||
|
||||
InnerList[index] = result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RemoveMessageTag
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool Remove(T item)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
var index = IndexOf(item);
|
||||
|
||||
if (index < 0) return false;
|
||||
|
||||
RemoveAt(index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RemoveMessageTag
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
/// /// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="NullReferenceException"></exception>
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
if (SignalRCrudTags.RemoveMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.RemoveMessageTag == SignalRTags.None;");
|
||||
|
||||
lock (_syncRoot)
|
||||
{
|
||||
var item = InnerList[index];
|
||||
if (item.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(item), $@"RemoveAt->item.Id.IsNullOrEmpty(); index: {index}");
|
||||
|
||||
var result = SignalRClient.PostDataAsync(SignalRCrudTags.RemoveMessageTag, item).GetAwaiter().GetResult() ?? throw new NullReferenceException();
|
||||
|
||||
InnerList.RemoveAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (_syncRoot) InnerList.Clear();
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
return InnerList.FindIndex(x => x.Id == item.Id);
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
return IndexOf(item) > -1;
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array) => CopyTo(array, 0);
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
lock (_syncRoot) InnerList.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public int BinarySearch(int index, int count, T item, IComparer<T>? comparer)
|
||||
{
|
||||
if (index < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
if (count < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
if (Count - index < count)
|
||||
throw new ArgumentException("Invalid length");
|
||||
|
||||
lock (_syncRoot)
|
||||
return InnerList.BinarySearch(index, count, item, comparer);
|
||||
}
|
||||
|
||||
public int BinarySearch(T item) => BinarySearch(0, Count, item, null);
|
||||
public int BinarySearch(T item, IComparer<T>? comparer) => BinarySearch(0, Count, item, comparer);
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
lock (_syncRoot)
|
||||
return InnerList.ToList().GetEnumerator();
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<T> AsReadOnly() => new(this);
|
||||
private static bool IsCompatibleObject(object? value) => (value is T) || (value == null && default(T) == null);
|
||||
|
||||
|
||||
#region IList, ICollection
|
||||
bool IList.IsReadOnly => false;
|
||||
|
||||
object? IList.this[int index]
|
||||
{
|
||||
get => this[index];
|
||||
set
|
||||
{
|
||||
if (default(T) != null && value == null) throw new NullReferenceException(nameof(value));
|
||||
|
||||
try
|
||||
{
|
||||
this[index] = (T)value!;
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
throw new InvalidCastException(nameof(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int IList.Add(object? item)
|
||||
{
|
||||
if (default(T) != null && item == null) throw new NullReferenceException(nameof(item));
|
||||
|
||||
try
|
||||
{
|
||||
Add((T)item!);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
throw new InvalidCastException(nameof(item));
|
||||
}
|
||||
|
||||
return Count - 1;
|
||||
}
|
||||
|
||||
void IList.Clear() => Clear();
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
bool IList.Contains(object? item) => IsCompatibleObject(item) && Contains((T)item!);
|
||||
int IList.IndexOf(object? item) => (IsCompatibleObject(item)) ? IndexOf((T)item!) : -1;
|
||||
|
||||
void IList.Insert(int index, object? item)
|
||||
{
|
||||
if (default(T) != null && item == null) throw new NullReferenceException(nameof(item));
|
||||
|
||||
try
|
||||
{
|
||||
Insert(index, (T)item!);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
throw new InvalidCastException(nameof(item));
|
||||
}
|
||||
}
|
||||
|
||||
void IList.Remove(object? item)
|
||||
{
|
||||
if (IsCompatibleObject(item)) Remove((T)item!);
|
||||
}
|
||||
|
||||
void ICollection<T>.Clear() => Clear();
|
||||
|
||||
void ICollection.CopyTo(Array array, int arrayIndex)
|
||||
{
|
||||
if ((array != null) && (array.Rank != 1))
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
//TODO: _list.ToArray() - ez nem az igazi... - J.
|
||||
Array.Copy(InnerList.ToArray(), 0, array!, arrayIndex, InnerList.Count);
|
||||
}
|
||||
catch (ArrayTypeMismatchException)
|
||||
{
|
||||
throw new ArrayTypeMismatchException();
|
||||
}
|
||||
}
|
||||
|
||||
int ICollection.Count => Count;
|
||||
int ICollection<T>.Count => Count;
|
||||
bool ICollection<T>.IsReadOnly => false;
|
||||
void IList<T>.RemoveAt(int index) => RemoveAt(index);
|
||||
int IReadOnlyCollection<T>.Count => Count;
|
||||
#endregion IList, ICollection
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
using System.Diagnostics;
|
||||
using AyCode.Core.Enums;
|
||||
using AyCode.Core.Helpers;
|
||||
using AyCode.Core.Interfaces;
|
||||
using AyCode.Services.SignalRs;
|
||||
using TIAM.Services;
|
||||
using TIAMWebApp.Shared.Application.Services;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Utility;
|
||||
|
||||
[Serializable]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
public class SignalRDataSourceAsync<T> : SignalRDataSource<T> where T : class, IId<Guid>
|
||||
{
|
||||
public Action<ItemChangedEventArgs<T>>? OnItemChanged;
|
||||
public Action<SignalRDataSourceAsync<T>>? OnDataSourceLoaded;
|
||||
|
||||
public SignalRDataSourceAsync(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, Guid? contextId = null, Action<SignalRDataSourceAsync<T>>? onDataSourceLoaded = null, bool autoLoadDataSource = false)
|
||||
: base(signalRClient, signalRCrudTags, contextId, false)
|
||||
{
|
||||
OnDataSourceLoaded = onDataSourceLoaded;
|
||||
|
||||
if (autoLoadDataSource) LoadDataSourceAsync();
|
||||
}
|
||||
|
||||
public void LoadDataSourceAsync()
|
||||
{
|
||||
if (SignalRCrudTags.GetAllMessageTag == SignalRTags.None) throw new ArgumentException($"_signalRCrudTags.GetAllMessageTag == SignalRTags.None;");
|
||||
|
||||
Monitor.Exit(SyncRoot); //Exception test - J.
|
||||
|
||||
Monitor.Enter(SyncRoot);
|
||||
try
|
||||
{
|
||||
SignalRClient.GetAllAsync<List<T>>(SignalRCrudTags.GetAllMessageTag, ContextId, response =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.Status == SignalResponseStatus.Error) throw new Exception($"LoadDataSourceAsync; response.Status == SignalResponseStatus.Error");
|
||||
if (response.ResponseData == null) throw new NullReferenceException($"response.ResponseData == null");
|
||||
|
||||
Clear();
|
||||
InnerList.AddRange(response.ResponseData);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(SyncRoot);
|
||||
}
|
||||
|
||||
OnDataSourceLoaded?.Invoke(this);
|
||||
}).Forget();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Monitor.Exit(SyncRoot);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//public T Add(T item, int messageTag) => PostDataToServerAsync(item, messageTag, DataChangeMode.Add).GetAwaiter().GetResult();
|
||||
//public Task AddAsync(T item, int messageTag) => PostDataToServerAsync(item, messageTag, DataChangeMode.Add);
|
||||
|
||||
|
||||
//public Task UpdateAsync(T item, int messageTag) => PostDataToServerAsync(item, messageTag, DataChangeMode.Update);
|
||||
|
||||
//public Task RemoveAsync(T item, int messageTag) => PostDataToServerAsync(item, messageTag, DataChangeMode.Remove);
|
||||
|
||||
//public Task RemoveAsync(Guid id, int messageTag)
|
||||
//{
|
||||
// var item = _list.FirstOrDefault(x => x.Id == id);
|
||||
|
||||
// return item == null ? Task.CompletedTask : RemoveAsync(item, messageTag);
|
||||
//}
|
||||
|
||||
//protected virtual Task PostDataToServerAsync(T item, int messageTag, DataChangeMode dataChangeMode)
|
||||
//{
|
||||
// if (messageTag == 0) return Task.CompletedTask;
|
||||
|
||||
// logger.Info($"{_listLogName} PostDataToServerAsync called; transferId " + item.Id);
|
||||
|
||||
// if (item.Id.IsNullOrEmpty()) item.Id = Guid.NewGuid();
|
||||
|
||||
// _list.UpdateCollection(item, dataChangeMode == DataChangeMode.Remove); //egyből látszódik a változás a grid-ben, nem csak a callback lefutásakor! felhasználóbarátabb... - J.
|
||||
|
||||
// await _signalRClient.PostDataAsync(messageTag, item, async repsonse =>
|
||||
// {
|
||||
// if (repsonse.Status != SignalResponseStatus.Success || repsonse.ResponseData == null)
|
||||
// {
|
||||
// RefreshDataSourceAsync().Forget();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// _list.UpdateCollection(repsonse.ResponseData, dataChangeMode == DataChangeMode.Remove);
|
||||
|
||||
// var eventArgs = new ItemChangedEventArgs<T>(repsonse.ResponseData, dataChangeMode);
|
||||
// OnItemChanged.Invoke(eventArgs);
|
||||
// });
|
||||
|
||||
// //transfer = await devAdminSignalClient.PostDataAsync(SignalRTags.UpdateTransferAsync, transfer);
|
||||
|
||||
// return Task.CompletedTask;
|
||||
//}
|
||||
|
||||
public class ItemChangedEventArgs<T> where T : IId<Guid>
|
||||
{
|
||||
internal ItemChangedEventArgs(T item, DataChangeMode dataChangeMode)
|
||||
{
|
||||
Item = item;
|
||||
DataChangeMode = dataChangeMode;
|
||||
}
|
||||
|
||||
public T Item { get; }
|
||||
public DataChangeMode DataChangeMode { get; }
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue