This commit is contained in:
Adam 2024-07-02 19:03:47 +02:00
commit b432da5b59
18 changed files with 187 additions and 80 deletions

View File

@ -8,7 +8,7 @@
</SourceModelProvider>
<TargetModelProvider>
<ConnectionBasedModelProvider>
<ConnectionString>Data Source=185.51.190.197;Initial Catalog=TIAM_DEVRELEASE;Persist Security Info=True;User ID=Anata_Development_Team;Pooling=False;Multiple Active Result Sets=False;Connect Timeout=60;Encrypt=True;Trust Server Certificate=True;Command Timeout=0</ConnectionString>
<ConnectionString>Data Source=185.51.190.197;Initial Catalog=TIAM_PROD;Persist Security Info=True;User ID=Anata_Development_Team;Pooling=False;Multiple Active Result Sets=False;Connect Timeout=60;Encrypt=True;Trust Server Certificate=True;Command Timeout=0</ConnectionString>
</ConnectionBasedModelProvider>
</TargetModelProvider>
<SchemaCompareSettingsService>
@ -345,11 +345,11 @@
</PropertyElementName>
<PropertyElementName>
<Name>TargetDatabaseName</Name>
<Value>TIAM_DEVRELEASE</Value>
<Value>TIAM_PROD</Value>
</PropertyElementName>
<PropertyElementName>
<Name>TargetConnectionString</Name>
<Value>Data Source=185.51.190.197;Initial Catalog=TIAM_DEVRELEASE;Persist Security Info=True;User ID=Anata_Development_Team;Pooling=False;Multiple Active Result Sets=False;Connect Timeout=60;Encrypt=True;Trust Server Certificate=True;Application Name="Microsoft SQL Server Data Tools, Schema Compare";Command Timeout=0</Value>
<Value>Data Source=185.51.190.197;Initial Catalog=TIAM_PROD;Persist Security Info=True;User ID=Anata_Development_Team;Pooling=False;Multiple Active Result Sets=False;Connect Timeout=60;Encrypt=True;Trust Server Certificate=True;Application Name="Microsoft SQL Server Data Tools, Schema Compare";Command Timeout=0</Value>
</PropertyElementName>
<PropertyElementName>
<Name>TreatVerificationErrorsAsWarnings</Name>
@ -942,5 +942,17 @@
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlUser, Microsoft.Data.Tools.Schema.Sql, Version=162.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>Anata_Development_Team</Name>
</SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlFile, Microsoft.Data.Tools.Schema.Sql, Version=162.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>TIAM_DEV</Name>
</SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlFile, Microsoft.Data.Tools.Schema.Sql, Version=162.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>TIAM_DEV_log</Name>
</SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlFile, Microsoft.Data.Tools.Schema.Sql, Version=162.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>TIAM_DEVRELEASE</Name>
</SelectedItem>
<SelectedItem Type="Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlFile, Microsoft.Data.Tools.Schema.Sql, Version=162.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Name>TIAM_DEVRELEASE_log</Name>
</SelectedItem>
</ExcludedSourceElements>
</SchemaComparison>

View File

@ -371,7 +371,7 @@ namespace TIAM.Database.Test
Assert.IsTrue(company.Id == companyId);
company.OwnerId = userId;
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
Assert.IsNotNull(await Dal.UpdateCompanyAsync(company));
company = await Dal.GetCompanyByIdAsync(companyId);
@ -380,7 +380,7 @@ namespace TIAM.Database.Test
Assert.IsTrue(company.UserToServiceProviders.Any(x=>x.UserId == userId && x.ServiceProviderId == companyId));
company.CommissionPercent = 5;
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
Assert.IsNotNull(await Dal.UpdateCompanyAsync(company));
var addressId = company.Profile.AddressId;
Assert.IsTrue(await Dal.RemoveCompanyAsync(company.Id)); //mielőbb kitöröljük, h ne maradjon szemét a db-ben - J.

View File

@ -30,6 +30,7 @@ using DevExpress.Data.Linq;
using DevExpress.Data.Linq.Helpers;
using TIAM.Database.DbSets.Drivers;
using AyCode.Entities.Server.LogItems;
using AyCode.Interfaces.Entities;
namespace TIAM.Database.DataLayers.Admins
{
@ -56,6 +57,9 @@ namespace TIAM.Database.DataLayers.Admins
public Task<List<Transfer>> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable<Transfer>)!.ToList());
public Task<List<Transfer>> GetTransfersByUserProductMappingIdAsync(Guid userProductMappingId)
=> SessionAsync(ctx => ctx.GetTransfers().Where(x => x.TransferToDrivers.Any(ttd => ttd.UserProductMappingId == userProductMappingId)).ToList());
public Task<List<Transfer>> GetTransfersAsync() => SessionAsync(ctx => ctx.GetTransfers().OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList());
public Task<string> GetTransfersJsonAsync() => SessionAsync(ctx => ctx.GetTransfers().OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToJson());
public Task<string> GetTransfersByUserIdJsonAsync(Guid userId) => SessionAsync(ctx => ctx.GetTransfers().Where(x => x.UserId == userId).OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToJson());
@ -346,29 +350,26 @@ namespace TIAM.Database.DataLayers.Admins
//}
//14. (IserviceProviderDataService) Update service provider
public Task<bool> UpdateCompanyAsync(Company company)
{
var result = NewUpdateCompanyAsync(company);
if (result.Result != null || (result.Result).Id != Guid.Empty)
{
return Task.FromResult(true);
}
else
{
return Task.FromResult(false);
}
}
//public Task<bool> UpdateCompanyAsync(Company company)
//{
// var result = NewUpdateCompanyAsync(company);
// return Task.FromResult(result.Result != null && !result.Result.Id.IsNullOrEmpty());
//}
public Task<Company?> NewUpdateCompanyAsync(Company company) => UpdateSafeAsync(company, (ctx, safeCompany) => ctx.UpdateCompany(safeCompany));
public Task<Company?> UpdateCompanyAsync(Company company) => UpdateSafeAsync(company, (ctx, safeCompany) =>
{
ctx.Entry(safeCompany.Profile).CurrentValues.SetValues(company.Profile);
return ctx.UpdateCompany(safeCompany);
});
public Task<bool> UpdateCompanyAsync(Company company, Profile profile)
=> TransactionAsync(ctx =>
{
ctx.UpdateProfile(profile);
ctx.SaveChanges();
//public Task<bool> UpdateCompanyAsync(Company company, Profile profile)
// => TransactionAsync(ctx =>
// {
// ctx.UpdateProfile(profile);
// ctx.SaveChanges();
return ctx.UpdateCompany(company);
});
// return ctx.UpdateCompany(company);
// });
//13. (IserviceProviderDataService) delete service provider
public Task<bool> RemoveCompanyAsync(Guid companyId) => TransactionAsync(ctx => ctx.RemoveProductsByCompanyId(companyId) && ctx.RemoveCompany(companyId));
@ -685,8 +686,8 @@ namespace TIAM.Database.DataLayers.Admins
#region Logs
public Task<List<AcLogItem>> GetLogItemsAsync(int takeCount = 500) => SessionAsync(ctx => ctx.LogItems.Take(takeCount).ToList());
public Task<List<AcLogItem>> GetLogItemsByFilterAsync(CriteriaOperator criteriaOperator, int takeCount = 500) => SessionAsync(ctx => (ctx.LogItems.AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator).Take(takeCount) as IQueryable<AcLogItem>)!.ToList());
public Task<List<AcLogItem>> GetLogItemsAsync(int takeCount, DateTime utcFromDate, DateTime utcToDate) => SessionAsync(ctx => ctx.LogItems.Where(x => x.TimeStampUtc.Date >= utcFromDate.Date && x.TimeStampUtc.Date <= utcToDate.Date).Take(takeCount).ToList());
public Task<List<AcLogItem>> GetLogItemsByFilterAsync(CriteriaOperator criteriaOperator, int takeCount, DateTime utcFromDate, DateTime utcToDate) => SessionAsync(ctx => (ctx.LogItems.Where(x => x.TimeStampUtc.Date >= utcFromDate.Date && x.TimeStampUtc.Date <= utcToDate.Date).AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator).Take(takeCount) as IQueryable<AcLogItem>)!.ToList());
#endregion
}

View File

@ -41,7 +41,7 @@
<CompanyGrid @ref="_gridCompany"
Logger="_logger"
SignalRClient="AdminSignalRClient"
ContextIds="contextIds"
ContextIds="contextIds.Cast<object>().ToArray()"
GetAllMessageTag="SignalRTags.GetCompaniesByContextId"
PageSize="12"
ValidationEnabled="false"

View File

@ -27,9 +27,9 @@
<div class="container">
<div class="w-100 ch-220">
<CompanyByIdDetailGrid @ref="_gridCompany"
Context="myContext"
ContextIds="@CompanyId"
<CompanyByIdDetailGrid @ref="_gridCompany"
Context="myContext"
ContextIds="@(CompanyId?.Cast<object>().ToArray())"
Logger="_logger"
SignalRClient="AdminSignalRClient"
CustomizeElement="Grid_CustomizeElement"

View File

@ -22,7 +22,7 @@
<AddressDetailGrid @ref="_addressGrid"
ContextIds="new[] {ParentData.AddressId}"
ContextIds="new object[] {ParentData.AddressId}"
DataSource="DataSource"
Logger="_logger"
SignalRClient="AdminSignalRClient"

View File

@ -29,7 +29,7 @@
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
ShowFilterRow="true">
<Columns>
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="UserProductMappingId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
@{
@ -52,7 +52,8 @@
<DxTabs>
<DxTabPage Text="Driving permissions assigned">
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingsById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }" />
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingsById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }"
NewButtonVisible="false"/>
</DxTabPage>
</DxTabs>

View File

@ -43,9 +43,10 @@
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
<Columns>
<DxGridDataColumn FieldName="Id" Caption="ID" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Id" Caption="ID" />
@* <DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
*@ </Columns>
</DxGrid>
</BodyContentTemplate>
<FooterContentTemplate Context="PopupContext">
@ -60,7 +61,7 @@
<UserProductMappingDriverGrid Logger="_logger"
@ref="_driverGrid"
ContextIds="new [] {ContextId}"
ContextIds="new object[] {ContextId}"
GetAllMessageTag="GetAllTag"
SignalRClient="AdminSignalRClient"
PageSize="10"

View File

@ -14,8 +14,10 @@
@using AyCode.Services.Loggers
@using AyCode.Core
@using AyCode.Core.Extensions
@using AyCode.Core.Helpers
@using Castle.Components.DictionaryAdapter
@using DevExpress.Data.Filtering
@using DevExpress.DirectX.Common.Direct2D
@using TIAM.Core.Enums
@inject IServiceProviderDataService ServiceProviderDataService
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@ -27,6 +29,7 @@
@* VirtualScrollingEnabled="true" *@
<LogViewerGrid Logger="_logger"
@ref="_logViewerGrid"
ContextIds="_contextParams"
SignalRClient="AdminSignalRClient"
FilterText="@_filterText"
ShowGroupPanel="true"
@ -55,17 +58,65 @@
@{
var a = ((LogItemViewerModel)context.DataItem);
}
<div><p>@($"{a.CategoryName}->{a.CallerName}")</p></div>
<div><p>@($"{a.Text}")</p></div><br />
<div style="font-weight: bold;">Exception:</div>
<div><p style="text-wrap: wrap;">@a.Exception</p></div>
<div>
<div>@($"{a.CategoryName}->{a.CallerName}")</div>
<p style="text-wrap: wrap; margin-top: 5px;">@($"{a.Text}")</p>
</div>
<div>
<div style="font-weight: bold;">Exception:</div>
<p style="text-wrap: wrap;">@a.Exception</p>
</div>
</DetailRowTemplate>
<ToolbarTemplate>
<div>
<DxTagBox Data="@(Enum.GetValues<LogLevel>().ToList())" Values="@_selectedLogLevels"
NullText="Select status type..." ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type"
ValuesChanged="(IEnumerable<LogLevel> values) => TagBox_ValuesChanged(values)" />
</div>
<DxGridLayout>
<Rows>
<DxGridLayoutRow />
</Rows>
<Columns>
<DxGridLayoutColumn />
<DxGridLayoutColumn Width="130" />
<DxGridLayoutColumn Width="130" />
<DxGridLayoutColumn Width="100" />
<DxGridLayoutColumn Width="auto" />
</Columns>
<Items>
<DxGridLayoutItem Row="0" Column="0">
<Template>
<DxTagBox Data="@(Enum.GetValues<LogLevel>().ToList())" Values="@_selectedLogLevels"
NullText="Select status type..." ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type"
ValuesChanged="(IEnumerable<LogLevel> values) => TagBox_ValuesChanged(values)" />
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Row="0" Column="1">
<Template>
<DxDateEdit Date="@_fromDate"
NullText="Select fromDate..."
DisplayFormat="d"
DateChanged="@((DateTime fromDate) => OnValueChangedStartDate(fromDate))"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Never">
</DxDateEdit>
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Row="0" Column="2">
<Template>
<DxDateEdit Date="@_toDate"
NullText="select toDate..."
DisplayFormat="d"
DateChanged="@((DateTime toDate) => OnValueChangedEndDate(toDate))"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Never">
</DxDateEdit>
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Row="0" Column="3">
<Template>
<DxSpinEdit Value="@_takeCount" CssClass="dx-demo-editor-width" MinValue="0" Increment="500" BindValueMode="BindValueMode.OnDelayedInput" InputDelay="1500"
ValueChanged="@((int newValue) => OnValueChangedTakeCount(newValue))">
</DxSpinEdit>
</Template>
</DxGridLayoutItem>
</Items>
</DxGridLayout>
</ToolbarTemplate>
</LogViewerGrid>
@ -73,6 +124,13 @@
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
private LogViewerGrid _logViewerGrid;
private static DateTime _fromDate = DateTime.Today.AddDays(-2);
private static DateTime _toDate = DateTime.Today;
private static int _takeCount = 250;
private object[] _contextParams = new object[3] { _takeCount, _fromDate, _toDate };
private LoggerClient<LogViewerGridComponent> _logger;
private static List<LogLevel> _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest];
private static string _filterText = GetFilterText(_selectedLogLevels);
@ -104,6 +162,39 @@
_logViewerGrid.SetFieldFilterCriteria(nameof(LogLevel), filterCriteria);
}
private async Task OnValueChangedTakeCount(int value)
{
if (_takeCount == value) return;
_takeCount = value;
_contextParams[0] = _takeCount;
await _logViewerGrid.LoadDataSourceAsync();
}
private async Task OnValueChangedStartDate(DateTime value)
{
if (_fromDate == value) return;
_fromDate = value;
if (_fromDate.Date > DateTime.Today.Date) _fromDate = DateTime.Today;
_contextParams[1] = _fromDate;
if (_fromDate.Date > _toDate.Date) return;
await _logViewerGrid.LoadDataSourceAsync();
}
private async Task OnValueChangedEndDate(DateTime value)
{
if (_toDate == value) return;
_toDate = value;
_contextParams[2] = _toDate;
if (_fromDate.Date > _toDate.Date) return;
await _logViewerGrid.LoadDataSourceAsync();
}
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{
if (e.ElementType != GridElementType.DataRow) return;

View File

@ -92,7 +92,7 @@
CustomizeEditModel="Grid_CustomizeEditModel"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
AllowSelectRowByClick="false"
AllowSelectRowByClick="true"
PageSize="13"
ShowFilterRow="true">

View File

@ -18,7 +18,7 @@
<CompanyDetailGrid Data="_detailGridData"
Logger="_logger"
SignalRClient="AdminSignalRClient"
ContextIds="ContextIds"
ContextIds="ContextIds?.Cast<object>().ToArray()"
PageSize="5"
ValidationEnabled="false"
EditMode="GridEditMode.EditForm"

View File

@ -16,16 +16,16 @@
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
@inject AdminSignalRClient AdminSignalRClient;
<TransferDestinationToProductDetailGrid
Logger="_logger"
SignalRClient="AdminSignalRClient"
ContextIds="ContextIds"
GetAllMessageTag="GetAllTag"
PageSize="10"
ValidationEnabled="false"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn">
<TransferDestinationToProductDetailGrid Logger="_logger"
SignalRClient="AdminSignalRClient"
ContextIds="ContextIds?.Cast<object>().ToArray()"
GetAllMessageTag="GetAllTag"
PageSize="10"
ValidationEnabled="false"
EditMode="GridEditMode.EditForm"
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
ColumnResizeMode="GridColumnResizeMode.NextColumn">
<Columns>
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
@ -33,7 +33,7 @@
<DxGridDataColumn FieldName="TransferDestinationId" />
@*<DxGridDataColumn FieldName="TransferDestinationId" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
@{
var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}";
var destinationNameFieldName = $"{nameof(TransferDestinationToProduct.TransferDestination.Name)}.{nameof(TransferDestination.Name)}";
}
<DxGridDataColumn FieldName="@destinationNameFieldName" Caption="TransferDestination name" />*@
<DxGridDataColumn FieldName="Price" />
@ -43,20 +43,20 @@
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns>
<DetailRowTemplate>
<DetailRowTemplate>
<DxTabs>
<DxTabPage Text="Partner">
<ProductDetailGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetProductsById" ContextId="((TransferDestinationToProduct)context.DataItem).ProductId" ParentData="(Company)context.DataItem" />
<ProductDetailGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" GetAllTag="SignalRTags.GetProductsById" ContextId="((TransferDestinationToProduct)context.DataItem).ProductId" ParentData="(Company)context.DataItem" />
</DxTabPage>
</DxTabs>
</DetailRowTemplate>
<EditFormTemplate Context="editFormContext">
@{
var serviceProvider = (Company)editFormContext.EditModel;
var transferDestinationToProduct = (TransferDestinationToProduct)editFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption="Price" ColSpanMd="4">
@ -68,7 +68,7 @@
<DxFormLayoutItem Caption="Price3" ColSpanMd="4">
@editFormContext.GetEditor("Price3")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
@editFormContext.GetEditor("ProductCommis")
</DxFormLayoutItem>

View File

@ -18,7 +18,7 @@
<UserProductMappingGrid Logger="_logger"
ContextIds="ContextIds"
ContextIds="ContextIds?.Cast<object>().ToArray()"
GetAllMessageTag="GetAllTag"
SignalRClient="AdminSignalRClient"
PageSize="10"
@ -28,7 +28,7 @@
ColumnResizeMode="GridColumnResizeMode.NextColumn"
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
<Columns>
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridCommandColumn Width="135" MinWidth="135" NewButtonVisible="NewButtonVisible" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="UserId" Caption="UserId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
@{
@ -80,6 +80,7 @@
</UserProductMappingGrid>
@code {
[Parameter] public bool NewButtonVisible { get; set; } = true;
[Parameter] public IProductRelation ParentData { get; set; } = null!;
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;

View File

@ -31,7 +31,7 @@ namespace TIAMSharedUI.Shared.Components.Grids
[Parameter] public LoggerClient Logger { get; set; }
[Parameter] public string GridName { get; set; }
[Parameter] public Guid[]? ContextIds { get; set; }
[Parameter] public object[]? ContextIds { get; set; }
private string? _filterText = null;

View File

@ -57,13 +57,13 @@ namespace TIAMWebApp.Server.Controllers
[HttpGet]
[Route(APIUrls.GetAllLogItemsRouteName)]
[SignalR(SignalRTags.GetAllLogItemsByFilterText)]
public async Task<List<LogItemViewerModel>> GetAllLogItems(string? criteriaOperatorText) //(int takeCount, string filterText)
public async Task<List<LogItemViewerModel>> GetAllLogItems(int takeCount, DateTime fromDate, DateTime toDate, string? criteriaOperatorText) //(int takeCount, string filterText)
{
//public Task<List<Transfer>> GetTransfersByFilterAsync(CriteriaOperator criteriaOperator) => SessionAsync(ctx => (ctx.GetTransfers().AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator) as IQueryable<Transfer>)!.ToList());
logger.Debug($"GetAllLogItems; takeCount: {takeCount}; fromDate: {fromDate}; toDate: {toDate}; criteriaOperatorText: {criteriaOperatorText}");
List<AcLogItem> logItemList;
if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(1000);
else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText),1000);
if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(takeCount, fromDate, toDate);
else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText), takeCount, fromDate, toDate);
var resultList = new List<LogItemViewerModel>(logItemList.Count);
//logItemList[0].ToModelDto<LogItemViewerModel, AcLogItem>();

View File

@ -31,14 +31,14 @@ namespace TIAMWebApp.Server.Controllers
[NonAction]
[ApiExplorerSettings(IgnoreApi = true)]
private async Task<bool> CompanyDataChanging(Company company, TrackingState trackingState)
private async Task<Company?> CompanyDataChanging(Company company, TrackingState trackingState)
{
var logText = $"[{trackingState.ToString().ToUpper()}] CompanyDataChanging called; Id: {company.Id}; OwnerId: {company.OwnerId}; Name: {company.Name}";
if (company.Name.IsNullOrEmpty())
{
_logger.Error(logText);
return false;
return null;
}
_logger.Info(logText);
@ -53,12 +53,12 @@ namespace TIAMWebApp.Server.Controllers
//company.SetProfile(new Profile(Guid.NewGuid(), company.Name));
//company.Profile.SetAddress(new Address(Guid.NewGuid(), "Controller AddCompanyAsync; address text..."));
return await adminDal.AddCompanyAsync(company);
return (await adminDal.AddCompanyAsync(company)) ? company : null;
case TrackingState.Update:
return await adminDal.UpdateCompanyAsync(company);
case TrackingState.Remove:
return await adminDal.RemoveCompanyAsync(company.Id);
return (await adminDal.RemoveCompanyAsync(company.Id)) ? company : null;
case TrackingState.Get:
case TrackingState.GetAll:
@ -71,21 +71,21 @@ namespace TIAMWebApp.Server.Controllers
[ApiExplorerSettings(IgnoreApi = true)]
[SignalR(SignalRTags.AddCompany)]
public async Task<string> AddCompanyAsync(Company company)
=> await CompanyDataChanging(company, TrackingState.Add) ? company.ToJson() : string.Empty;
=> (await CompanyDataChanging(company, TrackingState.Add))?.ToJson() ?? string.Empty;
[AllowAnonymous]
[HttpPost]
[Route(APIUrls.UpdateServiceProviderRouteName)]
[SignalR(SignalRTags.UpdateCompany)]
public async Task<string> UpdateServiceProvider(Company company)
=> await CompanyDataChanging(company, TrackingState.Update) ? company.ToJson() : string.Empty;
=> (await CompanyDataChanging(company, TrackingState.Update))?.ToJson() ?? string.Empty;
[AllowAnonymous]
[HttpPost]
[Route(APIUrls.RemoveServiceProviderRouteName)]
[SignalR(SignalRTags.RemoveCompany)]
public async Task<string> RemoveServiceProvider(Company company)
=> await CompanyDataChanging(company, TrackingState.Remove) ? company.ToJson() : string.Empty;
=> (await CompanyDataChanging(company, TrackingState.Remove))?.ToJson() ?? string.Empty;
//15.
[AllowAnonymous]

View File

@ -162,7 +162,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
paramValues = new object[methodInfoModel.ParamInfos.Length];
var firstParamType = methodInfoModel.ParamInfos[0].ParameterType;
if (methodInfoModel.ParamInfos.Length > 1 || firstParamType == typeof(string) || firstParamType.IsEnum || firstParamType.IsValueType)
if (methodInfoModel.ParamInfos.Length > 1 || firstParamType == typeof(string) || firstParamType.IsEnum || firstParamType.IsValueType || firstParamType == typeof(DateTime))
{
var msg = message!.MessagePackTo<SignalPostJsonDataMessage<IdMessage>>();

View File

@ -17,6 +17,6 @@ namespace TIAMWebApp.Shared.Application.Utility
{
[Serializable]
[DebuggerDisplay("Count = {Count}")]
public class SignalRDataSource<T>(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, params Guid[]? contextIds)
public class SignalRDataSource<T>(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, params object[]? contextIds)
: AcSignalRDataSource<T>(signalRClient, signalRCrudTags, contextIds) where T : class, IId<Guid>;
}