public TradelaneFile ShipmentMAWB(int tradelaneShipmentId, string documentTypeName) { TradelaneFile result = new TradelaneFile(); List <TradelaneBookingReportMAWB> model = new TradelaneReportsRepository().GetMAWBObj(tradelaneShipmentId); ReportTemplate.Tradelane.MAWB report = new Report.Generator.ReportTemplate.Tradelane.MAWB(); report.DataSource = model; string fileName = "MAWB_" + model[0].MAWBWithCode + ".pdf"; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName); if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } report.ExportToPdf(filePhysicalPath); result.FileName = fileName; result.FilePath = filePath; return(result); }
public TradelaneFile ShipmentManifest(int tradelaneShipmentId, int userId) { TradelaneFile result = new TradelaneFile(); List <TradelaneManifestReport> model = new TradelaneReportsRepository().ManifestReportModel(tradelaneShipmentId, userId); ReportTemplate.Tradelane.Manifest report = new ReportTemplate.Tradelane.Manifest(); report.DataSource = model; PdfExportOptions options = new PdfExportOptions(); options.ImageQuality = PdfJpegImageQuality.Highest; options.PdfACompatibility = PdfACompatibility.None; string fileName = "Summary_Manifest_" + (!string.IsNullOrEmpty(model[0].MAWB) ? model[0].AirlineCode + "-" + model[0].MAWB : model[0].FrayteNumber) + ".pdf"; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName); if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } report.ExportToPdf(filePhysicalPath, options); result.FileName = fileName; result.FilePath = filePath; result.TradelaneShipmentId = tradelaneShipmentId; return(result); }
public TradelaneFile ShipmentCoLoadForm(int tradelaneShipmentId) { TradelaneFile result = new TradelaneFile(); TradelaneBooking ShipmentDetail = new TradelaneBookingRepository().GetTradelaneBookingDetails(tradelaneShipmentId, ""); List <TradelaneBookingCoLoadFormModel> ColoadModel = new TradelaneReportsRepository().ColoadReportObj(ShipmentDetail); ReportTemplate.Tradelane.CoLoadBookingForm report = new ReportTemplate.Tradelane.CoLoadBookingForm(); if (ColoadModel[0].OperationZoneId == 1) { report.Parameters["lblWebSite"].Value = "WWW.FRAYTE.COM"; report.Parameters["lblCompany"].Value = "FRAYTE LOGISTICS LTD"; report.Parameters["lblAddress1"].Value = "UNIT 2306, 23/F, Trendy Center"; report.Parameters["lblAddress2"].Value = "682-684 Castle Peak Road"; report.Parameters["lblAddress3"].Value = "CHEUNG SHA WAN, HONG KONG"; } else { report.Parameters["lblWebSite"].Value = "WWW.FRAYTE.CO.UK"; report.Parameters["lblCompany"].Value = "FRAYTE LOGISTICS LTD"; report.Parameters["lblAddress1"].Value = "UNIT 2306, 23/F, Trendy Center"; report.Parameters["lblAddress2"].Value = "682-684 Castle Peak Road"; report.Parameters["lblAddress3"].Value = "CHEUNG SHA WAN, HONG KONG"; } report.DataSource = ColoadModel; PdfExportOptions options = new PdfExportOptions(); options.ImageQuality = PdfJpegImageQuality.Highest; options.PdfACompatibility = PdfACompatibility.None; string fileName = "Co_Load_Booking_Form_for_" + (!string.IsNullOrEmpty(ColoadModel[0].MawbNo) ? ColoadModel[0].DestinationAirport + "_" + ColoadModel[0].MawbNo : ColoadModel[0].FrayteNumber) + ".pdf"; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"); filePhysicalPath += fileName; if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } report.ExportToPdf(filePhysicalPath, options); result.FileName = fileName; result.FilePath = filePath; return(result); }
public TradelaneFile ShipmentCartonLabel(int tradelaneShipmentId, int CartonCount, int TradelaneShipmentDetailId, string Hawb) { TradelaneFile result = new TradelaneFile(); var model = new TradelaneReportsRepository().GetCartonLabelObj(tradelaneShipmentId, Hawb); ReportTemplate.Tradelane.PackageLabel shipmentDetailReport = new Report.Generator.ReportTemplate.Tradelane.PackageLabel(); model.FirstOrDefault().ScannedPieces = int.Parse(model.FirstOrDefault().TotalPieces); model.FirstOrDefault().TotalPieces = model.FirstOrDefault().HawbScannedCarton + "/" + model.FirstOrDefault().HAWBTotalPieces; shipmentDetailReport.DataSource = model; ImageExportOptions options = new ImageExportOptions(); options.Resolution = 150; var Name = new TradelaneBookingRepository().GetLastScannedCarton(tradelaneShipmentId); string fileName = Name + ".jpeg"; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName); if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } shipmentDetailReport.ExportToImage(filePhysicalPath, options); string resultPath = @"" + filePhysicalPath + ""; using (System.Drawing.Image img = System.Drawing.Image.FromFile(resultPath)) { img.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone); resultPath = @"" + filePhysicalPath + ""; img.Save(resultPath, System.Drawing.Imaging.ImageFormat.Jpeg); } result.FileName = fileName; result.FilePath = filePath; return(result); }
public TradelaneFile ShipmentHAWB(int tradelaneShipmentId, string documentTypeName) { TradelaneFile result = new TradelaneFile(); List <TradelaneBookingReportHAWB> model = new TradelaneReportsRepository().GetHAWBObj(tradelaneShipmentId, documentTypeName); ReportTemplate.Tradelane.HAWB report = new ReportTemplate.Tradelane.HAWB(); report.DataSource = model; string fileName = "HAWB_No_" + model[0].HAWB + ".pdf"; model[0].HAWB = "HAWB No: " + model[0].HAWB; PdfExportOptions options = new PdfExportOptions(); options.ImageQuality = PdfJpegImageQuality.Highest; options.PdfACompatibility = PdfACompatibility.None; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName); if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/Tradelane/" + tradelaneShipmentId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } report.ExportToPdf(filePhysicalPath, options); result.FileName = fileName; result.FilePath = filePath; return(result); }
public TradelaneReportMAWBModel MAWBPreview(int tradelaneShipmentId) { TradelaneReportMAWBModel mawbDetail = new TradelaneReportsRepository().MAWBReportObj(tradelaneShipmentId); return(mawbDetail); }