public CaProcessViewModel Execute(Command command) { CaProcessViewModel result = null; switch (command.Type) { case CommandType.Scrub: ExecuteCommand(command, XSPEditionURL.SCRUB); result = HandleEvent(command.CaId, XSPEditionURL.SCRUB); break; case CommandType.Notify: ExecuteCommand(command, XSPEditionURL.NOTIFICATIONS); result = HandleEvent(command.CaId, XSPEditionURL.NOTIFICATIONS); break; case CommandType.Respond: ExecuteCommand(command, XSPEditionURL.RESPONSES); result = HandleEvent(command.CaId, XSPEditionURL.RESPONSES); break; case CommandType.Instruct: ExecuteCommand(command, XSPEditionURL.INSTRUCTIONS); result = HandleEvent(command.CaId, XSPEditionURL.INSTRUCTIONS); break; case CommandType.Pay: ExecuteCommand(command, XSPEditionURL.PAYMENTS); result = HandleEvent(command.CaId, XSPEditionURL.PAYMENTS); break; } return(result); }
public void SendScrubbingInputData(ScrubCaCommand command) { PopulateFields(command.FieldsContent, command.Fields); foreach (var opt in command.Options) { PopulateFields(opt.FieldsContent, opt.Fields); foreach (var pyt in opt.Payouts) { PopulateFields(pyt.FieldsContent, pyt.Fields); } } CaProcessViewModel viewModel = _apiService.Execute(command); IHubContext notifHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); if (viewModel != null) { notifHub.Clients.All.updateProcess(viewModel); } SummaryModel summaryModel = GetSummaryModel(); if (summaryModel != null) { notifHub.Clients.All.updateSummaryModel(summaryModel); } }
public IHttpActionResult GetPayments(int caId) { List <PaymentInfo> payments = _context.PaymentsInfo.Where(view => view.CaId == caId).ToList(); List <string> targetDateItems = payments.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); List <string> criticalDateItems = payments.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); List <string> lateDateItems = payments.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); List <string> missingItems = payments.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); int processedItemCount = payments.Count(view => view.IsSettled && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); int totalItemCount = payments.Count; CaProcessViewModel paymentProcess = new CaProcessViewModel(ProcessType.Payment, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendPaymentFields(caId, paymentProcess.TimelineItems); return(Ok(paymentProcess)); }
public IHttpActionResult GetInstructions(int caId) { List <InstructionInfo> instructions = _context.InstructionsInfo.Where(view => view.CaId == caId).ToList(); List <string> targetDateItems = instructions.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); List <string> criticalDateItems = instructions.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); List <string> lateDateItems = instructions.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); List <string> missingItems = instructions.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); int processedItemCount = instructions.Count(view => view.IsInstructed && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); int totalItemCount = instructions.Count; CaProcessViewModel intstructionProcess = new CaProcessViewModel(ProcessType.Instruction, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendInstructionFields(caId, intstructionProcess.TimelineItems); return(Ok(intstructionProcess)); }
public IHttpActionResult GetResponses(int caId) { List <ResponseInfo> responses = _context.ResponsesInfo.Where(view => view.CaId == caId).ToList(); List <string> targetDateItems = responses.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); List <string> criticalDateItems = responses.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); List <string> lateDateItems = responses.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); List <string> missingItems = responses.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); int processedItemCount = responses.Count(view => view.IsSubmitted && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); int totalItemCount = responses.Count; CaProcessViewModel responseProcess = new CaProcessViewModel(ProcessType.Response, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendResponseFields(caId, responseProcess.TimelineItems); return(Ok(responseProcess)); }
public IHttpActionResult GetScrubbing(int caId) { List <ScrubbingInfo> scrubbingInfo = _context.ScrubbingInfo.Where(view => view.CaId == caId).ToList(); List <string> targetDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); List <string> criticalDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); List <string> lateDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); List <string> missingItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); int processedItemCount = scrubbingInfo.Count(view => view.IsSrubbed && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); int totalItemCount = scrubbingInfo.Count; CaProcessViewModel scrubbingProcess = new CaProcessViewModel(ProcessType.Scrubbing, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendCaScrubbedFields(caId, scrubbingProcess.TimelineItems); return(Ok(scrubbingProcess)); }
public void SendNotificationInputData(NotifyCommand command) { CaProcessViewModel viewModel = _apiService.Execute(command); IHubContext notifHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); if (viewModel != null) { notifHub.Clients.All.updateProcess(viewModel); } SummaryModel summaryModel = GetSummaryModel(); if (summaryModel != null) { notifHub.Clients.All.updateSummaryModel(summaryModel); } }
private void AppendCaProcessViewModels(int caId, List <CaProcessViewModel> CaProcessList) { //SCRUBBING List <ScrubbingInfo> scrubbingInfo = _context.ScrubbingInfo.Where(view => view.CaId == caId).ToList(); List <string> targetDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); List <string> criticalDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); List <string> lateDateItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); List <string> missingItems = scrubbingInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); int processedItemCount = scrubbingInfo.Count(view => view.IsSrubbed && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); int totalItemCount = scrubbingInfo.Count; CaProcessViewModel scrubbingProcess = new CaProcessViewModel(ProcessType.Scrubbing, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendCaScrubbedFields(caId, scrubbingProcess.TimelineItems); CaProcessList.Add(scrubbingProcess); //NOTIFICATION List <NotificationInfo> notifInfo = _context.NotificationsInfo.Where(view => view.CaId == caId).ToList(); targetDateItems = notifInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); criticalDateItems = notifInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); lateDateItems = notifInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); missingItems = notifInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); processedItemCount = notifInfo.Count(view => view.IsSent && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); totalItemCount = notifInfo.Count; CaProcessViewModel notifProcess = new CaProcessViewModel(ProcessType.Notification, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendNotificationFields(caId, notifProcess.TimelineItems); CaProcessList.Add(notifProcess); //RESPONSE List <ResponseInfo> responseInfo = _context.ResponsesInfo.Where(view => view.CaId == caId).ToList(); targetDateItems = responseInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); criticalDateItems = responseInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); lateDateItems = responseInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); missingItems = responseInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); processedItemCount = responseInfo.Count(view => view.IsSubmitted && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); totalItemCount = responseInfo.Count; CaProcessViewModel responseProcess = new CaProcessViewModel(ProcessType.Response, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendResponseFields(caId, responseProcess.TimelineItems); CaProcessList.Add(responseProcess); //INSTRUCTION List <InstructionInfo> instructionInfo = _context.InstructionsInfo.Where(view => view.CaId == caId).ToList(); targetDateItems = instructionInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); criticalDateItems = instructionInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); lateDateItems = instructionInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); missingItems = instructionInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); processedItemCount = instructionInfo.Count(view => view.IsInstructed && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); totalItemCount = instructionInfo.Count; CaProcessViewModel intstructionProcess = new CaProcessViewModel(ProcessType.Instruction, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendInstructionFields(caId, intstructionProcess.TimelineItems); CaProcessList.Add(intstructionProcess); //PAYMENT List <PaymentInfo> paymentInfo = _context.PaymentsInfo.Where(view => view.CaId == caId).ToList(); targetDateItems = paymentInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.TargetDate).Select(spv => spv.FieldDisplay).ToList(); criticalDateItems = paymentInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate).Select(spv => spv.FieldDisplay).ToList(); lateDateItems = paymentInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.LateDate).Select(spv => spv.FieldDisplay).ToList(); missingItems = paymentInfo.Where(view => view.ProcessedDateCategory == ProcessedDateCategory.Missing).Select(spv => spv.FieldDisplay).ToList(); processedItemCount = paymentInfo.Count(view => view.IsSettled && (view.ProcessedDateCategory == ProcessedDateCategory.TargetDate || view.ProcessedDateCategory == ProcessedDateCategory.CriticalDate)); totalItemCount = paymentInfo.Count; CaProcessViewModel paymentProcess = new CaProcessViewModel(ProcessType.Payment, targetDateItems, criticalDateItems, lateDateItems, missingItems, processedItemCount, totalItemCount, caId); AppendPaymentFields(caId, paymentProcess.TimelineItems); CaProcessList.Add(paymentProcess); }
public void StartSimulation() { const int sleepTime = 2000; Command command = CreateFirstCAScrubbingEvent(); CaProcessViewModel viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateFirstNotifyEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateSecondNotifyEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } // InstructCommand command = CreateFirstInstructionEvent(); command = CreateFirstResponseEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateSecondResponseEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateThridResponseEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateFirstInstructionEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateSecondInstructionEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateFirstPayEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } command = CreateSecondPayEvent(); viewModel = _apiService.Execute(command); if (viewModel != null) { Clients.All.updateProcess(viewModel); Thread.Sleep(sleepTime); } }