private MSD1 mapMSD1DataToMSD1(string Id) { Msd1Data msd1Data = _context.Msd1Data.First(x => x.Msd1Id == Id) ?? new Msd1Data(); MSD1 msd1 = new MSD1() { Imo = msd1Data.Imo, ShipName = msd1Data.ShipName ?? _helperService.GetShipNameByIMO(msd1Data.Imo), Deadweight = _helperService.GetDeadweightByIMO(msd1Data.Imo), Year = msd1Data.Year, Quarter = msd1Data.Quarter, AssociatedPort = _helperService.GetPortNameByCode(msd1Data.AssociatedPort) ?? msd1Data.AssociatedPort, ReportingPort = _helperService.GetPortNameByCode(msd1Data.ReportingPort) ?? msd1Data.ReportingPort, NumVoyages = msd1Data.NumVoyages, IsInbound = msd1Data.IsInbound, Msd1Id = msd1Data.Msd1Id, AgentSenderID = msd1Data.AgentSenderId, AgentCompanyName = _helperService.GetCompanyNameBySenderID(msd1Data.AgentSenderId) ?? string.Empty, LineSenderID = msd1Data.LineSenderId, LineCompanyName = _helperService.GetCompanyNameBySenderID(msd1Data.LineSenderId) ?? string.Empty, FlagCode = _helperService.GetFlagCodeFromIMO(msd1Data.Imo) ?? string.Empty, RecordRef = msd1Data.RecordRef, CargoSummary = MapMsd1CargoSummaryToCargoItem(msd1Data.Msd1Id) }; return(msd1); }
private void AssignMSD2ToInput(Msd2 msd2) { MSD23 = new MSD23(TempData.GetKeep <MSD23>(MSD23Key)); MSD23.Year = msd2.Year; MSD23.Quarter = msd2.Quarter; MSD23.Port = msd2.ReportingPort; MSD23.PortName = _helperService.GetPortNameByCode(msd2.ReportingPort); Input.GrossWeightInwards = (double)msd2.GrossWeightInward; Input.UnitsInwards = msd2.TotalUnitsInward; Input.InwardsUnitDescription = msd2.InwardUnitDescription; Input.PassengerVehiclesInwards = msd2.PassengerVehiclesInward; Input.GrossWeightOutwards = (double)msd2.GrossWeightOutward; Input.UnitsOutwards = msd2.TotalUnitsOutward; Input.OutwardsUnitDescription = msd2.OutwardUnitDescription; Input.PassengerVehiclesOutwards = msd2.PassengerVehiclesOutward; Input.GrossWeightInwardsDescription = msd2.InwardGrossWeightDescription; Input.GrossWeightOutwardsDescription = msd2.OutwardGrossWeightDescription; IsInwardBoxVisible = msd2.InwardGrossWeightDescription == null ? false : true; IsInwardUnitBoxVisible = msd2.InwardUnitDescription == null ? false : true; IsOutwardBoxVisible = msd2.OutwardGrossWeightDescription == null ? false : true; IsOutwardUnitBoxVisible = msd2.OutwardUnitDescription == null ? false : true; }
private void AssignMSD3ToInput(Msd3 msd3) { var localMSD3 = CustomExtensions.NotNullOrEmpty(TempData) && TempData[MSD3Key] != null ? new MSD3ViewModel(TempData.GetKeep <MSD3ViewModel>(MSD3Key)) : new MSD3ViewModel();; MSD3VM.AgentSummary.Clear(); MSD23 = new MSD23(TempData.GetKeep <MSD23>(MSD23Key)); MSD23.Year = msd3.Year; MSD23.Quarter = msd3.Quarter; MSD23.Port = msd3.ReportingPort; MSD23.PortName = _helperService.GetPortNameByCode(msd3.ReportingPort); foreach (Msd3agents msd3Agent in msd3.Msd3agents) { Agent agent = new Agent { Id = Guid.NewGuid(), ShippingAgent = _context.OrgList.Where(s => s.OrgId == msd3Agent.SenderId) .Select(s => s.OrgId.ToString() + " - " + s.OrgName.ToString()).FirstOrDefault() }; MSD3VM.AgentSummary.Add(agent); localMSD3.AgentSummary.Add(agent); } ; TempData.Put(MSD3Key, localMSD3); }