public void SendDataToIso <T>(T data, string tenantId, IsoOperationEnum operation, long entityId) where T : class //, Iso.IMessage { if (typeof(T) != GetTypeFromOperation(operation)) { throw new ArgumentException($"Pre operaciu '{operation}' sa posiela nespravny typ ! '{typeof(T).Name}'"); } var listId = GetQueueId(tenantId); var hashId = GetHashId(tenantId); var msg = new IsoOperationMessage { Operation = operation, //Data = data }; //msg.Data.MessageId = Guid.NewGuid().ToString(); msg.Created = DateTime.Now; msg.EsamId = entityId; using (var redisClient = redisManager.GetClient()) { //redisClient.PushItemToList(listId, msg.Data.MessageId); //redisClient.SetEntryInHash(hashId, msg.Data.MessageId, msg.ToJson()); } ProcessQueue(tenantId); }
private Type GetTypeFromOperation(IsoOperationEnum operation) { switch (operation) { //case IsoOperationEnum.Pla_SetCashBook: // return typeof(CashBookRecord); //case IsoOperationEnum.Pla_SetBankAccount: // return typeof(BankAccountRecord); //case IsoOperationEnum.Pla_SetBookOfInternalAccountingDocument: // return typeof(BookOfInternalAccountingDocument); default: throw new NotImplementedException($"Operation '{operation}' is not implemented!"); } }
public string GetModule(IsoOperationEnum operation) { var op = operation.ToString(); return(op.Substring(0, 3)); }