This commit is contained in:
Adam 2024-06-25 09:32:51 +02:00
commit a885188d5a
14 changed files with 93 additions and 74 deletions

View File

@ -235,7 +235,7 @@ namespace TIAM.Database.Test
await Dal.RemoveProductAsync(productId); //kitöröljük a szemetet, ha korábbról bentmaradt - J. await Dal.RemoveProductAsync(productId); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
var company = new Company(companyId, "Test unit company...", null); var company = new Company(companyId, "Test unit product...", null);
Assert.IsTrue(await Dal.AddCompanyAsync(company)); Assert.IsTrue(await Dal.AddCompanyAsync(company));
Assert.IsNotNull(company); Assert.IsNotNull(company);

View File

@ -80,6 +80,9 @@ namespace TIAM.Database.DataLayers.Admins
#endregion TransferDestination #endregion TransferDestination
#region TransferToDriver #region TransferToDriver
public Task<TransferToDriver?> GetTransferToDriverByIdAsync(Guid transferToDriverId, bool autoInclude = false) => SessionAsync(ctx => ctx.TransferToDrivers.FirstOrDefault(x=>x.Id == transferToDriverId));
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 Task<bool> UpdateTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Update(transferToDriver).State == EntityState.Modified); public Task<bool> UpdateTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.TransferToDrivers.Update(transferToDriver).State == EntityState.Modified);
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);
@ -206,12 +209,12 @@ namespace TIAM.Database.DataLayers.Admins
#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).OrderByDescending(x=>x.Created).ToList());
public Task<List<EmailMessage>> GetEmailMessagesBySenderIdAsync(Guid senderId) => SessionAsync(ctx => ctx.GetEmailMessagesBySenderId(senderId).ToList()); public Task<List<EmailMessage>> GetEmailMessagesBySenderIdAsync(Guid senderId) => SessionAsync(ctx => ctx.GetEmailMessagesBySenderId(senderId).OrderByDescending(x=>x.Created).ToList());
public Task<List<EmailMessage>> GetEmailMessagesBySenderEmailAddressAsync(string emailAddress) => SessionAsync(ctx => ctx.GetEmailMessagesBySenderEmailAddress(emailAddress).ToList()); public Task<List<EmailMessage>> GetEmailMessagesBySenderEmailAddressAsync(string emailAddress) => SessionAsync(ctx => ctx.GetEmailMessagesBySenderEmailAddress(emailAddress).OrderByDescending(x=>x.Created).ToList());
public Task<List<EmailMessage>> GetEmailMessagesAsync(Guid userId, Guid userProductMappingId) => SessionAsync(ctx => ctx.GetEmailMessages<EmailMessage, EmailRecipient>(userId, userProductMappingId).ToList()); public Task<List<EmailMessage>> GetEmailMessagesAsync(Guid userId, Guid userProductMappingId) => SessionAsync(ctx => ctx.GetEmailMessages<EmailMessage, EmailRecipient>(userId, userProductMappingId).OrderByDescending(x=>x.Created).ToList());
public Task<List<EmailMessage>> GetEmailMessagesAsync(Guid contextId, Guid userId, Guid userProductMappingId) => SessionAsync(ctx => ctx.GetEmailMessages<EmailMessage, EmailRecipient>(contextId, userId, userProductMappingId).ToList()); public Task<List<EmailMessage>> GetEmailMessagesAsync(Guid contextId, Guid userId, Guid userProductMappingId) => SessionAsync(ctx => ctx.GetEmailMessages<EmailMessage, EmailRecipient>(contextId, userId, userProductMappingId).OrderByDescending(x=>x.Created).ToList());
public Task<List<EmailMessage>> GetAllEmailMessagesAsync() => SessionAsync(ctx => ctx.GetAllEmailMessages<EmailMessage, EmailRecipient>().ToList()); public Task<List<EmailMessage>> GetAllEmailMessagesAsync() => SessionAsync(ctx => ctx.GetAllEmailMessages<EmailMessage, EmailRecipient>().OrderByDescending(x=>x.Created).ToList());
public Task<bool> AddEmailMessageAsync(EmailMessage emailMessage) public Task<bool> AddEmailMessageAsync(EmailMessage emailMessage)

View File

@ -25,9 +25,9 @@ public class SignalRTags : AcSignalRTags
public const int AddCompany = 17; public const int AddCompany = 17;
public const int RemoveCompany = 18; public const int RemoveCompany = 18;
public const int GetTransferToDriver = 22; public const int GetTransferDriver = 22;
//public const int GetTransferToDrivers = 23; //public const int GetTransferToDrivers = 23;
public const int GetTransferToDriversByContextId = 24; public const int GetTransferDriversByTransferId = 24;
public const int AddTransferToDriver = 25; public const int AddTransferToDriver = 25;
public const int UpdateTransferToDriver = 26; public const int UpdateTransferToDriver = 26;
public const int RemoveTransferToDriver = 27; public const int RemoveTransferToDriver = 27;

View File

@ -30,7 +30,7 @@
ShowFilterRow="true"> ShowFilterRow="true">
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" /> <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="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
<DxGridDataColumn FieldName="AddressText" /> <DxGridDataColumn FieldName="AddressText" />
<DxGridDataColumn FieldName="IsValid" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" /> <DxGridDataColumn FieldName="IsValid" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
<DxGridDataColumn FieldName="IsHelper" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" /> <DxGridDataColumn FieldName="IsHelper" Width="40" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />

View File

@ -98,8 +98,8 @@
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/> <DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
<DxGridDataColumn FieldName="OrderId"> <DxGridDataColumn FieldName="OrderId" SortIndex="1" SortOrder="GridColumnSortOrder.Descending">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
var idKeyField = ((Transfer)context.DataItem).Id; var idKeyField = ((Transfer)context.DataItem).Id;
@ -114,7 +114,7 @@
<DxGridDataColumn Caption="Paid" FieldName="Payed"/> <DxGridDataColumn Caption="Paid" FieldName="Payed"/>
<DxGridDataColumn FieldName="FromAddress"/> <DxGridDataColumn FieldName="FromAddress"/>
<DxGridDataColumn FieldName="ToAddress"/> <DxGridDataColumn FieldName="ToAddress"/>
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140"/> <DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140" />
<DxGridDataColumn FieldName="FullName"/> <DxGridDataColumn FieldName="FullName"/>
<DxGridDataColumn FieldName="ContactPhone"/> <DxGridDataColumn FieldName="ContactPhone"/>
<DxGridDataColumn FieldName="ContactEmail"> <DxGridDataColumn FieldName="ContactEmail">
@ -128,7 +128,7 @@
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="PassengerCount"/> <DxGridDataColumn FieldName="PassengerCount"/>
<DxGridDataColumn FieldName="TransferStatusType"> <DxGridDataColumn FieldName="TransferStatusType" SortIndex="0" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
@ -145,7 +145,7 @@
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" /> <MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" />
</DxTabPage> </DxTabPage>
<DxTabPage Text="Driver"> <DxTabPage Text="Driver">
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" /> <TransferToDriverGridComponent ContextId="((Transfer)context.DataItem).Id" ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
</DxTabPage> </DxTabPage>
</DxTabs> </DxTabs>
</DetailRowTemplate> </DetailRowTemplate>

View File

@ -151,27 +151,9 @@
// //transferToModify.Driver = myModel.Driver; // //transferToModify.Driver = myModel.Driver;
// } // }
// } // }
//TODO: ne a teljes grid-et refresh-eljük, elég lenne csak az adott sort! - J.
await UpdateDataAsync();
} }
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) protected override void OnInitialized()
{
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
//remove orderData from orderData array
_logger.Info("orderData deleted");
//await UpdateDataAsync();
}
async Task UpdateDataAsync()
{
//refresh grid
_logger.Info("orderData grid refreshed");
}
protected override async Task OnInitializedAsync()
{ {
_logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray()); _logger = new LoggerClient<ManageUserProductMappings>(LogWriters.ToArray());

View File

@ -9,6 +9,7 @@
@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 AyCode.Core
@layout AdminLayout @layout AdminLayout
@inject IEnumerable<IAcLogWriterClientBase> LogWriters @inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject IStringLocalizer<TIAMResources> Localizer @inject IStringLocalizer<TIAMResources> Localizer
@ -75,8 +76,8 @@
KeyFieldName="Id"> KeyFieldName="Id">
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn Name="@Localizer.GetString("Id")" FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" /> <DxGridDataColumn Name="@Localizer.GetString("Id")" FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn Name="@Localizer.GetString("FullName")" FieldName="ProfileDto.FullName" /> <DxGridDataColumn Name="@Localizer.GetString("FullName")" FieldName="ProfileDto.FullName" />
<DxGridDataColumn Name="@Localizer.GetString("PhoneNumber")" FieldName="UserDto.PhoneNumber" /> <DxGridDataColumn Name="@Localizer.GetString("PhoneNumber")" FieldName="UserDto.PhoneNumber" />
<DxGridDataColumn Name="@Localizer.GetString("Created")" FieldName="UserDto.Created" /> <DxGridDataColumn Name="@Localizer.GetString("Created")" FieldName="UserDto.Created" />
@ -265,7 +266,6 @@
if (e.IsNew) if (e.IsNew)
{ {
//add new orderData to orderData array
var registration = new RegistrationModel(); var registration = new RegistrationModel();
//TODO: Refractor to userDataService //TODO: Refractor to userDataService
@ -284,7 +284,7 @@
} }
else else
{ {
_logger.Info("orderData updated at id " + userModelDtoDetail.Id); _logger.Info("UserData updated at id " + userModelDtoDetail.Id);
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel); //await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
//modify transferData where transferData.Id == e.EditModel.Id //modify transferData where transferData.Id == e.EditModel.Id
@ -307,17 +307,14 @@
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e) async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
{ {
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem); _logger.Info("UserData deleted");
//remove orderData from orderData array
_logger.Info("orderData deleted");
//await UpdateDataAsync();
} }
async Task UpdateDataAsync() async Task UpdateDataAsync()
{ {
//refresh grid //refresh grid
UserData = (await UserDataService.GetUsersWithDetailsAsync()).OrderBy(x => x.ProfileDto?.Name).ToList(); UserData = (await UserDataService.GetUsersWithDetailsAsync()).OrderBy(x => x.ProfileDto?.Name).ToList();
_logger.Info("orderData grid refreshed"); _logger.Info("UserData grid refreshed");
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()

View File

@ -31,7 +31,7 @@
<Columns> <Columns>
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" /> <DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" /> <DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="EmailAddress" Width="100px" Visible="@IsSenderEmailVisible" /> <DxGridDataColumn FieldName="EmailAddress" Width="100px" Visible="@IsSenderEmailVisible" />
<DxGridDataColumn FieldName="Subject" Visible=@IsSubjectVisible /> <DxGridDataColumn FieldName="Subject" Visible=@IsSubjectVisible />
@ -41,7 +41,7 @@
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="IsReaded" Caption="Readed" Width="70" CaptionAlignment="GridTextAlignment.Center" /> <DxGridDataColumn FieldName="IsReaded" Caption="Readed" Width="70" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Created" Width="100px" /> <DxGridDataColumn FieldName="Created" Width="100px" SortIndex="0" SortOrder="GridColumnSortOrder.Descending" />
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>
@{ @{

View File

@ -29,7 +29,7 @@
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"> DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" /> <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="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="Name" /> <DxGridDataColumn FieldName="Name" />
<DxGridDataColumn FieldName="FullName" /> <DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="Created" Width="40%" /> <DxGridDataColumn FieldName="Created" Width="40%" />

View File

@ -15,27 +15,23 @@
@inject IEnumerable<IAcLogWriterClientBase> LogWriters @inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject AdminSignalRClient AdminSignalRClient; @inject AdminSignalRClient AdminSignalRClient;
<TransferToDriversDetailGrid @ref="_transferToDriversGrid" <TransferToDriversDetailGrid @ref="_transferToDriversGrid"
ContextIds="ContextId.IsNullOrEmpty() ? throw new InvalidDataException() : [ContextId.Value]"
DataSource="ParentData.TransferToDrivers" DataSource="ParentData.TransferToDrivers"
Logger="_logger" Logger="_logger"
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
OnGridEditModelSaving="DataItemSaving" OnGridEditModelSaving="DataItemSaving"
OnGridItemDeleting="DataItemDeleting" OnGridItemDeleting="DataItemDeleting"
OnGridItemChanged="DataItemChanged" OnGridItemChanged="DataItemChanged"
PageSize="5"
AutoExpandAllGroupRows="true"
KeyboardNavigationEnabled="KeyboardNavigationEnabled" KeyboardNavigationEnabled="KeyboardNavigationEnabled"
KeyFieldName="Id" KeyFieldName="Id"
ValidationEnabled="false" ValidationEnabled="false"
CustomizeEditModel="CustomizeEditModel" CustomizeEditModel="CustomizeEditModel"
EditMode="GridEditMode.EditRow" EditMode="GridEditMode.EditRow"
ColumnResizeMode="GridColumnResizeMode.NextColumn" ColumnResizeMode="GridColumnResizeMode.NextColumn">
ShowFilterRow="false">
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" /> <DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="CarId" Width="40%" /> <DxGridDataColumn FieldName="CarId" Width="40%" />
<DxGridDataColumn FieldName="LicencePlate" /> <DxGridDataColumn FieldName="LicencePlate" />
</Columns> </Columns>
@ -43,7 +39,7 @@
@code { @code {
[Parameter] public bool KeyboardNavigationEnabled { get; set; } [Parameter] public bool KeyboardNavigationEnabled { 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; }
@ -59,8 +55,6 @@
private void DataItemChanged(GridDataItemChangedEventArgs<TransferToDriver> args) private void DataItemChanged(GridDataItemChangedEventArgs<TransferToDriver> args)
{ {
ParentData.TransferToDrivers.UpdateCollection(args.DataItem, args.TrackingState == TrackingState.Remove);
OnTransferToDriverChanged.InvokeAsync(args.DataItem); OnTransferToDriverChanged.InvokeAsync(args.DataItem);
} }

View File

@ -8,7 +8,7 @@ public class TransferToDriversGrid : TiamGrid<TransferToDriver>
{ {
public TransferToDriversGrid() : base() public TransferToDriversGrid() : base()
{ {
GetAllMessageTag = SignalRTags.GetTransferToDriversByContextId; GetAllMessageTag = SignalRTags.GetTransferDriversByTransferId;
AddMessageTag = SignalRTags.AddTransferToDriver; AddMessageTag = SignalRTags.AddTransferToDriver;
UpdateMessageTag = SignalRTags.UpdateTransferToDriver; UpdateMessageTag = SignalRTags.UpdateTransferToDriver;
RemoveMessageTag = SignalRTags.RemoveTransferToDriver; RemoveMessageTag = SignalRTags.RemoveTransferToDriver;

View File

@ -19,6 +19,7 @@ using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
using TIAMWebApp.Server.Services; using TIAMWebApp.Server.Services;
using TIAMWebApp.Shared.Application.Models.ClientSide; using TIAMWebApp.Shared.Application.Models.ClientSide;
using AyCode.Core.Extensions; using AyCode.Core.Extensions;
using TIAM.Entities.Users;
namespace TIAMWebApp.Server.Controllers namespace TIAMWebApp.Server.Controllers
{ {
@ -403,17 +404,6 @@ namespace TIAMWebApp.Server.Controllers
return result; return result;
} }
[Authorize]
[HttpGet]
[Route(APIUrls.GetTransfersByDriverRouteName)]
[SignalR(SignalRTags.GetTransfersByDriverId)]
public Task<string> GetDriverTransfers(Guid transferId, Guid userProductMappingId)
{
throw new NotImplementedException();
//var result = await _adminDal.GetTransfersByUserIdJsonAsync(userId);
//return result;
}
[AllowAnonymous] [AllowAnonymous]
[HttpPost] [HttpPost]
[Route(APIUrls.GetTransferByIdRouteName)] [Route(APIUrls.GetTransferByIdRouteName)]
@ -437,5 +427,55 @@ namespace TIAMWebApp.Server.Controllers
return transferToModify; return transferToModify;
} }
[Authorize]
[HttpGet]
[Route(APIUrls.GetTransferDriverRouteName)]
[SignalR(SignalRTags.GetTransferDriver)]
public async Task<TransferToDriver?> GetTransferDriver(Guid transferDriverId)
{
var result = await _adminDal.GetTransferToDriverByIdAsync(transferDriverId);
return result;
}
[Authorize]
[HttpGet]
[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.GetTransferDriversByTransferId)]
public async Task<List<TransferToDriver>> GetTransferDrivers(Guid transferId)
{
var result = await _adminDal.GetTransferToDriversByTransferIdAsync(transferId);
return result;
}
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.AddTransferToDriver)]
public async Task<TransferToDriver?> AddTransferDriver([FromBody] TransferToDriver transferToDriver)
{
var result = await _adminDal.AddTransferToDriverAsync(transferToDriver);
return result ? transferToDriver : null;
}
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.UpdateTransferToDriver)]
public async Task<TransferToDriver?> UpdateTransferDriver([FromBody] TransferToDriver transferToDriver)
{
var result = await _adminDal.UpdateTransferToDriverAsync(transferToDriver);
return result ? transferToDriver : null;
}
//[Authorize]
//[HttpGet]
//[Route(APIUrls.GetTransferDriversByTransferIdRouteName)]
[SignalR(SignalRTags.RemoveTransferToDriver)]
public async Task<TransferToDriver?> RemoveTransferDriver([FromBody] TransferToDriver transferToDriver)
{
var result = await _adminDal.RemoveTransferToDriverAsync(transferToDriver);
return result ? transferToDriver : null;
}
} }
} }

View File

@ -87,9 +87,6 @@ namespace TIAMWebApp.Shared.Application.Models
public const string GetTransfersByUserIdRouteName = "GetTransfersByUserId"; public const string GetTransfersByUserIdRouteName = "GetTransfersByUserId";
public const string GetTransfersByUserId = TransferDataAPI + GetTransfersByUserIdRouteName; public const string GetTransfersByUserId = TransferDataAPI + GetTransfersByUserIdRouteName;
public const string GetTransfersByDriverRouteName = "GetTransfersByDriverId";
public const string GetTransfersByDriver = TransferDataAPI + GetTransfersByDriverRouteName;
public const string GetTransferByIdRouteName = "GetTransferById"; public const string GetTransferByIdRouteName = "GetTransferById";
public const string GetTransferById = TransferDataAPI + GetTransferByIdRouteName; public const string GetTransferById = TransferDataAPI + GetTransferByIdRouteName;
@ -105,6 +102,12 @@ namespace TIAMWebApp.Shared.Application.Models
public const string UpdateTransferDestinationRouteName = "UpdateTransferDestintion"; public const string UpdateTransferDestinationRouteName = "UpdateTransferDestintion";
public const string UpdateTransferDestination = TransferDataAPI + UpdateTransferDestinationRouteName; public const string UpdateTransferDestination = TransferDataAPI + UpdateTransferDestinationRouteName;
public const string GetTransferDriverRouteName = "GetTransfersByDriverId";
public const string GetTransferDriver = TransferDataAPI + GetTransferDriverRouteName;
public const string GetTransferDriversByTransferIdRouteName = "GetTransfersByDriverId";
public const string GetTransferDriversByTransferId = TransferDataAPI + GetTransferDriversByTransferIdRouteName;
//serviceprovider //serviceprovider
public const string CreateServiceProviderRouteName = "CreateServiceProvider/"; public const string CreateServiceProviderRouteName = "CreateServiceProvider/";
public const string CreateServiceProvider = ServiceProviderAPI + CreateServiceProviderRouteName; public const string CreateServiceProvider = ServiceProviderAPI + CreateServiceProviderRouteName;

View File

@ -45,8 +45,8 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
public Product SaveToProduct(Company company) public Product SaveToProduct(Company company)
{ {
Product NewProduct = new(this.Id, company.Id, company, this.ProductType, this.Name, this.Description, this.Price, this.JsonDetails); Product newProduct = new(this.Id, company.Id, company, this.ProductType, this.Name, this.Description, this.Price, this.JsonDetails);
return NewProduct; return newProduct;
} }
} }
} }