public IHttpActionResult FrayteUploadShipments(FrayteUploadshipment Shipment) { var GetShipmentInDraftModel = new DirectBookingUploadShipmentRepository().eCommerceUploadShipmentDraft(Shipment, Shipment.CustomerId); var a = new eCommerceUploadShipmentController().SaveEcommUploadShipment(GetShipmentInDraftModel); return(Ok()); }
public IHttpActionResult SaveShipmentDraft(FrayteUploadshipment Shipment) { var result = new DirectBookingUploadShipmentRepository().SaveShipment(Shipment, Shipment.CustomerId, "DirectBooking_SS"); return(Ok()); }
public Tuple <FrayteResult, DirectBookingShipmentDraftDetail, int> DBUploadShipmentParcelHubIntegration(FrayteUploadshipment res) { FrayteResult FR = new FrayteResult(); IntegrtaionResult result = new IntegrtaionResult(); var count = 0; int DirectShipmentid = 0; var directBookingDetail = new DirectBookingUploadShipmentRepository().DirectBookingObj(res); #region COLLECTION Date DateTime mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value; DateTime maxdatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Sunday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); } else if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Saturday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(2); } directBookingDetail.ReferenceDetail.CollectionDate = mindatetime; #endregion //update customerratecard in draft new DirectShipmentRepository().SaveDirectShipmnetDetail(directBookingDetail); // Parcelhub Integration starts //Step 2: Shipment Integrations #region Parcel Hub Integration //Map Direct Booking object with parcel hub objects Frayte.Services.Models.ParcelHub.ParcelHubShipmentRequest request = new ParcelHubRepository().MapDirectBookingDetailToShipmentRequest(directBookingDetail); //Create shipment in Parcel hub Frayte.Services.Models.ParcelHub.ParcelHubResponse response = new ParcelHubRepository().CreateShipment(request); if (response.Error.IsMailSend) { if (directBookingDetail.Error.IsMailSend) { //Send error mail to developer new ShipmentEmailRepository().SendShipmentErrorMail(directBookingDetail, response.Error); } } else { //Mapping ShipmentResonse to IntegrtaionResult result = new ParcelHubRepository().MappingParcelHubToIntegrationResult(directBookingDetail, response, null); if (result.Status) { //Save Shipment Detail Into Our DB DirectShipmentid = new DirectShipmentRepository().SaveShipment(directBookingDetail, result); if (DirectShipmentid > 0) { var Id = new eCommerceUploadShipmentRepository().SaveBatchProcessProcessedShipment(1, directBookingDetail.CustomerId); } //Mapping ShipmentResult to IntegrtaionResult new ParcelHubRepository().MappingCourierPieceDetail(result, directBookingDetail, DirectShipmentid); //Save Package Label Tracking detail new ParcelHubRepository().SaveTrackingDetail(directBookingDetail, result, DirectShipmentid); //Start downloading the images from UPS server and making PDF FratyteError Error = new ParcelHubRepository().DownloadParcelHubPackageImage(directBookingDetail, result, DirectShipmentid); } else { if (result.Error.IsMailSend) { new eCommerceUploadShipmentRepository().SaveBatchProcessUnprocessedShipment(1, res.CustomerId); //Send error mail to developer new ShipmentEmailRepository().SendShipmentErrorMail(directBookingDetail, directBookingDetail.Error); } } } #endregion return(Tuple.Create(FR, directBookingDetail, DirectShipmentid)); }
public Tuple <FrayteResult, DirectBookingShipmentDraftDetail, int> DBUploadShipmentDHLIntegration(FrayteUploadshipment res) { IntegrtaionResult result = new IntegrtaionResult(); FrayteResult FR = new FrayteResult(); //string xsUserFolder = @"C:\FMS\" + "FrayteSchedularlog.txt"; string xsUserFolder = @"D:\ProjectFrayte\" + "FrayteScheduler.txt"; BaseLog.Instance.SetLogFile(xsUserFolder); Logger _log = Get_Log(); int DirectShipmentid = 0; var directBookingDetail = new DirectBookingUploadShipmentRepository().DirectBookingObj(res); #region COLLECTION Date DateTime mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value; DateTime maxdatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Sunday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); } else if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Saturday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(2); } directBookingDetail.ReferenceDetail.CollectionDate = mindatetime; #endregion _log.Error("Get direct Booking Object"); //update customerratecard in draft new DirectShipmentRepository().SaveDirectShipmnetDetail(directBookingDetail); _log.Error("saved direct Booking Object"); //step1. Mapping With directBookingDetail to ShipmentRequestDto var shipmentRequestDto = new DHLRepository().MapDirectBookingDetailToDHLShipmentRequestDto(directBookingDetail); //Step 2. Create Xml var shipmentXML = new DHLRepository().CreateXMLForDHL(shipmentRequestDto); _log.Error("done xml dhl shipment"); _log.Error(shipmentXML); string xml_in = ""; try { xml_in = File.ReadAllText(shipmentXML); //xml_in = File.ReadAllText(@"C:\FMS\app.godemowithus.com\WebApi\UploadFiles\PDFGenerator\HTMLFile\tempDHLShipment.xml"); } catch (Exception e) { _log.Error(e.Message); _log.Error(e.InnerException); _log.Error(e.StackTrace); } _log.Error("reading xml dhl shipment"); //step 3. Create Shipment var DHLResponse = new DHLRepository().CreateShipment(xml_in, shipmentRequestDto); // _log.Error("done integration dhl shipment" + DHLResponse.Error.ErrorDescription.ToString()); //step 4. Mapping ShipmentResonse to IntegrtaionResult result = new DHLRepository().MapDHLIntegrationResponse(DHLResponse); if (result.Status) { //step2. After Shipment Create need to save the information in database DirectShipmentid = new DirectShipmentRepository().SaveShipment(directBookingDetail, result); if (DirectShipmentid > 0) { _log.Error("done save dhl shipment in db" + directBookingDetail.CustomerId); var Id = new eCommerceUploadShipmentRepository().SaveBatchProcessProcessedShipment(1, directBookingDetail.CustomerId); _log.Error(Id.ToString()); } _log.Error("done save dhl shipment in db"); if (directBookingDetail.CustomerRateCard.CourierName == FrayteCourierCompany.DHL) { //Step 1.1 Mapping ShipmentResult to IntegrtaionResult new DHLRepository().MappingCourierPieceDetail(result, directBookingDetail, DirectShipmentid); } //Step3 : Save Package Label Tracking detail new DHLRepository().SaveTrackingDetail(directBookingDetail, result, DirectShipmentid); //Step4: //Start downloading the images from UPS server and making PDF var count = 1; var totalpiece = result.PieceTrackingDetails.Count(); totalpiece = totalpiece - 1; foreach (var data in result.PieceTrackingDetails.Take(totalpiece)) { if (directBookingDetail.CustomerRateCard.CourierName == FrayteCourierCompany.DHL) { _log.Error("downloading shipment image"); //Step3.1 data.LabelName = new DHLRepository().DownloadDHLImage(data, totalpiece, count, DirectShipmentid); _log.Error("downloaded shipment image"); } //// Step3.2 //new DirectShipmentRepository().SavePackageDetail(data, result.CourierName); //_log.Error("saved package detail shipment image"); if (!data.PieceTrackingNumber.Contains("AirwayBillNumber_")) { // Step3.2 new DirectShipmentRepository().SavePackageDetail(data, result.CourierName); } count++; } var CourierPieceDetail = result.PieceTrackingDetails.Where(t => t.PieceTrackingNumber.Contains("AirwayBillNumber_")).FirstOrDefault(); if (CourierPieceDetail != null) { var data1 = new DHLRepository().DownloadDHLImage(CourierPieceDetail, totalpiece, 0, DirectShipmentid); } if (result != null) { directBookingDetail.Error = new FratyteError(); directBookingDetail.Error.Status = result.Status; } return(Tuple.Create(FR, directBookingDetail, DirectShipmentid)); } else { directBookingDetail.Error = result.Error; new eCommerceUploadShipmentRepository().SaveBatchProcessUnprocessedShipment(1, directBookingDetail.CustomerId); //Send mail to developer new ShipmentEmailRepository().SendShipmentErrorMail(directBookingDetail, directBookingDetail.Error); } return(Tuple.Create(FR, directBookingDetail, DirectShipmentid)); }
public Tuple <FrayteResult, DirectBookingShipmentDraftDetail, int> DBUploadShipmentUpsIntegration(FrayteUploadshipment res) { FrayteResult FR = new FrayteResult(); var count = 0; int DirectShipmentid = 0; var result1 = new DirectBookingUploadShipmentRepository().DirectBookingObj(res); #region COLLECTION Date DateTime mindatetime = result1.ReferenceDetail.CollectionDate.Value; DateTime maxdatetime = result1.ReferenceDetail.CollectionDate.Value.AddDays(1); if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Sunday) { mindatetime = result1.ReferenceDetail.CollectionDate.Value.AddDays(1); } else if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Saturday) { mindatetime = result1.ReferenceDetail.CollectionDate.Value.AddDays(2); } result1.ReferenceDetail.CollectionDate = mindatetime; #endregion //update customerratecard in draft new DirectShipmentRepository().SaveDirectShipmnetDetail(result1); //step1. Mapping With directBookingDetail to ShipmentRequestDto var shipmentRequestDto = new UPSRepository().MapDirectBookingDetailToShipmentRequestDto(result1); //Step2.Create Shipment var shipmentResult = new UPSRepository().CreateShipment(shipmentRequestDto, result1.ReferenceDetail); //step3 Mapping ShipmentResonse to IntegrtaionResult var result = new UPSRepository().MapUPSIntegrationResponse(shipmentResult); if (result.Status) { //step1. After Shipment Create need to save the information in database DirectShipmentid = new DirectShipmentRepository().SaveShipment(result1, result); if (DirectShipmentid > 0) { var Id = new eCommerceUploadShipmentRepository().SaveBatchProcessProcessedShipment(1, result1.CustomerId); } if (result.CourierName == FrayteCourierCompany.UPS) { //Step 1.1 Mapping ShipmentResult to IntegrtaionResult new UPSRepository().MappingCourierPieceDetail(result, result1, DirectShipmentid); } //Step2 : Save Package Label Tracking detail new UPSRepository().SaveTrackingDetail(result1, result, DirectShipmentid); //Step3: //Start downloading the images from UPS server and making PDF count = 1; foreach (var data in result.PieceTrackingDetails) { if (result.CourierName == FrayteCourierCompany.UPS) { //Step3.1 data.LabelName = new UPSRepository().DownloadUPSImage(data, result.PieceTrackingDetails.Count(), count, DirectShipmentid); } // Step3.2 new DirectShipmentRepository().SavePackageDetail(data, result.CourierName); count++; } result1.Error = new FratyteError() { Status = result.Status }; FR.Status = true; //FrayteShipmentResponse = new APIShipmentRepository().MappingFrayteShipmentResponse(directBookingDetail, result, DirectShipmentid.ToString(), ratecard, Request.RateCardId); } else { FR.Status = false; result1.Error = result.Error; new eCommerceUploadShipmentRepository().SaveBatchProcessUnprocessedShipment(1, res.CustomerId); //Send mail to developer new ShipmentEmailRepository().SendShipmentErrorMail(result1, result1.Error); } return(Tuple.Create(FR, result1, DirectShipmentid)); }
public Tuple <FrayteResult, DirectBookingShipmentDraftDetail, int, TNTResponseDto, List <FraytePackageTrackingDetail> > DBUploadShipmentTNTIntegration(FrayteUploadshipment res) { FrayteResult FR = new FrayteResult(); var count = 0; int DirectShipmentid = 0; //string xsUserFolder = @"C:\FMS\" + "FrayteSchedularlog.txt"; string xsUserFolder = @"D:\ProjectFrayte\" + "FrayteScheduler.txt"; BaseLog.Instance.SetLogFile(xsUserFolder); Logger _log = Get_Log(); _log.Error("entered in else tnt"); var directBookingDetail = new DirectBookingUploadShipmentRepository().DirectBookingObj(res); #region COLLECTION Date DateTime mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value; DateTime maxdatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Sunday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(1); } else if (System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(mindatetime.DayOfWeek) == FraytePickUpDay.Saturday) { mindatetime = directBookingDetail.ReferenceDetail.CollectionDate.Value.AddDays(2); } directBookingDetail.ReferenceDetail.CollectionDate = mindatetime; #endregion _log.Error("entered in else tnt1"); //update customerratecard in draft new DirectShipmentRepository().SaveDirectShipmnetDetail(directBookingDetail); _log.Error("entered in else tnt2"); var shipmentPackageTrackingDetail = new List <FraytePackageTrackingDetail>(); // TNT Integration is for HK as we have account detail for HK only _log.Error("entered in else tnt3"); var TNTObj = new TNTRepository().MapDirectBookingObjToTNTobj(directBookingDetail); _log.Error("entered in else tnt4"); var TNTXml = new TNTRepository().CreateTNTXMl(TNTObj); _log.Error("entered in else tnt5"); var TNTResponse = new TNTRepository().CreateShipment(TNTXml, directBookingDetail.DirectShipmentDraftId); _log.Error("entered in else tnt6"); directBookingDetail.Error = TNTResponse.Error; //TNTIntegration(directBookingDetail, out DirectShipmentid); _log.Error("entered in else tnt7"); if (directBookingDetail.Error != null && directBookingDetail.Error.Status == true) { //Finally Save the Order Id too to get the information of multiple shpment in Tracking Detail page. DirectShipmentid = new DirectShipmentRepository().SaveShipment(directBookingDetail, TNTResponse.TNTShipmentResponse.TrackingCode, directBookingDetail.CustomerId, null, null); if (DirectShipmentid > 0) { var Id = new eCommerceUploadShipmentRepository().SaveBatchProcessProcessedShipment(1, directBookingDetail.CustomerId); } // save tracking code int increment = 0; foreach (var package in directBookingDetail.Packages) { var trackingDetail = new DirectShipmentRepository().SaveTNTTrackingDeatil(TNTResponse.TNTShipmentResponse.TrackingCode, DirectShipmentid, increment); if (trackingDetail != null) { foreach (var data in trackingDetail) { shipmentPackageTrackingDetail.Add(data); } } increment++; } if (directBookingDetail != null) { directBookingDetail.Error = new FratyteError(); directBookingDetail.Error.Status = directBookingDetail.Error.Status; } } else { new eCommerceUploadShipmentRepository().SaveBatchProcessUnprocessedShipment(1, res.CustomerId); } return(Tuple.Create(FR, directBookingDetail, DirectShipmentid, TNTResponse, shipmentPackageTrackingDetail)); }
public FrayteResult GenerateECommerceLabelUploadShipmentReport(int eCommerceShipmentId, FrayteUploadshipment eCommerceBookingDetail, List <string> imgList, string CourierName) { FrayteResult result = new FrayteResult(); try { List <PdfImage> imglist = new List <PdfImage>(); PdfImage pbimage; foreach (var img in imgList) { pbimage = new PdfImage(); pbimage.FullPath = HttpContext.Current.Server.MapPath(AppSettings.eCommerceLabelFolder) + eCommerceShipmentId + "/" + img; imglist.Add(pbimage); } string pdfPath = string.Empty; if (eCommerceBookingDetail != null) { string CourierCompany = eCommerceBookingDetail.CourierCompany; string TrackingNo = new eCommerceShipmentRepository().GetTrackingNo(eCommerceShipmentId); if (!string.IsNullOrEmpty(CourierCompany)) { pdfPath = HttpContext.Current.Server.MapPath("~/PackageLabel/eCommerce/" + eCommerceShipmentId + "/") + CourierCompany.Replace(" ", "") + "-" + TrackingNo + ".pdf"; } else { pdfPath = HttpContext.Current.Server.MapPath("~/PackageLabel/eCommerce/" + eCommerceShipmentId + "/") + CourierCompany.Replace(" ", "") + "-" + TrackingNo + ".pdf"; } } else { string[] ff = imgList[0].ToString().Split('.'); string name = ff[0].ToString(); pdfPath = HttpContext.Current.Server.MapPath(AppSettings.eCommerceLabelFolder) + eCommerceShipmentId + "/" + name + ".pdf"; } if (File.Exists(pdfPath)) { File.Delete(pdfPath); } if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(AppSettings.eCommerceLabelFolder) + "/" + eCommerceShipmentId)) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(AppSettings.eCommerceLabelFolder) + "/" + eCommerceShipmentId); } if (CourierName == FrayteCourierCompany.TNT) { ReportTemplate.Other.TNTImagesToPDFReport report = new ReportTemplate.Other.TNTImagesToPDFReport(); report.DataSource = imglist; DevExpress.XtraPrinting.PdfExportOptions pdfOptions = report.ExportOptions.Pdf; pdfOptions.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.Highest; pdfOptions.PdfACompatibility = DevExpress.XtraPrinting.PdfACompatibility.PdfA2b; report.ExportToPdf(pdfPath, pdfOptions); result.Status = true; } else if (CourierName.Contains(FrayteCourierCompany.DHL)) { ReportTemplate.Other.DHLImageToPDFReport dhlReport = new ReportTemplate.Other.DHLImageToPDFReport(); dhlReport.DataSource = imglist; DevExpress.XtraPrinting.PdfExportOptions pdfOptions = dhlReport.ExportOptions.Pdf; pdfOptions.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.Highest; pdfOptions.PdfACompatibility = DevExpress.XtraPrinting.PdfACompatibility.PdfA2b; dhlReport.ExportToPdf(pdfPath, pdfOptions); result.Status = true; } else { ReportTemplate.Other.PackageLabelsPdfReport pbreport = new ReportTemplate.Other.PackageLabelsPdfReport(); pbreport.DataSource = imglist; DevExpress.XtraPrinting.PdfExportOptions pdfOptions = pbreport.ExportOptions.Pdf; pdfOptions.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.Highest; pdfOptions.PdfACompatibility = DevExpress.XtraPrinting.PdfACompatibility.PdfA2b; pbreport.ExportToPdf(pdfPath, pdfOptions); result.Status = true; } return(result); } catch (Exception ex) { result.Status = false; return(result); } }
public List <FrayteUploadshipment> JsonValidate(ExpressShipmentRequest frayteShipmentRequest, string CallFrom) { FrayteUploadshipment upload = new FrayteUploadshipment(); List <FrayteUploadshipment> _upload = new List <FrayteUploadshipment>(); upload.ShipFrom = new DirectBookingCollection() { CompanyName = frayteShipmentRequest.ShipFrom.CompanyName, FirstName = frayteShipmentRequest.ShipFrom.FirstName, LastName = frayteShipmentRequest.ShipFrom.LastName, Email = frayteShipmentRequest.ShipFrom.Email, Phone = frayteShipmentRequest.ShipFrom.Phone, Address = frayteShipmentRequest.ShipFrom.Address.Address1, Address2 = frayteShipmentRequest.ShipFrom.Address.Address2, City = frayteShipmentRequest.ShipFrom.Address.City, State = frayteShipmentRequest.ShipFrom.Address.State, Area = frayteShipmentRequest.ShipFrom.Address.Area, PostCode = frayteShipmentRequest.ShipFrom.Address.Postcode, Country = new FrayteCountryCode() { Code = frayteShipmentRequest.ShipFrom.Address.CountryCode } }; upload.ShipTo = new DirectBookingCollection() { CompanyName = frayteShipmentRequest.ShipTo.CompanyName, FirstName = frayteShipmentRequest.ShipTo.FirstName, LastName = frayteShipmentRequest.ShipTo.LastName, Email = frayteShipmentRequest.ShipTo.Email, Phone = frayteShipmentRequest.ShipTo.Phone, Address = frayteShipmentRequest.ShipTo.Address.Address1, Address2 = frayteShipmentRequest.ShipTo.Address.Address2, City = frayteShipmentRequest.ShipTo.Address.City, State = frayteShipmentRequest.ShipTo.Address.State, Area = frayteShipmentRequest.ShipTo.Address.Area, PostCode = frayteShipmentRequest.ShipTo.Address.Postcode, Country = new FrayteCountryCode() { Code = frayteShipmentRequest.ShipTo.Address.CountryCode } }; upload.Package = new List <UploadShipmentPackage>(); foreach (var pp in frayteShipmentRequest.Package) { UploadShipmentPackage pack = new UploadShipmentPackage() { Length = Frayte.Services.CommonConversion.ConvertToDecimal(pp.Length), Width = Frayte.Services.CommonConversion.ConvertToDecimal(pp.Width), Height = Frayte.Services.CommonConversion.ConvertToDecimal(pp.Height), Weight = pp.Weight, CartoonValue = pp.CartoonValue, Value = pp.DeclaredValue, Content = pp.ShipmentContents }; upload.Package.Add(pack); } ; upload.CustomInfo = new CustomInformation() { ContentsType = frayteShipmentRequest.CustomInformation.ContentsType, ContentsExplanation = frayteShipmentRequest.CustomInformation.ContentsExplanation, RestrictionType = frayteShipmentRequest.CustomInformation.RestrictionType, RestrictionComments = frayteShipmentRequest.CustomInformation.RestrictionComments, CustomsSigner = frayteShipmentRequest.CustomInformation.CustomsSigner, NonDeliveryOption = frayteShipmentRequest.CustomInformation.NonDeliveryOption, }; upload.ServiceCode = frayteShipmentRequest.ServiceCode; frayteShipmentRequest.Service = GetExpressService(frayteShipmentRequest.ServiceCode); if (frayteShipmentRequest.ShipFrom.Address.CountryCode == "GBR" && frayteShipmentRequest.ShipTo.Address.CountryCode == "GBR") { frayteShipmentRequest.Service.LogisticServiceType = "UK Domestic"; } else if (frayteShipmentRequest.ShipFrom.Address.CountryCode != "GBR" && frayteShipmentRequest.ShipTo.Address.CountryCode == "GBR") { frayteShipmentRequest.Service.LogisticServiceType = "Import"; } else if (frayteShipmentRequest.ShipFrom.Address.CountryCode == "GBR" && frayteShipmentRequest.ShipTo.Address.CountryCode != "GBR") { frayteShipmentRequest.Service.LogisticServiceType = "Export"; } upload.PackageCalculationType = frayteShipmentRequest.PackageCalculationType; upload.CurrencyCode = frayteShipmentRequest.DeclaredCurrencyCode; upload.PayTaxAndDuties = frayteShipmentRequest.PaymentPartyTaxAndDuties; upload.ShipmentReference = frayteShipmentRequest.ShipmentReference; upload.ShipmentDescription = frayteShipmentRequest.Package[0].ShipmentContents; //upload.CollectionDate = frayteShipmentRequest.RequestedPickupDate.HasValue ? frayteShipmentRequest.RequestedPickupDate.Value.ToString("dd/MM/yyyy") : ""; //upload.CollectionTime = frayteShipmentRequest.RequestedPickupDate.HasValue ? frayteShipmentRequest.RequestedPickupDate.Value.ToString("HHmm") : ""; _upload.Add(upload); ErrorLog(_upload, CallFrom); List <FrayteUploadshipment> Unsucessfuljson = new List <FrayteUploadshipment>(); foreach (var res in _upload) { if (res.Errors.Count > 0) { Unsucessfuljson.Add(res); } } return(Unsucessfuljson); }