improvements, fixes, etc...

This commit is contained in:
Loretta 2024-07-01 18:16:44 +02:00
parent ef016d24ac
commit 08b373f0c7
4 changed files with 28 additions and 16 deletions

View File

@ -31,6 +31,7 @@ public class Transfer: IEntityGuid, IAcFullName, ITimeStampInfo, IProductForeign
public string? PaymentId { get; set; }
//public virtual UserProductMapping? UserProductMapping { get; set; }
[JsonIgnore]
[Newtonsoft.Json.JsonIgnore]
public virtual List<TransferToDriver> TransferToDrivers { get; set; } = [];

View File

@ -1,4 +1,5 @@
using AyCode.Services.SignalRs;
using System.Reflection;
namespace TIAM.Services;
@ -10,9 +11,9 @@ public class SignalRTags : AcSignalRTags
public const int GetTransfersByDriverId = 4;
public const int GetTransfersByProductId = 5;
public const int GetTransfersByCompanyId = 6;
public const int GetTransfersByFilterText = 301;
public const int UpdateTransfer = 7;
public const int AddTransfer = 8;
public const int RemoveTransfer = 9;
@ -36,13 +37,16 @@ public class SignalRTags : AcSignalRTags
public const int RemoveTransferToDriver = 28;
public const int GetAddress = 29;
//public const int GetAddresses = 30;
public const int GetAddressesByContextId = 31;
public const int UpdateAddress = 32;
//public const int AddAddress = 33;
//public const int RemoveAddress = 34;
public const int GetProfileById = 35;
//public const int GetProfiles = 36;
//public const int GetProfileByContextId = 37;
public const int UpdateProfile = 38;
@ -53,11 +57,11 @@ public class SignalRTags : AcSignalRTags
public const int CreateUserProductMapping = 40;
public const int UpdateUserProductMapping = 41;
public const int DeleteUserProductMapping = 42; //set permissions to 0
public const int GetAllUserProductMappings = 43;
public const int GetUserProductMappingsByProductId = 44;
public const int GetUserProductMappingsByUserId = 45;
public const int GetUserProductMappingById = 46;
public const int GetUserProductMappingsById = 47;
public const int GetAllUserProductMappings = 43;
public const int GetUserProductMappingsByProductId = 44;
public const int GetUserProductMappingsByUserId = 45;
public const int GetUserProductMappingById = 46;
public const int GetUserProductMappingsById = 47;
public const int GetCarsForUserProductMapping = 50;
public const int CreateCar = 51;
@ -86,7 +90,7 @@ public class SignalRTags : AcSignalRTags
public const int CreateTransferDestination = 82;
public const int UpdateTransferDestination = 83;
public const int RemoveTransferDestination = 84; //set permissions to 0
public const int CreateTransferDestinationToProduct = 90;
public const int UpdateTransferDestinationToProduct = 91;
public const int RemoveTransferDestinationToProduct = 92; //set permissions to 0
@ -96,5 +100,4 @@ public class SignalRTags : AcSignalRTags
public const int GetTransferDestinationToProductsByTransferDestinationId = 96;
public const int GetAllLogItemsByFilterText = 100;
}

View File

@ -18,6 +18,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using AutoMapper;
using AyCode.Core.Helpers;
using DevExpress.Pdf.Native.BouncyCastle.Security;
using TIAM.Entities.Emails;
using TIAM.Services.Server;
@ -138,7 +139,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
public async Task OnReceiveMessage(int messageTag, byte[]? message, int? requestId)
{
var logText = $"Server OnReceiveMessage; {nameof(messageTag)}: {messageTag}; {nameof(requestId)}: {requestId}; ConnectionId: {Context.ConnectionId}; UserIdentifier: {Context.UserIdentifier}";
var logText = $"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Server OnReceiveMessage; {nameof(requestId)}: {requestId}; ConnectionId: {Context.ConnectionId}; UserIdentifier: {Context.UserIdentifier}";
if (message is { Length: 0 }) _logger.Warning($"message.Length == 0! {logText}");
else _logger.Info(logText);
@ -151,7 +152,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
object[]? paramValues = null;
logText = $"Found dynamic method for the tag! tag: {messageTag}; method: {methodsByDeclaringObject.InstanceObject.GetType().Name}.{methodInfoModel.MethodInfo.Name}";
logText = $"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Found dynamic method for the tag! method: {methodsByDeclaringObject.InstanceObject.GetType().Name}.{methodInfoModel.MethodInfo.Name}";
if (methodInfoModel.ParamInfos is { Length: > 0 })
{
@ -214,7 +215,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
return;
}
_logger.Debug($"Not found dynamic method for the tag! tag: {messageTag};");
_logger.Debug($"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Not found dynamic method for the tag! tag: {messageTag};");
switch (messageTag)
{
@ -286,13 +287,13 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
// return;
default:
_logger.Error($"Server OnReceiveMessage; messageTag not found! messageTag: {messageTag}");
_logger.Error($"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Server OnReceiveMessage; messageTag not found!");
break;
}
}
catch (Exception ex)
{
_logger.Error($"Server OnReceiveMessage; {ex.Message}", ex);
_logger.Error($"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Server OnReceiveMessage; {ex.Message}", ex);
}
await ResponseToCaller(messageTag, new SignalResponseJsonMessage(SignalResponseStatus.Error), requestId);
@ -303,7 +304,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
protected async Task SendMessageToClient(ISignalRHubItemServer sendTo, int messageTag, ISignalRMessage message, int? requestId = null)
{
_logger.Info($"Server SendMessageToClient; {nameof(messageTag)}: {messageTag}; {nameof(requestId)}: {requestId}; ConnectionId: {Context.ConnectionId}; UserIdentifier: {Context.UserIdentifier}");
_logger.Info($"{ConstHelper.NameByValue<SignalRTags>(messageTag)} Server SendMessageToClient; {nameof(requestId)}: {requestId}; ConnectionId: {Context.ConnectionId}; UserIdentifier: {Context.UserIdentifier}");
await sendTo.OnReceiveMessage(messageTag, message.ToMessagePack(ContractlessStandardResolver.Options), requestId);
}

View File

@ -8,10 +8,17 @@ using AyCode.Services.Loggers;
using AyCode.Services.SignalRs;
using MessagePack.Resolvers;
using Microsoft.AspNetCore.SignalR.Client;
using TIAM.Services;
using TIAMWebApp.Shared.Application.Models.ClientSide;
using TIAMWebApp.Shared.Application.Utility;
namespace TIAMWebApp.Shared.Application.Services
{
public class AdminSignalRClient(IEnumerable<IAcLogWriterClientBase> logWriters) : AcSignalRClientBase($"{Setting.BaseUrl}/DevAdminHub", new LoggerClient(nameof(AdminSignalRClient), logWriters.ToArray()));
public class AdminSignalRClient : AcSignalRClientBase
{
public AdminSignalRClient(IEnumerable<IAcLogWriterClientBase> logWriters) : base($"{Setting.BaseUrl}/DevAdminHub", new LoggerClient(nameof(AdminSignalRClient), logWriters.ToArray()))
{
ConstHelper.NameByValue<SignalRTags>(0);
}
}
}