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> </SourceModelProvider>
<TargetModelProvider> <TargetModelProvider>
<ConnectionBasedModelProvider> <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> </ConnectionBasedModelProvider>
</TargetModelProvider> </TargetModelProvider>
<SchemaCompareSettingsService> <SchemaCompareSettingsService>
@ -345,11 +345,11 @@
</PropertyElementName> </PropertyElementName>
<PropertyElementName> <PropertyElementName>
<Name>TargetDatabaseName</Name> <Name>TargetDatabaseName</Name>
<Value>TIAM_DEVRELEASE</Value> <Value>TIAM_PROD</Value>
</PropertyElementName> </PropertyElementName>
<PropertyElementName> <PropertyElementName>
<Name>TargetConnectionString</Name> <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>
<PropertyElementName> <PropertyElementName>
<Name>TreatVerificationErrorsAsWarnings</Name> <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"> <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> <Name>Anata_Development_Team</Name>
</SelectedItem> </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> </ExcludedSourceElements>
</SchemaComparison> </SchemaComparison>

View File

@ -371,7 +371,7 @@ namespace TIAM.Database.Test
Assert.IsTrue(company.Id == companyId); Assert.IsTrue(company.Id == companyId);
company.OwnerId = userId; company.OwnerId = userId;
Assert.IsTrue(await Dal.UpdateCompanyAsync(company)); Assert.IsNotNull(await Dal.UpdateCompanyAsync(company));
company = await Dal.GetCompanyByIdAsync(companyId); 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)); Assert.IsTrue(company.UserToServiceProviders.Any(x=>x.UserId == userId && x.ServiceProviderId == companyId));
company.CommissionPercent = 5; company.CommissionPercent = 5;
Assert.IsTrue(await Dal.UpdateCompanyAsync(company)); Assert.IsNotNull(await Dal.UpdateCompanyAsync(company));
var addressId = company.Profile.AddressId; 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. 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 DevExpress.Data.Linq.Helpers;
using TIAM.Database.DbSets.Drivers; using TIAM.Database.DbSets.Drivers;
using AyCode.Entities.Server.LogItems; using AyCode.Entities.Server.LogItems;
using AyCode.Interfaces.Entities;
namespace TIAM.Database.DataLayers.Admins 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>> 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<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> 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()); 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 //14. (IserviceProviderDataService) Update service provider
public Task<bool> UpdateCompanyAsync(Company company) //public Task<bool> UpdateCompanyAsync(Company company)
{ //{
var result = NewUpdateCompanyAsync(company); // var result = NewUpdateCompanyAsync(company);
if (result.Result != null || (result.Result).Id != Guid.Empty) // return Task.FromResult(result.Result != null && !result.Result.Id.IsNullOrEmpty());
{ //}
return Task.FromResult(true);
}
else
{
return Task.FromResult(false);
}
}
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) //public Task<bool> UpdateCompanyAsync(Company company, Profile profile)
=> TransactionAsync(ctx => // => TransactionAsync(ctx =>
{ // {
ctx.UpdateProfile(profile); // ctx.UpdateProfile(profile);
ctx.SaveChanges(); // ctx.SaveChanges();
return ctx.UpdateCompany(company); // return ctx.UpdateCompany(company);
}); // });
//13. (IserviceProviderDataService) delete service provider //13. (IserviceProviderDataService) delete service provider
public Task<bool> RemoveCompanyAsync(Guid companyId) => TransactionAsync(ctx => ctx.RemoveProductsByCompanyId(companyId) && ctx.RemoveCompany(companyId)); 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 #region Logs
public Task<List<AcLogItem>> GetLogItemsAsync(int takeCount = 500) => SessionAsync(ctx => ctx.LogItems.Take(takeCount).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 = 500) => SessionAsync(ctx => (ctx.LogItems.AppendWhere(new CriteriaToExpressionConverter(), criteriaOperator).Take(takeCount) as IQueryable<AcLogItem>)!.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 #endregion
} }

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode" DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
ShowFilterRow="true"> ShowFilterRow="true">
<Columns> <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="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="UserProductMappingId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" /> <DxGridDataColumn FieldName="UserProductMappingId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
@{ @{
@ -52,7 +52,8 @@
<DxTabs> <DxTabs>
<DxTabPage Text="Driving permissions assigned"> <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> </DxTabPage>
</DxTabs> </DxTabs>

View File

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

View File

@ -14,8 +14,10 @@
@using AyCode.Services.Loggers @using AyCode.Services.Loggers
@using AyCode.Core @using AyCode.Core
@using AyCode.Core.Extensions @using AyCode.Core.Extensions
@using AyCode.Core.Helpers
@using Castle.Components.DictionaryAdapter @using Castle.Components.DictionaryAdapter
@using DevExpress.Data.Filtering @using DevExpress.Data.Filtering
@using DevExpress.DirectX.Common.Direct2D
@using TIAM.Core.Enums @using TIAM.Core.Enums
@inject IServiceProviderDataService ServiceProviderDataService @inject IServiceProviderDataService ServiceProviderDataService
@inject IEnumerable<IAcLogWriterClientBase> LogWriters @inject IEnumerable<IAcLogWriterClientBase> LogWriters
@ -27,6 +29,7 @@
@* VirtualScrollingEnabled="true" *@ @* VirtualScrollingEnabled="true" *@
<LogViewerGrid Logger="_logger" <LogViewerGrid Logger="_logger"
@ref="_logViewerGrid" @ref="_logViewerGrid"
ContextIds="_contextParams"
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
FilterText="@_filterText" FilterText="@_filterText"
ShowGroupPanel="true" ShowGroupPanel="true"
@ -55,17 +58,65 @@
@{ @{
var a = ((LogItemViewerModel)context.DataItem); var a = ((LogItemViewerModel)context.DataItem);
} }
<div><p>@($"{a.CategoryName}->{a.CallerName}")</p></div> <div>
<div><p>@($"{a.Text}")</p></div><br /> <div>@($"{a.CategoryName}->{a.CallerName}")</div>
<div style="font-weight: bold;">Exception:</div> <p style="text-wrap: wrap; margin-top: 5px;">@($"{a.Text}")</p>
<div><p style="text-wrap: wrap;">@a.Exception</p></div> </div>
<div>
<div style="font-weight: bold;">Exception:</div>
<p style="text-wrap: wrap;">@a.Exception</p>
</div>
</DetailRowTemplate> </DetailRowTemplate>
<ToolbarTemplate> <ToolbarTemplate>
<div> <DxGridLayout>
<DxTagBox Data="@(Enum.GetValues<LogLevel>().ToList())" Values="@_selectedLogLevels" <Rows>
NullText="Select status type..." ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto" aria-label="Select status type" <DxGridLayoutRow />
ValuesChanged="(IEnumerable<LogLevel> values) => TagBox_ValuesChanged(values)" /> </Rows>
</div> <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> </ToolbarTemplate>
</LogViewerGrid> </LogViewerGrid>
@ -73,6 +124,13 @@
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never; [Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
private LogViewerGrid _logViewerGrid; 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 LoggerClient<LogViewerGridComponent> _logger;
private static List<LogLevel> _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest]; private static List<LogLevel> _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest];
private static string _filterText = GetFilterText(_selectedLogLevels); private static string _filterText = GetFilterText(_selectedLogLevels);
@ -104,6 +162,39 @@
_logViewerGrid.SetFieldFilterCriteria(nameof(LogLevel), filterCriteria); _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) void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
{ {
if (e.ElementType != GridElementType.DataRow) return; if (e.ElementType != GridElementType.DataRow) return;

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
<UserProductMappingGrid Logger="_logger" <UserProductMappingGrid Logger="_logger"
ContextIds="ContextIds" ContextIds="ContextIds?.Cast<object>().ToArray()"
GetAllMessageTag="GetAllTag" GetAllMessageTag="GetAllTag"
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
PageSize="10" PageSize="10"
@ -28,7 +28,7 @@
ColumnResizeMode="GridColumnResizeMode.NextColumn" ColumnResizeMode="GridColumnResizeMode.NextColumn"
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"> DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
<Columns> <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="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="UserId" Caption="UserId" 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> </UserProductMappingGrid>
@code { @code {
[Parameter] public bool NewButtonVisible { get; set; } = true;
[Parameter] public IProductRelation ParentData { get; set; } = null!; [Parameter] public IProductRelation ParentData { get; set; } = null!;
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings; [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 LoggerClient Logger { get; set; }
[Parameter] public string GridName { get; set; } [Parameter] public string GridName { get; set; }
[Parameter] public Guid[]? ContextIds { get; set; } [Parameter] public object[]? ContextIds { get; set; }
private string? _filterText = null; private string? _filterText = null;

View File

@ -57,13 +57,13 @@ namespace TIAMWebApp.Server.Controllers
[HttpGet] [HttpGet]
[Route(APIUrls.GetAllLogItemsRouteName)] [Route(APIUrls.GetAllLogItemsRouteName)]
[SignalR(SignalRTags.GetAllLogItemsByFilterText)] [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; List<AcLogItem> logItemList;
if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(1000); if (criteriaOperatorText.IsNullOrWhiteSpace()) logItemList = await adminDal.GetLogItemsAsync(takeCount, fromDate, toDate);
else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText),1000); else logItemList = await adminDal.GetLogItemsByFilterAsync(CriteriaOperator.Parse(criteriaOperatorText), takeCount, fromDate, toDate);
var resultList = new List<LogItemViewerModel>(logItemList.Count); var resultList = new List<LogItemViewerModel>(logItemList.Count);
//logItemList[0].ToModelDto<LogItemViewerModel, AcLogItem>(); //logItemList[0].ToModelDto<LogItemViewerModel, AcLogItem>();

View File

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

View File

@ -162,7 +162,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
paramValues = new object[methodInfoModel.ParamInfos.Length]; paramValues = new object[methodInfoModel.ParamInfos.Length];
var firstParamType = methodInfoModel.ParamInfos[0].ParameterType; 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>>(); var msg = message!.MessagePackTo<SignalPostJsonDataMessage<IdMessage>>();

View File

@ -17,6 +17,6 @@ namespace TIAMWebApp.Shared.Application.Utility
{ {
[Serializable] [Serializable]
[DebuggerDisplay("Count = {Count}")] [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>; : AcSignalRDataSource<T>(signalRClient, signalRCrudTags, contextIds) where T : class, IId<Guid>;
} }