public override void Send() { var dicCaseList = new Dictionary <string, List <ActionCase> >(); foreach (var stepAndCase in NiAcnTdoList) { var callTodoList = new ActionCase { Step = stepAndCase.Step, Cases = stepAndCase.Cases.Where(x => x.HasTlf && x.DebtorNo != null).Select(x => x).ToList() }; if (!dicCaseList.ContainsKey(stepAndCase.Step.TemplateId)) { dicCaseList.Add(stepAndCase.Step.TemplateId, new List <ActionCase>()); } dicCaseList[stepAndCase.Step.TemplateId].Add(callTodoList); } var TempalteIDThisTime = dicCaseList.Keys.FirstOrDefault(); if (!string.IsNullOrEmpty(TempalteIDThisTime)) { ActionOperator.ActionOperation(dicCaseList[TempalteIDThisTime]); } }
public static List <niAcnTdo> ToNiAcnTdo(this ActionCase stepCase, AcnTodoType type, int actionStatus) { return(stepCase.Cases.Select(x => new niAcnTdo { BookedBy = Const.Const.By, BookedFor = Const.Const.AcnTdoBookedFor, BookedDate = DateTime.Now, Date = DateTime.Now.Date, Priority = 1, TodoType = (byte)type, ObjectType = 1, ObjectNo = x.CaseNo, Action = stepCase.Step.TemplateId, SubNo = x.DebtorNo, CreditorNo = x.ClientNo * Const.Const.DatabaseConstInt, Status = actionStatus, Flags = 0, AutoCode = string.Empty, NextCode = string.Empty, Executed = 0, ResponseTime = string.Empty, DateAdjusted = string.Empty, Stack = string.Empty, ExtData = Encoding.GetEncoding(1252).GetBytes(string.Empty) }).ToList()); }