Compare commits
No commits in common. "6cd675d76d4b041628bead512118ec50057c9b06" and "9f371a2de98fcaa20a8eb06c061d3c1931751c13" have entirely different histories.
6cd675d76d
...
9f371a2de9
|
|
@ -2,11 +2,6 @@
|
||||||
|
|
||||||
namespace TIAM.Core.Consts;
|
namespace TIAM.Core.Consts;
|
||||||
|
|
||||||
public static class TiamConstClient
|
|
||||||
{
|
|
||||||
public static Guid TransferProductId = Guid.Parse("814b5495-c2e9-4f1d-a73f-37cd5d353078");
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TiamConst : AcConst
|
public class TiamConst : AcConst
|
||||||
{
|
{
|
||||||
public static string ProjectIdString = "684f34d1-163a-4077-918f-a9d9df5ce789";
|
public static string ProjectIdString = "684f34d1-163a-4077-918f-a9d9df5ce789";
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,9 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
#region Car
|
#region Car
|
||||||
public Task<List<Car>> GetAllCarsAsync() => SessionAsync(ctx => ctx.Cars.OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
public Task<List<Car>> GetAllCarsAsync() => SessionAsync(ctx => ctx.Cars.OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
||||||
public Task<List<Car>> GetAllCarsbyProductIdAsync(Guid productId) => SessionAsync(ctx => ctx.Cars.Where(x => x.UserProductMapping.ProductId == productId).OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
|
||||||
public Car? GetCarById(Guid carId) => Session(ctx => ctx.Cars.FirstOrDefault(x => x.Id == carId));
|
public Car? GetCarById(Guid carId) => Session(ctx => ctx.Cars.FirstOrDefault(x => x.Id == carId));
|
||||||
public List<Car> GetCarByUserProductMappingId(Guid userProductMappingId) => Session(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
public List<Car> GetCarByUserProductMappingId(Guid userProductMappingId) => Session(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
||||||
public Task<List<Car>> GetCarsByUserProductMappingIdAsync(Guid userProductMappingId) => SessionAsync(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
public Task<List<Car>> GetCarByUserProductMappingIdAsync(Guid userProductMappingId) => SessionAsync(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
||||||
public Task<bool> AddCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Add(car).State == EntityState.Added);
|
public Task<bool> AddCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Add(car).State == EntityState.Added);
|
||||||
public Task<bool> UpdateCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Update(car).State == EntityState.Modified);
|
public Task<bool> UpdateCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Update(car).State == EntityState.Modified);
|
||||||
public Task<bool> RemoveCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Remove(car).State == EntityState.Deleted);
|
public Task<bool> RemoveCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Remove(car).State == EntityState.Deleted);
|
||||||
|
|
@ -87,31 +86,10 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public Task<List<TransferToDriver>> GetTransferToDriversByTransferIdAsync(Guid transferId, bool autoInclude = false) => SessionAsync(ctx => ctx.TransferToDrivers.Where(x => x.TransferId == transferId).ToList());
|
public Task<List<TransferToDriver>> GetTransferToDriversByTransferIdAsync(Guid transferId, bool autoInclude = false) => SessionAsync(ctx => ctx.TransferToDrivers.Where(x => x.TransferId == transferId).ToList());
|
||||||
|
|
||||||
public Task<bool> AddTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Add(transferToDriver).State == EntityState.Added);
|
public Task<bool> AddTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Add(transferToDriver).State == EntityState.Added);
|
||||||
public async Task<TransferToDriver?> UpdateTransferToDriverAsync(TransferToDriver transferToDriver)
|
public Task<bool> UpdateTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Update(transferToDriver).State == EntityState.Modified);
|
||||||
{
|
|
||||||
var transferToDriverId = transferToDriver.Id;
|
|
||||||
var result = await TransactionAsync(ctx =>
|
|
||||||
{
|
|
||||||
var transferToDriver2 = ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId)!;
|
|
||||||
transferToDriver2.CarId = transferToDriver.CarId;
|
|
||||||
transferToDriver2.LicencePlate = transferToDriver.LicencePlate;
|
|
||||||
transferToDriver2.UserProductMappingId = transferToDriver.UserProductMappingId;
|
|
||||||
transferToDriver2.TransferId = transferToDriver.TransferId;
|
|
||||||
|
|
||||||
return ctx.TransferToDrivers.Update(transferToDriver2).State == EntityState.Modified;
|
|
||||||
});
|
|
||||||
|
|
||||||
return result ? transferToDriver : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<bool> RemoveTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Remove(transferToDriver).State == EntityState.Deleted);
|
public Task<bool> RemoveTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Remove(transferToDriver).State == EntityState.Deleted);
|
||||||
#endregion TransferToDriver
|
#endregion TransferToDriver
|
||||||
|
|
||||||
#region Drivers
|
|
||||||
|
|
||||||
public Task<List<UserProductMapping>> GetTAllDrivers() => SessionAsync(ctx => ctx.UserProductMappings.Where(x => ctx.Cars.Any(car => car.UserProductMappingId == x.Id)).ToList());
|
|
||||||
public Task<List<UserProductMapping>> GetTAllDriversByProductId(Guid productId) => SessionAsync(ctx => ctx.UserProductMappings.Where(x => x.ProductId == productId && ctx.Cars.Any(car => car.UserProductMappingId == x.Id)).ToList());
|
|
||||||
#endregion Drivers
|
|
||||||
#region TransferDestinationToProduct
|
#region TransferDestinationToProduct
|
||||||
public TransferDestinationToProduct? GetTransferDestinationToProductById(Guid transferDestinationToProductId) => Session(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
|
public TransferDestinationToProduct? GetTransferDestinationToProductById(Guid transferDestinationToProductId) => Session(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
|
||||||
public Task<TransferDestinationToProduct?> GetTransferDestinationToProductByIdAsync(Guid transferDestinationToProductId) => SessionAsync(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
|
public Task<TransferDestinationToProduct?> GetTransferDestinationToProductByIdAsync(Guid transferDestinationToProductId) => SessionAsync(ctx=>ctx.GetTransferDestinationToProductById(transferDestinationToProductId));
|
||||||
|
|
|
||||||
|
|
@ -26,19 +26,18 @@ public class SignalRTags : AcSignalRTags
|
||||||
public const int RemoveCompany = 18;
|
public const int RemoveCompany = 18;
|
||||||
|
|
||||||
public const int GetTransferDriver = 22;
|
public const int GetTransferDriver = 22;
|
||||||
public const int GetAllDrivers = 23;
|
//public const int GetTransferToDrivers = 23;
|
||||||
public const int GetAllDriversByProductId = 24;
|
public const int GetTransferDriversByTransferId = 24;
|
||||||
public const int GetTransferDriversByTransferId = 25;
|
public const int AddTransferToDriver = 25;
|
||||||
public const int AddTransferToDriver = 26;
|
public const int UpdateTransferToDriver = 26;
|
||||||
public const int UpdateTransferToDriver = 27;
|
public const int RemoveTransferToDriver = 27;
|
||||||
public const int RemoveTransferToDriver = 28;
|
|
||||||
|
|
||||||
public const int GetAddress = 29;
|
public const int GetAddress = 28;
|
||||||
//public const int GetAddresses = 30;
|
//public const int GetAddresses = 29;
|
||||||
public const int GetAddressesByContextId = 31;
|
public const int GetAddressesByContextId = 30;
|
||||||
public const int UpdateAddress = 32;
|
public const int UpdateAddress = 31;
|
||||||
//public const int AddAddress = 33;
|
//public const int AddAddress = 32;
|
||||||
//public const int RemoveAddress = 34;
|
//public const int RemoveAddress = 33;
|
||||||
|
|
||||||
public const int GetProfileById = 35;
|
public const int GetProfileById = 35;
|
||||||
//public const int GetProfiles = 36;
|
//public const int GetProfiles = 36;
|
||||||
|
|
@ -62,7 +61,6 @@ public class SignalRTags : AcSignalRTags
|
||||||
public const int UpdateCar = 52;
|
public const int UpdateCar = 52;
|
||||||
public const int DeleteCar = 53;
|
public const int DeleteCar = 53;
|
||||||
public const int GetAllCars = 54;
|
public const int GetAllCars = 54;
|
||||||
public const int GetAllCarsByProductId = 55;
|
|
||||||
|
|
||||||
public const int GetMessagesByContextId = 60;
|
public const int GetMessagesByContextId = 60;
|
||||||
public const int GetAllMessages = 61;
|
public const int GetAllMessages = 61;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
@using TIAMWebApp.Shared.Application.Models.PageModels
|
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using TIAM.Core.Consts
|
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject IStringLocalizer<TIAMResources> Localizer
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
|
|
@ -38,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DriverGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ContextId="TiamConstClient.TransferProductId" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
<DriverGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -55,7 +54,9 @@
|
||||||
@code {
|
@code {
|
||||||
private LoggerClient<ManageUserProductMappings> _logger;
|
private LoggerClient<ManageUserProductMappings> _logger;
|
||||||
//public UserModelDtoDetail UserModelDtoDetail = new();
|
//public UserModelDtoDetail UserModelDtoDetail = new();
|
||||||
|
|
||||||
|
private string TransferProductId = "814b5495-c2e9-4f1d-a73f-37cd5d353078";
|
||||||
|
|
||||||
|
|
||||||
IGrid Grid { get; set; }
|
IGrid Grid { get; set; }
|
||||||
//object? MasterGridData { get; set; }
|
//object? MasterGridData { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
@using AyCode.Core.Helpers
|
@using AyCode.Core.Helpers
|
||||||
@using AyCode.Services.SignalRs
|
@using AyCode.Services.SignalRs
|
||||||
@using AyCode.Utils.Extensions
|
|
||||||
@using TIAM.Core.Consts
|
|
||||||
@using TIAM.Entities.Users
|
@using TIAM.Entities.Users
|
||||||
@using TIAM.Services
|
@using TIAM.Services
|
||||||
@inject IUserDataService UserDataService
|
@inject IUserDataService UserDataService
|
||||||
|
|
@ -22,7 +20,7 @@
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
<TransferToDriversDetailGrid @ref="_transferToDriversGrid"
|
<TransferToDriversDetailGrid @ref="_transferToDriversGrid"
|
||||||
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId])"
|
ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])"
|
||||||
DataSource="ParentData.TransferToDrivers"
|
DataSource="ParentData.TransferToDrivers"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
|
|
@ -35,99 +33,26 @@
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn">
|
ColumnResizeMode="GridColumnResizeMode.NextColumn">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn Width="150" MinWidth="150" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="150" MinWidth="150" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="CarId" />
|
||||||
@{
|
@*<DxGridDataColumn FieldName="CarId">
|
||||||
var userEmailFieldName = $"{nameof(TransferToDriver.UserProductMapping)}.{nameof(UserProductMapping.User)}.{nameof(User.EmailAddress)}";
|
|
||||||
var userEmailFieldName2 = $"{nameof(UserProductMapping.User)}.{nameof(User.EmailAddress)}";
|
|
||||||
}
|
|
||||||
<DxGridDataColumn FieldName="@userEmailFieldName" Caption="Driver" SortIndex="0">
|
|
||||||
<CellEditTemplate>
|
|
||||||
@{
|
|
||||||
var transferToDriverDataItem = (TransferToDriver)context.DataItem;
|
|
||||||
var transferToDriverEditModel = (TransferToDriver)context.EditModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
<DxComboBox Data="@_drivers.Where(x => x.ProductId == (transferToDriverDataItem?.UserProductMapping.ProductId ?? TiamConstClient.TransferProductId))"
|
|
||||||
TData="@UserProductMapping"
|
|
||||||
TValue="@UserProductMapping"
|
|
||||||
TextFieldName="@userEmailFieldName2"
|
|
||||||
Value="@_drivers.FirstOrDefault(x => x.Id == transferToDriverEditModel.UserProductMappingId)"
|
|
||||||
ValueChanged="v => transferToDriverEditModel.UserProductMappingId = v.Id"
|
|
||||||
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
|
||||||
SearchMode="ListSearchMode.AutoSearch">
|
|
||||||
<Columns>
|
|
||||||
@* <DxListEditorColumn FieldName="Id"/> *@
|
|
||||||
<DxListEditorColumn FieldName="@userEmailFieldName2" Caption="Driver email" />
|
|
||||||
</Columns>
|
|
||||||
</DxComboBox>
|
|
||||||
|
|
||||||
</CellEditTemplate>
|
|
||||||
</DxGridDataColumn>
|
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="CarId" Caption="Car">
|
|
||||||
<CellDisplayTemplate>
|
|
||||||
@{
|
|
||||||
var transferToDriver = (TransferToDriver)context.DataItem;
|
|
||||||
<text>@_cars.FirstOrDefault(x => x.Id == transferToDriver.CarId)?.LicencePlate</text>
|
|
||||||
}
|
|
||||||
</CellDisplayTemplate>
|
|
||||||
<CellEditTemplate>
|
|
||||||
@{
|
|
||||||
var transferToDriverEditModel = (TransferToDriver)context.EditModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
<DxComboBox Data="@_cars.Where(x=>x.UserProductMappingId == transferToDriverEditModel.UserProductMappingId)"
|
|
||||||
TData="@Car"
|
|
||||||
TValue="@Car"
|
|
||||||
TextFieldName="LicencePlate"
|
|
||||||
Value="@_cars.FirstOrDefault(x => x.Id == transferToDriverEditModel.CarId)"
|
|
||||||
ValueChanged="v => { transferToDriverEditModel.CarId = v?.Id ?? Guid.Empty; transferToDriverEditModel.LicencePlate = v?.LicencePlate ?? string.Empty; }"
|
|
||||||
SearchFilterCondition="ListSearchFilterCondition.Contains"
|
|
||||||
SearchMode="ListSearchMode.AutoSearch">
|
|
||||||
<Columns>
|
|
||||||
@* <DxListEditorColumn FieldName="Id"/> *@
|
|
||||||
<DxListEditorColumn FieldName="LicencePlate" Caption="LicencePlate"/>
|
|
||||||
<DxListEditorColumn FieldName="Manufacture" Caption="Manufacture" />
|
|
||||||
<DxListEditorColumn FieldName="CarModel" Caption="Model" />
|
|
||||||
<DxListEditorColumn FieldName="SeatNumber" Caption="SeatNumber" />
|
|
||||||
</Columns>
|
|
||||||
</DxComboBox>
|
|
||||||
</CellEditTemplate>
|
|
||||||
</DxGridDataColumn>
|
|
||||||
|
|
||||||
@* <DxGridDataColumn FieldName="CarId">
|
|
||||||
<CellEditTemplate>
|
|
||||||
@{
|
|
||||||
var transferToDriverId = ((TransferToDriver)context.DataItem).Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
<DxDropDownBox QueryDisplayText="QueryText"
|
|
||||||
DropDownWidthMode="DropDownWidthMode.ContentWidth"
|
|
||||||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"
|
|
||||||
NullText="Select a car...">
|
|
||||||
<DropDownBodyTemplate>
|
|
||||||
<CarDetailGridComponent GetAllTag="SignalRTags.GetAllCars"/>
|
|
||||||
</DropDownBodyTemplate>
|
|
||||||
</DxDropDownBox>
|
|
||||||
</CellEditTemplate>
|
|
||||||
</DxGridDataColumn>
|
|
||||||
*@
|
|
||||||
@* <DxGridDataColumn FieldName="CarId">
|
|
||||||
<EditSettings>
|
<EditSettings>
|
||||||
<DxComboBoxSettings Data="_cars" SearchMode="ListSearchMode.AutoSearch"
|
<DxComboBoxSettings Data="_cars" SearchMode="ListSearchMode.AutoSearch" Key
|
||||||
ValueFieldName="Id"
|
ValueFieldName="Id"
|
||||||
TextFieldName="LicencePlate" />
|
TextFieldName="LicencePlate" />
|
||||||
</EditSettings>
|
</EditSettings>
|
||||||
</DxGridDataColumn>*@
|
</DxGridDataColumn>*@
|
||||||
|
|
||||||
|
|
||||||
<DxGridDataColumn FieldName="Price" />
|
<DxGridDataColumn FieldName="Price" />
|
||||||
@* <DxGridDataColumn FieldName="LicencePlate" ReadOnly="true" /> *@
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
|
@{
|
||||||
|
var userEmailFieldName = $"{nameof(TransferToDriver.UserProductMapping)}.{nameof(UserProductMapping.User)}.{nameof(User.EmailAddress)}";
|
||||||
|
}
|
||||||
|
<DxGridDataColumn FieldName="@userEmailFieldName" Caption="User email" SortIndex="0" ReadOnly="true" />
|
||||||
|
<DxGridDataColumn FieldName="LicencePlate" ReadOnly="true" />
|
||||||
</Columns>
|
</Columns>
|
||||||
</TransferToDriversDetailGrid>
|
</TransferToDriversDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public Guid ContextId { get; set; }
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
[Parameter] public ITransferToDriversRelation ParentData { get; set; } = null!;
|
[Parameter] public ITransferToDriversRelation ParentData { get; set; } = null!;
|
||||||
[Parameter] public EventCallback<TransferToDriver> OnTransferToDriverChanged { get; set; }
|
[Parameter] public EventCallback<TransferToDriver> OnTransferToDriverChanged { get; set; }
|
||||||
|
|
||||||
|
|
@ -135,7 +60,6 @@
|
||||||
private LoggerClient<TransferToDriverGridComponent> _logger = null!;
|
private LoggerClient<TransferToDriverGridComponent> _logger = null!;
|
||||||
|
|
||||||
private List<Car> _cars = [];
|
private List<Car> _cars = [];
|
||||||
private List<UserProductMapping> _drivers = [];
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|
@ -143,22 +67,7 @@
|
||||||
|
|
||||||
_logger.Info($"DetailGridData: {ParentData.TransferToDrivers.Count}");
|
_logger.Info($"DetailGridData: {ParentData.TransferToDrivers.Count}");
|
||||||
|
|
||||||
//EZ NEM JÓ, FILTER-ELNI KELL A PRODUCT-RA!!! - J.
|
//_cars.AddRange((await AdminSignalRClient.GetAllAsync<List<Car>>(SignalRTags.GetAllCars))!);
|
||||||
_cars.AddRange((await AdminSignalRClient.GetAllAsync<List<Car>>(SignalRTags.GetAllCarsByProductId, TiamConstClient.TransferProductId))!);
|
|
||||||
// AdminSignalRClient.GetAllAsync<List<Car>>(SignalRTags.GetAllCars, response =>
|
|
||||||
// {
|
|
||||||
// _cars.AddRange(response.ResponseData!);
|
|
||||||
// return Task.CompletedTask;
|
|
||||||
// }).Forget();
|
|
||||||
|
|
||||||
//EZ NEM JÓ, FILTER-ELNI KELL A PRODUCT-RA!!! - J.
|
|
||||||
_drivers.AddRange(_cars.DistinctBy(x => x.UserProductMappingId).Select(x => x.UserProductMapping));
|
|
||||||
//_drivers.AddRange((await AdminSignalRClient.GetAllAsync<List<UserProductMapping>>(SignalRTags.GetAllDrivers))!);
|
|
||||||
// AdminSignalRClient.GetAllAsync<List<UserProductMapping>>(SignalRTags.GetAllDrivers, response =>
|
|
||||||
// {
|
|
||||||
// _drivers.AddRange(response.ResponseData!);
|
|
||||||
// return Task.CompletedTask;
|
|
||||||
// }).Forget();
|
|
||||||
|
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
@ -188,28 +97,12 @@
|
||||||
OnTransferToDriverChanged.InvokeAsync(args.DataItem);
|
OnTransferToDriverChanged.InvokeAsync(args.DataItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataItemSaving(GridEditModelSavingEventArgs args)
|
private void DataItemSaving(GridEditModelSavingEventArgs obj)
|
||||||
{
|
{
|
||||||
_logger.Debug($"DataItemSaving");
|
_logger.Debug($"DataItemSaving");
|
||||||
|
|
||||||
var transferToDriverEditModel = (TransferToDriver)args.EditModel;
|
|
||||||
|
|
||||||
if (transferToDriverEditModel.UserProductMappingId.IsNullOrEmpty() || transferToDriverEditModel.CarId.IsNullOrEmpty() ||
|
|
||||||
transferToDriverEditModel.LicencePlate.IsNullOrWhiteSpace() || transferToDriverEditModel.Price <= 0)
|
|
||||||
{
|
|
||||||
args.Cancel = true;
|
|
||||||
_logger.Error($"transferToDriverEditModel.UserProductMappingId.IsNullOrEmpty() || transferToDriverEditModel.CarId.IsNullOrEmpty() || transferToDriverEditModel.LicencePlate.IsNullOrWhiteSpace() || transferToDriverEditModel.Price <= 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.IsNew)
|
|
||||||
{
|
|
||||||
transferToDriverEditModel.TransferId = ContextId;
|
|
||||||
transferToDriverEditModel.Id = Guid.NewGuid();
|
|
||||||
transferToDriverEditModel.Car = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataItemDeleting(GridDataItemDeletingEventArgs args)
|
private void DataItemDeleting(GridDataItemDeletingEventArgs obj)
|
||||||
{
|
{
|
||||||
_logger.Debug($"DataItemDeleting");
|
_logger.Debug($"DataItemDeleting");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
||||||
|
|
||||||
var cars = await adminDal.GetCarsByUserProductMappingIdAsync(userProductMappingId);
|
var cars = await adminDal.GetCarByUserProductMappingIdAsync(userProductMappingId);
|
||||||
return cars;
|
return cars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,24 +295,12 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[SignalR(SignalRTags.GetAllCars)]
|
[SignalR(SignalRTags.GetAllCars)]
|
||||||
public async Task<List<Car>> GetAllCars()
|
public async Task<List<Car>> GetAllCars()
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetAllCars called");
|
_logger.Info($@"GetAllCars called ");
|
||||||
|
|
||||||
var cars = await adminDal.GetAllCarsAsync();
|
var cars = await adminDal.GetAllCarsAsync();
|
||||||
return cars;
|
return cars;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[AllowAnonymous]
|
|
||||||
//[HttpGet]
|
|
||||||
//[Route(APIUrls.GetAllCarsRouteName)]
|
|
||||||
[SignalR(SignalRTags.GetAllCarsByProductId)]
|
|
||||||
public async Task<List<Car>> GetAllCarsByProductId(Guid productId)
|
|
||||||
{
|
|
||||||
_logger.Info($@"GetAllCarsByProductId called");
|
|
||||||
|
|
||||||
var cars = await adminDal.GetAllCarsbyProductIdAsync(productId);
|
|
||||||
return cars;
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
private async Task<bool> CarDataChanging(Car car, TrackingState trackingState)
|
private async Task<bool> CarDataChanging(Car car, TrackingState trackingState)
|
||||||
|
|
|
||||||
|
|
@ -582,26 +582,6 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return transferToModify;
|
return transferToModify;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Authorize]
|
|
||||||
//[HttpGet]
|
|
||||||
//[Route(APIUrls.GetTransferDriverRouteName)]
|
|
||||||
[SignalR(SignalRTags.GetAllDrivers)]
|
|
||||||
public async Task<List<UserProductMapping>> GetAllDrivers()
|
|
||||||
{
|
|
||||||
var result = await _adminDal.GetTAllDrivers();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//[Authorize]
|
|
||||||
//[HttpGet]
|
|
||||||
//[Route(APIUrls.GetTransferDriverRouteName)]
|
|
||||||
[SignalR(SignalRTags.GetAllDriversByProductId)]
|
|
||||||
public async Task<List<UserProductMapping>> GetAllDriversByProductId(Guid productId)
|
|
||||||
{
|
|
||||||
var result = await _adminDal.GetTAllDriversByProductId(productId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route(APIUrls.GetTransferDriverRouteName)]
|
[Route(APIUrls.GetTransferDriverRouteName)]
|
||||||
|
|
@ -639,7 +619,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
public async Task<TransferToDriver?> UpdateTransferDriver([FromBody] TransferToDriver transferToDriver)
|
public async Task<TransferToDriver?> UpdateTransferDriver([FromBody] TransferToDriver transferToDriver)
|
||||||
{
|
{
|
||||||
var result = await _adminDal.UpdateTransferToDriverAsync(transferToDriver);
|
var result = await _adminDal.UpdateTransferToDriverAsync(transferToDriver);
|
||||||
return result; // ? transferToDriver : null;
|
return result ? transferToDriver : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Authorize]
|
//[Authorize]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue