public FrayteResult SaveTradelaneTracking(TradelaneUpdateTrackingModel TM) { var Shipment = dbContext.TradelaneShipments.Where(a => a.TradelaneShipmentId == TM.TradelaneShipmentId).FirstOrDefault(); var user = dbContext.Users.Where(a => a.UserId == Shipment.CustomerId).FirstOrDefault(); FrayteResult FR = new FrayteResult(); FR.Status = false; var Result = dbContext.TradelaneFlightDetails.Where(a => a.TradelaneFlightDetailId == TM.TradelaneFlightId).FirstOrDefault(); if (Result != null) { Result.TradelaneShipmentId = TM.TradelaneShipmentId; Result.FlightNumber = TM.FlightNo; Result.ArrivalAirportCode = TM.DestinationAirportCode; Result.DepartureAirportCode = TM.DepartureAirportCode; var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == user.TimezoneId).FirstOrDefault(); TimeZoneModal TZM = new TimeZoneModal(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } Result.ArrivalDate = UtilityRepository.ConvertToUniversalTimeWitDate(TM.ArrivalTime, TM.ArrivalDate.Value, TZM); Result.DepartureDate = UtilityRepository.ConvertToUniversalTimeWitDate(TM.DepartureTime, TM.DepartureDate.Value, TZM); Result.BookingStatus = TM.BookingStatus; Result.Pieces = TM.TotalPeices; Result.TotalVolume = TM.Volume; Result.TotalWeight = TM.TotalWeight; dbContext.Entry(Result).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); FR.Status = true; } else { TradelaneFlightDetail TlST = new TradelaneFlightDetail(); TlST.TradelaneShipmentId = TM.TradelaneShipmentId; TlST.FlightNumber = TM.FlightNo; TlST.ArrivalAirportCode = TM.DestinationAirportCode; TlST.DepartureAirportCode = TM.DepartureAirportCode; var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == user.TimezoneId).FirstOrDefault(); TimeZoneModal TZM = new TimeZoneModal(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } TlST.ArrivalDate = UtilityRepository.ConvertToUniversalTimeWitDate(TM.ArrivalTime, TM.ArrivalDate.Value, TZM); TlST.DepartureDate = UtilityRepository.ConvertToUniversalTimeWitDate(TM.DepartureTime, TM.DepartureDate.Value, TZM); TlST.BookingStatus = TM.BookingStatus; TlST.Pieces = TM.TotalPeices; TlST.TotalVolume = TM.Volume; TlST.TotalWeight = TM.TotalWeight; dbContext.TradelaneFlightDetails.Add(TlST); dbContext.SaveChanges(); FR.Status = true; } return(FR); }
public static TimeZoneModal ChangeTimeZone(this TimeZoneModal modal, int utcHour) { modal.TimeZoneLoader.WaitAbsence(); modal.TimeZoneSelect.WaitPresence(); modal.TimeZoneSelect.Click(); modal.TimeZoneSelect.GetMenuItemList <Label>().Count.Wait().EqualTo(11); modal.TimeZoneSelect.GetMenuItemList <Label>().Single(x => x.Text.Get().StartsWith($"UTC+{utcHour}")).Container.Click(); return(modal); }
public FrayteResult SaveMawbDetail(TradelaneMAWBDetail mawbDetail) { FrayteResult result = new FrayteResult(); try { if (mawbDetail.List.Count > 0) { var Allocation = dbContext.TradelaneShipmentAllocations.Find(mawbDetail.List[0].MawbAllocationId); if (Allocation != null && (string.IsNullOrEmpty(Allocation.LegNum) || Allocation.LegNum == "Leg1")) { var shipment = dbContext.TradelaneShipments.Find(mawbDetail.TradelaneShipmentId); shipment.MAWB = mawbDetail.MAWB; dbContext.SaveChanges(); if (!string.IsNullOrEmpty(shipment.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(shipment.MAWB, shipment.TradelaneShipmentId); } } } foreach (var item in mawbDetail.List) { var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == item.TimezoneId).FirstOrDefault(); TimeZoneModal TZM = new TimeZoneModal(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } var Allocation = dbContext.TradelaneShipmentAllocations.Where(a => a.TradelaneShipmentAllocationId == item.MawbAllocationId).FirstOrDefault(); if (Allocation != null) { Allocation.AirlineId = item.AirlineId; Allocation.TimezoneId = item.TimezoneId; Allocation.EstimatedDateofArrival = item.ETA != null && item.ETA.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(item.ETATime, item.ETA.Value, TZM) : (DateTime?)null; Allocation.EstimatedDateofDelivery = item.ETD != null && item.ETD.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(item.ETDTime, item.ETD.Value, TZM) : (DateTime?)null; Allocation.FlightNumber = item.FlightNumber; Allocation.MAWB = mawbDetail.MAWB; Allocation.CreatedBy = mawbDetail.AgentId; dbContext.Entry(Allocation).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); if (!string.IsNullOrEmpty(Allocation.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(Allocation.MAWB, (int)Allocation.TradelaneShipmentId); } } } result.Status = true; } catch (Exception ex) { result.Status = false; } return(result); }
public List <MawbAllocationModel> GetMawbAllocation(int TradelaneShipmentId, string Leg) { List <MawbAllocationModel> MAMList = new List <MawbAllocationModel>(); var userid = dbContext.TradelaneShipments.Where(a => a.TradelaneShipmentId == TradelaneShipmentId).FirstOrDefault().CustomerId; var CustomerDetail = new CustomerRepository().GetCustomerDetail(userid); List <TradelaneShipmentAllocation> Result = new List <TradelaneShipmentAllocation>(); if (!string.IsNullOrEmpty(Leg)) { Result = dbContext.TradelaneShipmentAllocations.Where(a => a.TradelaneShipmentId == TradelaneShipmentId && a.LegNum == Leg).ToList(); } else { Result = dbContext.TradelaneShipmentAllocations.Where(a => a.TradelaneShipmentId == TradelaneShipmentId).ToList(); } if (Result != null && Result.Count > 0) { foreach (var res in Result) { TimeZoneModal TZM = new TimeZoneModal(); var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == res.TimezoneId).FirstOrDefault(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } MawbAllocationModel MAM = new MawbAllocationModel(); MAM.AgentId = res.AgentId.Value; MAM.AirlineId = res.AirlineId.Value; MAM.CreatedBy = res.CreatedBy.Value; MAM.CreatedOnUTC = res.CreatedOnUTC.Value; MAM.ETA = res.EstimatedDateofArrival != null?UtilityRepository.ConvertDatetoSpecifiedTimeZoneTime(res.EstimatedDateofArrival.Value, TZM) : (DateTime?)null; MAM.ETD = res.EstimatedDateofDelivery != null?UtilityRepository.ConvertDatetoSpecifiedTimeZoneTime(res.EstimatedDateofDelivery.Value, TZM) : (DateTime?)null; MAM.ETATime = res.EstimatedDateofArrival != null?UtilityRepository.ConvertToCustomerTimeZone(res.EstimatedDateofArrival.Value.TimeOfDay, TZM) : ""; MAM.ETDTime = res.EstimatedDateofDelivery != null?UtilityRepository.ConvertToCustomerTimeZone(res.EstimatedDateofDelivery.Value.TimeOfDay, TZM) : ""; MAM.TimezoneId = res.TimezoneId.Value; MAM.FlightNumber = res.FlightNumber; MAM.LegNum = res.LegNum; MAM.MAWB = res.MAWB; MAM.MawbAllocationId = res.TradelaneShipmentAllocationId; MAM.TradelaneId = res.TradelaneShipmentId.Value; MAMList.Add(MAM); } return(MAMList); } else { return(MAMList); } }
private Tuple <string, string> GetDateTimeZone(int?UserId, DateTime?CreatedOn) { var customerDetail = dbContext.Users.Where(a => a.UserId == UserId).FirstOrDefault(); var timeZone = dbContext.Timezones.Where(p => p.TimezoneId == customerDetail.TimezoneId).FirstOrDefault(); var Timezone = new TimeZoneModal(); if (timeZone != null) { Timezone.TimezoneId = timeZone.TimezoneId; Timezone.Name = timeZone.Name; Timezone.Offset = timeZone.Offset; Timezone.OffsetShort = timeZone.OffsetShort; } var TimeZoneDetail = TimeZoneInfo.FindSystemTimeZoneById(timeZone.Name); var CreatedOn1 = UtilityRepository.UtcDateToOtherTimezone(CreatedOn.Value, CreatedOn.Value.TimeOfDay, TimeZoneDetail).Item1; return(Tuple.Create(CreatedOn1.ToString("dd-MMM-yyyy hh:mm"), "(" + Timezone.OffsetShort + ")")); }
public static void Close(this TimeZoneModal modal) { modal.Cancel.Click(); modal.WaitAbsence(); }
public static void SaveAndClose(this TimeZoneModal modal) { modal.Accept.Click(); modal.WaitAbsence(); }
public FratyteError SaveMawbAllocation(List <MawbAllocationModel> MAList, string FilePath, string ShipmentType) { FratyteError MAM = new FratyteError(); var TradelaneId = MAList.FirstOrDefault().TradelaneId; if (MAList.Count > 0) { var Result = dbContext.TradelaneShipments.Where(a => a.TradelaneShipmentId == TradelaneId).FirstOrDefault(); if (Result != null) { Result.MAWBAgentId = MAList.FirstOrDefault().AgentId; Result.MAWB = MAList.FirstOrDefault().MAWB; dbContext.Entry(Result).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); if (!string.IsNullOrEmpty(Result.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(Result.MAWB, Result.TradelaneShipmentId); } foreach (var MAAllocation in MAList) { var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == MAAllocation.TimezoneId).FirstOrDefault(); TimeZoneModal TZM = new TimeZoneModal(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } var Res = dbContext.TradelaneShipmentAllocations.Where(a => a.TradelaneShipmentAllocationId == MAAllocation.MawbAllocationId).FirstOrDefault(); if (Res != null) { Res.TradelaneShipmentId = MAAllocation.TradelaneId; Res.AgentId = MAAllocation.AgentId; Res.AirlineId = MAAllocation.AirlineId; Res.TimezoneId = MAAllocation.TimezoneId; Res.CreatedBy = MAAllocation.CreatedBy; Res.EstimatedDateofArrival = MAAllocation.ETA != null && MAAllocation.ETA.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETATime, MAAllocation.ETA.Value, TZM) : (DateTime?)null; Res.EstimatedDateofDelivery = MAAllocation.ETD != null && MAAllocation.ETD.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETDTime, MAAllocation.ETD.Value, TZM) : (DateTime?)null; Res.FlightNumber = MAAllocation.FlightNumber; Res.LegNum = MAAllocation.LegNum; Res.MAWB = MAAllocation.MAWB; dbContext.Entry(Res).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); if (Res.TradelaneShipmentId > 0 && !string.IsNullOrEmpty(Res.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(Res.MAWB, (int)Res.TradelaneShipmentId); } } else { TradelaneShipmentAllocation TSA = new TradelaneShipmentAllocation(); TSA.TradelaneShipmentId = MAAllocation.TradelaneId; TSA.AgentId = MAAllocation.AgentId; TSA.AirlineId = MAAllocation.AirlineId; TSA.TimezoneId = MAAllocation.TimezoneId; TSA.CreatedBy = MAAllocation.CreatedBy; TSA.CreatedOnUTC = DateTime.UtcNow; TSA.EstimatedDateofArrival = MAAllocation.ETA != null && MAAllocation.ETA.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETATime, MAAllocation.ETA.Value, TZM) : (DateTime?)null; TSA.EstimatedDateofDelivery = MAAllocation.ETD != null && MAAllocation.ETD.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETDTime, MAAllocation.ETD.Value, TZM) : (DateTime?)null; TSA.FlightNumber = MAAllocation.FlightNumber; TSA.LegNum = MAAllocation.LegNum; TSA.MAWB = MAAllocation.MAWB; dbContext.TradelaneShipmentAllocations.Add(TSA); dbContext.SaveChanges(); if (TSA.TradelaneShipmentId > 0 && !string.IsNullOrEmpty(TSA.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(TSA.MAWB, (int)TSA.TradelaneShipmentId); } } } MAM.Status = true; } else { TradelaneShipment result = new TradelaneShipment(); result.MAWBAgentId = MAList.FirstOrDefault().AgentId; result.MAWB = MAList.FirstOrDefault().MAWB; dbContext.TradelaneShipments.Add(result); dbContext.SaveChanges(); foreach (var MAAllocation in MAList) { TimeZoneModal TZM = new TimeZoneModal(); var Timezone = dbContext.Timezones.Where(a => a.TimezoneId == MAAllocation.TimezoneId).FirstOrDefault(); if (Timezone != null) { TZM.TimezoneId = Timezone.TimezoneId; TZM.Name = Timezone.Name; } var Res = dbContext.TradelaneShipmentAllocations.Where(a => a.TradelaneShipmentAllocationId == MAAllocation.MawbAllocationId).FirstOrDefault(); if (Res != null) { Res.TradelaneShipmentId = MAAllocation.TradelaneId; Res.AgentId = MAAllocation.AgentId; Res.AirlineId = MAAllocation.AirlineId; Res.CreatedBy = MAAllocation.CreatedBy; Res.TimezoneId = MAAllocation.TimezoneId; Res.EstimatedDateofArrival = MAAllocation.ETA != null && MAAllocation.ETA.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETATime, MAAllocation.ETA.Value, TZM) : (DateTime?)null; Res.EstimatedDateofDelivery = MAAllocation.ETD != null && MAAllocation.ETD.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETDTime, MAAllocation.ETD.Value, TZM) : (DateTime?)null; Res.FlightNumber = MAAllocation.FlightNumber; Res.LegNum = MAAllocation.LegNum; Res.MAWB = MAAllocation.MAWB; dbContext.Entry(Res).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); if (Res.TradelaneShipmentId > 0 && !string.IsNullOrEmpty(Res.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(Res.MAWB, (int)Res.TradelaneShipmentId); } } else { TradelaneShipmentAllocation TSA = new TradelaneShipmentAllocation(); TSA.TradelaneShipmentId = MAAllocation.TradelaneId; TSA.AgentId = MAAllocation.AgentId; TSA.AirlineId = MAAllocation.AirlineId; TSA.CreatedBy = MAAllocation.CreatedBy; TSA.TimezoneId = MAAllocation.TimezoneId; TSA.CreatedOnUTC = DateTime.UtcNow; TSA.EstimatedDateofArrival = MAAllocation.ETA != null && MAAllocation.ETA.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETATime, MAAllocation.ETA.Value, TZM) : (DateTime?)null; TSA.EstimatedDateofDelivery = MAAllocation.ETD != null && MAAllocation.ETD.Value.Year != 1 ? UtilityRepository.ConvertToUniversalTimeWitDate(MAAllocation.ETDTime, MAAllocation.ETD.Value, TZM) : (DateTime?)null; TSA.FlightNumber = MAAllocation.FlightNumber; TSA.LegNum = MAAllocation.LegNum; TSA.MAWB = MAAllocation.MAWB; dbContext.TradelaneShipmentAllocations.Add(TSA); dbContext.SaveChanges(); if (TSA.TradelaneShipmentId > 0 && !string.IsNullOrEmpty(TSA.MAWB)) { new TradelaneBookingRepository().SaveTradelaneMawb(TSA.MAWB, (int)TSA.TradelaneShipmentId); } } } MAM.Status = true; } if (Result.ShipmentHandlerMethodId == 5) { if (MAList.FirstOrDefault().AgentId > 0) { SendMailtoAgent(MAList.FirstOrDefault(), MAList.FirstOrDefault().AgentId, MAList.FirstOrDefault().TradelaneId, FilePath); } if (MAList.Skip(1).FirstOrDefault().AgentId > 0) { SendMailtoAgent(MAList.Skip(1).FirstOrDefault(), MAList.Skip(1).FirstOrDefault().AgentId, MAList.Skip(1).FirstOrDefault().TradelaneId, FilePath); } } else { if (MAList.FirstOrDefault().AgentId > 0) { SendMailtoAgent(MAList.FirstOrDefault(), MAList.FirstOrDefault().AgentId, MAList.FirstOrDefault().TradelaneId, FilePath); } } if (MAM.Status && ShipmentType == "Tradelane") { new TradelaneBookingRepository().SaveIsAgentMawbAllocationDocument(MAList.FirstOrDefault().TradelaneId); } return(MAM); } else { MAM.Status = false; return(MAM); } }
public void GetMainfestData(DateTime ShipmentDate, TimeSpan FromTime, TimeSpan ToTime) { var GetCustomer = (from ECS in dbContext.eCommerceShipments where ECS.EstimatedDateofDelivery <= ShipmentDate && ECS.EstimatedTimeofDelivery <= FromTime && (ECS.IsManifested != true || ECS.IsManifested == null) select new { ECS.CustomerId, ECS.EstimatedDateofDelivery }).ToList(); var getCustomer = GetCustomer.Distinct(); var TimeZoneDetail = new TimeZoneModal(); foreach (var res in getCustomer) { TimeZoneDetail = (from ECS in dbContext.Users join Tmz in dbContext.Timezones on ECS.TimezoneId equals Tmz.TimezoneId where ECS.UserId == res.CustomerId select new TimeZoneModal { TimezoneId = Tmz.TimezoneId, Name = Tmz.Name, Offset = Tmz.Offset, OffsetShort = Tmz.OffsetShort }).FirstOrDefault(); } Logger _log = Get_Log(); var FromDateBeforeDayLightTime = new DateTime(2017, 03, 10, 07, 00, 00, DateTimeKind.Utc); var FromDateAfterDaylightTime = new DateTime(2017, 04, 14, 07, 00, 00, DateTimeKind.Utc); var zzzz = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").GetUtcOffset(FromDateBeforeDayLightTime).TotalHours; var zzzz1 = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time").GetUtcOffset(FromDateBeforeDayLightTime).TotalHours; var GetTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); _log.Info("Error due to fuel sur charge and exchange rate"); var ServerTimeHour = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time").GetUtcOffset(FromDateAfterDaylightTime).TotalHours; var OffsetTimeHour = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time").GetUtcOffset(FromDateAfterDaylightTime).TotalHours; // Daylight saving time in USA with TimezoneInfo Class var TimeZoneInformationHongKong = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time"); var TimeZoneInformationNewYork = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); var TimeZoneInformationHK = TimeZoneInfo.ConvertTime(FromDateBeforeDayLightTime, TimeZoneInformationHongKong); var DatebyUTCtoSelectedTimezone = TimeZoneInfo.ConvertTime(FromDateBeforeDayLightTime, TimeZoneInformationNewYork); var DatebyUTCtoSelectedTimezone1 = TimeZoneInfo.ConvertTime(FromDateAfterDaylightTime, TimeZoneInformationNewYork); var TimeZoneInformationHKinfo = TimeZoneInfo.ConvertTimeFromUtc(FromDateBeforeDayLightTime, TimeZoneInformationHongKong); var TimeZoneInformationHKinfoz = TimeZoneInfo.ConvertTimeFromUtc(FromDateAfterDaylightTime, TimeZoneInformationHongKong); var TimeZoneInformationNyinfo = TimeZoneInfo.ConvertTimeFromUtc(FromDateBeforeDayLightTime, TimeZoneInformationNewYork); var TimeZoneInformationNyinfoz = TimeZoneInfo.ConvertTimeFromUtc(FromDateAfterDaylightTime, TimeZoneInformationNewYork); _log.Info("Error due to fuel sur charge and exchange rate"); //_log.Error("From Date is" + FromDateAfterDaylightTime + " Us Time after daylight saving time adjustment" + AddHoursToServerTimeZone1); _log.Info("Error due to fuel sur charge and exchange rate"); _log.Error(FromTime.ToString()); _log.Info("Error due to fuel sur charge and exchange rate"); _log.Error(ToTime.ToString()); var Fromtime = new DateTime(2017, 01, 01, FromTime.Hours, FromTime.Minutes, FromTime.Seconds).ToUniversalTime().TimeOfDay; var Totime = new DateTime(2017, 01, 01, ToTime.Hours, ToTime.Minutes, ToTime.Seconds).ToUniversalTime().TimeOfDay; //Elmah.ErrorSignal.FromCurrentContext().Raise(new Exception(Fromtime.ToString())); //Elmah.ErrorSignal.FromCurrentContext().Raise(new Exception(Totime.ToString())); _log.Info("Error due to fuel sur charge and exchange rate"); _log.Error(Fromtime.ToString()); _log.Info("Error due to fuel sur charge and exchange rate"); _log.Error(Totime.ToString()); //var TmDetail = TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(), TimeZoneInfo.Local); var ManifestData = (from ECS in dbContext.eCommerceShipments join EADF in dbContext.eCommerceShipmentAddresses on ECS.FromAddressId equals EADF.eCommerceShipmentAddressId join EADT in dbContext.eCommerceShipmentAddresses on ECS.ToAddressId equals EADT.eCommerceShipmentAddressId join PDD in dbContext.eCommerceShipmentDetails on ECS.eCommerceShipmentId equals PDD.eCommerceShipmentId join TN in dbContext.eCommercePackageTrackingDetails on PDD.eCommerceShipmentDetailId equals TN.eCommerceShipmentDetailId join TD in dbContext.eCommercePackageTrackingDetails on PDD.eCommerceShipmentDetailId equals TD.eCommerceShipmentDetailId join Cur in dbContext.CurrencyTypes on ECS.CurrencyCode equals Cur.CurrencyCode join Cun in dbContext.Countries on EADF.CountryId equals Cun.CountryId where ECS.EstimatedDateofDelivery.Value <= ShipmentDate && ECS.EstimatedTimeofDelivery.Value <= Fromtime && (ECS.IsManifested != true || ECS.IsManifested == null) select new FrayteManifestOnExcel { ECommerceShipmentId = ECS.eCommerceShipmentId, TrackingNumber = TN.TrackingNo, Reference = ECS.Reference1, InternalAccountNumber = PDD.eCommerceShipmentDetailId, ShipperName = EADF.ContactFirstName + " " + EADF.ContactLastName, ShipperAddress1 = EADF.Address1, ShipperAddress2 = EADF.Address2, ShipperCity = EADF.City, ShipperZip = EADF.Zip, ShipperState = EADF.State, ShipperPhoneNo = EADF.PhoneNo, ShipperEmail = EADF.Email, ShipperCountryCode = Cun.CountryName, ConsigneeName = EADT.ContactFirstName + " " + EADT.ContactLastName, ConsigneeAddress1 = EADT.Address1, ConsigneeAddress2 = EADT.Address2, ConsigneeCity = EADT.City, ConsigneeZip = EADT.Zip, ConsigneeState = EADT.State, ConsigneePhoneNo = EADT.PhoneNo, ConsigneeEmail = EADT.Email, ConsigneeCountryCode = Cun.CountryName, WeightUOM = ECS.PackageCaculatonType, Currency = Cur.CurrencyDescription, Pieces = PDD.CartoonValue, TotalWeight = PDD.Weight * PDD.CartoonValue, TotalValue = PDD.CartoonValue * PDD.DeclaredValue, Incoterms = "DDP", ItemDescription = ECS.ContentDescription, ItemHScodes = PDD.HSCode, ItemValue = PDD.DeclaredValue, EstimatedDateofArrival = ECS.EstimatedDateofArrival, EstimatedTimeofArrival = ECS.EstimatedTimeofArrival, EstimatedDateofDelivery = ECS.EstimatedDateofDelivery, EstimatedTimeofDelivery = ECS.EstimatedTimeofDelivery }).ToList(); if (ManifestData.Count > 0) { // Send Mail before Creating Manifest var res = ManifestExcelWrite(ManifestData); // Send Mail before Creating Manifest // Make IsManifested Flag True if (res.Message == "True") { foreach (var a in ManifestData) { var result = dbContext.eCommerceShipments.Where(p => p.eCommerceShipmentId == a.ECommerceShipmentId).FirstOrDefault(); if (result != null) { result.IsManifested = true; dbContext.Entry(result).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); } } } } else { Console.Write("There is no record to create custom manifest."); } //return ManifestData; }