private void UpdateInstructionInfo(InstructCommand command) { foreach (InstructionDto instructionDto in command.Instructions) { InstructionInfo instruction = _context.InstructionsInfo.FirstOrDefault(ins => ins.CaId == command.CaId && ins.AccountNumber == instructionDto.AccountNumber); if (instruction == null) { continue; } if (instructionDto.IsInstructed) { instruction.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Instruction, command.CaId, command.EventDate); instruction.IsInstructed = true; instruction.ProcessedDate = command.EventDate; } else { instruction.ProcessedDateCategory = ProcessedDateCategory.Missing; instruction.IsInstructed = false; instruction.ProcessedDate = null; } } _context.SaveChanges(); }
private void CreateInstructionsInfo(InstructCommand command) { foreach (InstructionDto instructionDto in command.Instructions) { InstructionInfo instruction = new InstructionInfo(); instruction.CaId = command.CaId; instruction.CaTypeId = command.CaTypeId; instruction.VolManCho = command.VolManCho; instruction.AccountNumber = instructionDto.AccountNumber; instruction.FieldDisplay = instructionDto.AccountNumber; if (instructionDto.IsInstructed) { instruction.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Instruction, command.CaId, command.EventDate); instruction.IsInstructed = true; instruction.ProcessedDate = command.EventDate; } else { instruction.ProcessedDateCategory = ProcessedDateCategory.Missing; instruction.IsInstructed = false; instruction.ProcessedDate = null; } _context.InstructionsInfo.Add(instruction); } _context.SaveChanges(); }
private void UpdateInstructionInfo(InstructCommand command) { if (command.VolManCho != null && command.VolManCho.Equals("M", StringComparison.CurrentCultureIgnoreCase)) { return; } foreach (InstructionDto instructionDto in command.Instructions) { InstructionInfo instruction = _context.InstructionsInfo.FirstOrDefault(ins => ins.CaId == command.CaId && ins.AccountNumber == instructionDto.AccountNumber); if (instruction == null) { continue; } if (instructionDto.IsInstructed) { instruction.ProcessedDateCategory = CalculateProcessedDateCategory(ProcessType.Instruction, command.CaId, command.EventDate); instruction.IsInstructed = true; instruction.ProcessedDate = command.EventDate; } else { instruction.ProcessedDateCategory = ProcessedDateCategory.Missing; instruction.IsInstructed = false; instruction.ProcessedDate = null; } } _context.SaveChanges(); }
public IHttpActionResult PostInstructions([FromBody] InstructCommand command) { List <InstructionInfo> instructions = _context.InstructionsInfo.Where(view => view.CaId == command.CaId).ToList(); if (instructions.Count == 0) { CreateInstructionsInfo(command); } else { UpdateInstructionInfo(command); } return(Ok()); }
public void SendInstructionInputData(InstructCommand 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); } }
public static void SendInstructCommand(Command command) { InstructCommand instructCommand = (InstructCommand)command; POST(JsonConvert.SerializeObject(instructCommand), "SendInstructionInputData"); }