AddressDetailGridComponent improvements, fixes, etc
This commit is contained in:
parent
0708b0689c
commit
25febd28a4
|
|
@ -6,6 +6,7 @@ using AyCode.Models.Enums;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
|
using AyCode.Database.DbSets.Addresses;
|
||||||
using AyCode.Database.DbSets.Companies;
|
using AyCode.Database.DbSets.Companies;
|
||||||
using TIAM.Core;
|
using TIAM.Core;
|
||||||
//using TIAM.Database.DataLayers.ServiceProviders;
|
//using TIAM.Database.DataLayers.ServiceProviders;
|
||||||
|
|
@ -27,6 +28,7 @@ using TIAM.Entities.Transfers;
|
||||||
using TIAM.Entities.Users;
|
using TIAM.Entities.Users;
|
||||||
using TIAM.Models.Dtos.Products;
|
using TIAM.Models.Dtos.Products;
|
||||||
using TIAM.Models.Dtos.Users;
|
using TIAM.Models.Dtos.Users;
|
||||||
|
using AyCode.Database.DbSets.Profiles;
|
||||||
|
|
||||||
namespace TIAM.Database.DataLayers.Admins
|
namespace TIAM.Database.DataLayers.Admins
|
||||||
{
|
{
|
||||||
|
|
@ -111,30 +113,9 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public string? GetUserJsonById(Guid userId, bool onlyConfirmed) => Session(ctx => ctx.GetUserById(userId, onlyConfirmed)?.ToJson());
|
public string? GetUserJsonById(Guid userId, bool onlyConfirmed) => Session(ctx => ctx.GetUserById(userId, onlyConfirmed)?.ToJson());
|
||||||
public string GetUsersJson() => Session(ctx => ctx.Users.ToJson());
|
public string GetUsersJson() => Session(ctx => ctx.Users.ToJson());
|
||||||
|
|
||||||
//public Task<bool> AddUserAsync(User user) => TransactionAsync(ctx => ctx.AddUser(user));
|
public Task<bool> AddUserAsync(User user) => TransactionAsync(ctx => ctx.AddUser(user));
|
||||||
|
public Task<bool> UpdateUserAsync(User user) => TransactionAsync(ctx => ctx.UpdateUser(user));
|
||||||
//public Task<bool> AddUserAsync(User user, string profileName, Address address, string? firstName = null, string? lastName = null)
|
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
||||||
//{
|
|
||||||
// return TransactionAsync(ctx =>
|
|
||||||
// {
|
|
||||||
// var profile = new Profile
|
|
||||||
// {
|
|
||||||
// Id = Guid.NewGuid(),
|
|
||||||
// Name = profileName,
|
|
||||||
// FirstName = firstName,
|
|
||||||
// LastName = lastName,
|
|
||||||
// Address = address,
|
|
||||||
// AddressId = address.Id
|
|
||||||
// };
|
|
||||||
|
|
||||||
// user.Profile= profile;
|
|
||||||
|
|
||||||
// return ctx.AddUser(user);
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
|
|
||||||
//public Task<bool> RemoveUserAsync(User user) => TransactionAsync(ctx => ctx.RemoveUser(user));
|
|
||||||
//public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
|
||||||
|
|
||||||
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
||||||
|
|
||||||
|
|
@ -179,8 +160,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
return isSucces ? userProductMapping : null;
|
return isSucces ? userProductMapping : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> UpdateUserProductMappingAsync(UserProductMapping userProductMapping)
|
public Task<bool> UpdateUserProductMappingAsync(UserProductMapping userProductMapping) => TransactionAsync(ctx => ctx.UpdateUserProductMapping(userProductMapping));
|
||||||
=> TransactionAsync(ctx => ctx.UpdateUserProductMapping(userProductMapping));
|
|
||||||
|
|
||||||
public async Task<UserProductMapping?> UpdateUserProductMappingAsync(Guid userProductMappingId, int permissions = 1, UserProductJsonDetailModel? userProductToCars = null)
|
public async Task<UserProductMapping?> UpdateUserProductMappingAsync(Guid userProductMappingId, int permissions = 1, UserProductJsonDetailModel? userProductToCars = null)
|
||||||
{
|
{
|
||||||
|
|
@ -196,14 +176,25 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
return isSucces ? userProductMapping : null;
|
return isSucces ? userProductMapping : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> RemoveUserProductMappingAsync(Guid userProductMappingId)
|
public Task<bool> RemoveUserProductMappingAsync(Guid userProductMappingId) => TransactionAsync(ctx => ctx.RemoveUserProductMapping(userProductMappingId));
|
||||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userProductMappingId));
|
|
||||||
|
|
||||||
public Task<bool> RemoveUserProductMappingAsync(Guid userId, Guid productId)
|
public Task<bool> RemoveUserProductMappingAsync(Guid userId, Guid productId)
|
||||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userId, productId));
|
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userId, productId));
|
||||||
|
|
||||||
#endregion UserProductMapping
|
#endregion UserProductMapping
|
||||||
|
|
||||||
|
#region Address
|
||||||
|
public Task<Address?> GetAddressByIdAsync(Guid addressId) => SessionAsync(ctx => ctx.GetAddressById(addressId));
|
||||||
|
public Task<bool> UpdateAddressAsync(Address adress) => TransactionAsync(ctx => ctx.UpdateAddress(adress));
|
||||||
|
#endregion Address
|
||||||
|
|
||||||
|
#region Profile
|
||||||
|
public Task<Profile?> GetProfileByIdAsync(Guid addressId) => SessionAsync(ctx => ctx.GetProfileById(addressId));
|
||||||
|
public Task<bool> UpdateProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.UpdateProfile(profile));
|
||||||
|
//public Task<bool> AddProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.AddProfile(profile)); //Nem Add-olunk önmagában Profile-t! - J.
|
||||||
|
//public Task<bool> RemoveProfileAsync(Guid profileId) => TransactionAsync(ctx => ctx.RemoveProfile(profileId)); //Nem törlünk Profile-t! - J.
|
||||||
|
#endregion Profile
|
||||||
|
|
||||||
#region EmailMessage
|
#region EmailMessage
|
||||||
public Task<EmailMessage?> GetEmailMessageByIdAsync(Guid emailMessageId) => SessionAsync(ctx => ctx.GetEmailMessageById(emailMessageId));
|
public Task<EmailMessage?> GetEmailMessageByIdAsync(Guid emailMessageId) => SessionAsync(ctx => ctx.GetEmailMessageById(emailMessageId));
|
||||||
public Task<List<EmailMessage>> GetEmailMessagesByContextIdAsync(Guid contextId) => SessionAsync(ctx => ctx.GetEmailMessagesByContextId(contextId).ToList());
|
public Task<List<EmailMessage>> GetEmailMessagesByContextIdAsync(Guid contextId) => SessionAsync(ctx => ctx.GetEmailMessagesByContextId(contextId).ToList());
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,13 @@ public class SignalRTags : AcSignalRTags
|
||||||
public const int UpdateTransferToDrivers = 16;
|
public const int UpdateTransferToDrivers = 16;
|
||||||
public const int RemoveTransferToDrivers = 17;
|
public const int RemoveTransferToDrivers = 17;
|
||||||
|
|
||||||
public const int GetAddressesByContextId = 18;
|
public const int GetAddressById = 18;
|
||||||
public const int AddAddressToContextId = 19;
|
public const int UpdateAddress = 19;
|
||||||
public const int UpdateAddressByContextId = 20;
|
//public const int AddAddress = 20;
|
||||||
public const int RemoveAddressByContextId = 21;
|
//public const int RemoveAddress = 21;
|
||||||
|
|
||||||
|
public const int GetProfileById = 22;
|
||||||
|
public const int UpdateProfile = 23;
|
||||||
|
//public const int AddAddress = 24;
|
||||||
|
//public const int RemoveAddress = 25;
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
OnDataItemSaving="DataItemSaving"
|
OnDataItemSaving="DataItemSaving"
|
||||||
OnDataItemDeleting="DataItemDeleting"
|
OnDataItemDeleting="DataItemDeleting"
|
||||||
|
OnDataItemChanged="DataItemChanged"
|
||||||
PageSize="5"
|
PageSize="5"
|
||||||
AutoExpandAllGroupRows="true"
|
AutoExpandAllGroupRows="true"
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
|
@ -50,30 +50,28 @@
|
||||||
Address bleh = (Address)context.EditModel;
|
Address bleh = (Address)context.EditModel;
|
||||||
}
|
}
|
||||||
@* <EditAddressComponent TModel="Address" Model="@bleh" OnAddressChanged="@((Address model) => SaveAddress(model))" /> *@
|
@* <EditAddressComponent TModel="Address" Model="@bleh" OnAddressChanged="@((Address model) => SaveAddress(model))" /> *@
|
||||||
<EditAddressComponent Model="@((Address)context.EditModel)" OnAddressChanged="@((Address model) => SaveAddress(model))" />
|
<EditAddressComponent Model="@((Address)context.EditModel)" />
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</AddressDetailGrid>
|
</AddressDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
[Parameter] public IList<Address> DataSource { get; set; } = null!;
|
||||||
|
|
||||||
private AddressDetailGrid _addressGrid;
|
private AddressDetailGrid _addressGrid = null!;
|
||||||
private LoggerClient<AddressDetailGridComponent> _logger;
|
private LoggerClient<AddressDetailGridComponent> _logger = null!;
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public IList<Address> DataSource { get; set; }
|
|
||||||
|
|
||||||
public void SaveAddress(object addressOwnerToSave)
|
|
||||||
{
|
|
||||||
_addressGrid.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<AddressDetailGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<AddressDetailGridComponent>(LogWriters.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DataItemChanged(Address address)
|
||||||
|
{
|
||||||
|
//TODO: itt kell visszaírni a Model-be az address-t! - J.
|
||||||
|
}
|
||||||
|
|
||||||
private void DataItemSaving(GridEditModelSavingEventArgs obj)
|
private void DataItemSaving(GridEditModelSavingEventArgs obj)
|
||||||
{
|
{
|
||||||
_logger.Debug($"DataItemSaving");
|
_logger.Debug($"DataItemSaving");
|
||||||
|
|
|
||||||
|
|
@ -147,23 +147,14 @@
|
||||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
@EditFormContext.GetEditor("CommissionPercent")
|
@EditFormContext.GetEditor("CommissionPercent")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
|
||||||
</CompanyGrid>
|
</CompanyGrid>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</Animation>
|
</Animation>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" col-12 col-xl-6">
|
<div class=" col-12 col-xl-6">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,10 @@ public class AddressGrid : TiamGrid<Address>
|
||||||
{
|
{
|
||||||
public AddressGrid() : base()
|
public AddressGrid() : base()
|
||||||
{
|
{
|
||||||
GridName = nameof(Address);
|
//GetAllMessageTag = SignalRTags.GetAddressesById;
|
||||||
|
//AddMessageTag = SignalRTags.AddAddress;
|
||||||
GetAllMessageTag = SignalRTags.GetAddressesByContextId;
|
UpdateMessageTag = SignalRTags.UpdateAddress;
|
||||||
AddMessageTag = SignalRTags.AddAddressToContextId;
|
//RemoveMessageTag = SignalRTags.RemoveAddress; - nem törlünk címet - J.
|
||||||
UpdateMessageTag = SignalRTags.UpdateAddressByContextId;
|
|
||||||
RemoveMessageTag = SignalRTags.RemoveAddressByContextId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
|
|
||||||
|
|
@ -132,10 +132,10 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
||||||
|
|
||||||
public virtual Task RefreshDataSourceAsync()
|
public virtual Task RefreshDataSourceAsync()
|
||||||
{
|
{
|
||||||
|
if (GetAllMessageTag == 0) return Task.CompletedTask;
|
||||||
|
|
||||||
Logger.Info($"{_gridLogName} UpdateAllDataAsync called");
|
Logger.Info($"{_gridLogName} UpdateAllDataAsync called");
|
||||||
|
|
||||||
//if (GetAllMessageTag == 0) return Task.CompletedTask;
|
|
||||||
|
|
||||||
return SignalRClient.GetAllAsync<IList<TDataItem>>(GetAllMessageTag, response =>
|
return SignalRClient.GetAllAsync<IList<TDataItem>>(GetAllMessageTag, response =>
|
||||||
{
|
{
|
||||||
if (response.Status == SignalResponseStatus.Error)
|
if (response.Status == SignalResponseStatus.Error)
|
||||||
|
|
@ -151,13 +151,14 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
||||||
|
|
||||||
protected virtual async Task PostDataToServerAsync(TDataItem dataItem, int messageTag, bool isDelete = false)
|
protected virtual async Task PostDataToServerAsync(TDataItem dataItem, int messageTag, bool isDelete = false)
|
||||||
{
|
{
|
||||||
Logger.Info($"{_gridLogName} PostDataToServerAsync called; transferId " + dataItem.Id);
|
|
||||||
|
|
||||||
//if (messageTag == 0) return;
|
|
||||||
|
|
||||||
await OnDataItemChanging.InvokeAsync(dataItem);
|
await OnDataItemChanging.InvokeAsync(dataItem);
|
||||||
|
|
||||||
|
if (messageTag == 0) return;
|
||||||
|
|
||||||
|
Logger.Info($"{_gridLogName} PostDataToServerAsync called; transferId " + dataItem.Id);
|
||||||
|
|
||||||
if (dataItem.Id.IsNullOrEmpty()) dataItem.Id = Guid.NewGuid();
|
if (dataItem.Id.IsNullOrEmpty()) dataItem.Id = Guid.NewGuid();
|
||||||
|
|
||||||
RefreshDataItem(dataItem, isDelete); //egyből látszódik a változás a grid-ben, nem csak a callback lefutásakor! felhasználóbarátabb... - J.
|
RefreshDataItem(dataItem, isDelete); //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 repsonse =>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ public class TransferToDriversGrid : TiamGrid<TransferToDriver>
|
||||||
{
|
{
|
||||||
public TransferToDriversGrid() : base()
|
public TransferToDriversGrid() : base()
|
||||||
{
|
{
|
||||||
GridName = nameof(TransferToDriver);
|
|
||||||
|
|
||||||
GetAllMessageTag = SignalRTags.GetTransferToDrivers;
|
GetAllMessageTag = SignalRTags.GetTransferToDrivers;
|
||||||
AddMessageTag = SignalRTags.AddTransferToDrivers;
|
AddMessageTag = SignalRTags.AddTransferToDrivers;
|
||||||
UpdateMessageTag = SignalRTags.UpdateTransferToDrivers;
|
UpdateMessageTag = SignalRTags.UpdateTransferToDrivers;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ using MessagePack;
|
||||||
using System.Security.Cryptography.Xml;
|
using System.Security.Cryptography.Xml;
|
||||||
using DevExpress.XtraPrinting.Native.WebClientUIControl;
|
using DevExpress.XtraPrinting.Native.WebClientUIControl;
|
||||||
using DevExpress.XtraReports.Parameters;
|
using DevExpress.XtraReports.Parameters;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
|
||||||
namespace TIAMWebApp.Server.Services;
|
namespace TIAMWebApp.Server.Services;
|
||||||
|
|
||||||
|
|
@ -161,9 +163,25 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case SignalRTags.UpdateAddress:
|
||||||
|
var address = message!.MessagePackTo<SignalPostJsonDataMessage<Address>>().PostData;
|
||||||
|
|
||||||
|
await _adminDal.UpdateAddressAsync(address);
|
||||||
|
await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, address), requestId);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
case SignalRTags.UpdateProfile:
|
||||||
|
var profile = message!.MessagePackTo<SignalPostJsonDataMessage<Profile>>().PostData;
|
||||||
|
|
||||||
|
await _adminDal.UpdateProfileAsync(profile);
|
||||||
|
await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, profile), requestId);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
//case SignalRTags.GetTransfersAsync:
|
//case SignalRTags.GetTransfersAsync:
|
||||||
// await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, await _transferDataApiController.GetTransfers()), requestId);
|
// await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, await _transferDataApiController.GetTransfers()), requestId);
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
//case SignalRTags.GetPropertiesByOwnerIdAsync:
|
//case SignalRTags.GetPropertiesByOwnerIdAsync:
|
||||||
|
|
@ -188,10 +206,10 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
||||||
//case SignalRTags.UpdateCompanyAsync:
|
//case SignalRTags.UpdateCompanyAsync:
|
||||||
|
|
||||||
// var updateCompany = message!.MessagePackTo<SignalPostJsonDataMessage<Company>>().PostData;
|
// var updateCompany = message!.MessagePackTo<SignalPostJsonDataMessage<Company>>().PostData;
|
||||||
|
|
||||||
// await _serviceProviderApiController.UpdateServiceProvider(updateCompany);
|
// await _serviceProviderApiController.UpdateServiceProvider(updateCompany);
|
||||||
// await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, updateCompany), requestId);
|
// await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Success, updateCompany), requestId);
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue