public TradelaneFile ShipmentExportManifest(int tradelaneShipmentId) { TradelaneFile result = new TradelaneFile(); List <ExportManifestPdfModel> ModelList = new List <ExportManifestPdfModel>(); ExportManifestPdfModel models = new ExpressReportRepository().GetExportManifestPDFDataSource(tradelaneShipmentId); ModelList.Add(models); ReportTemplate.Express.ExportManifestExpressSolution report = new ReportTemplate.Express.ExportManifestExpressSolution(); report.DataSource = ModelList; string fileName = models.ExportManifestName + ".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 ShipmentBagLabel(int BagId, int userId) { TradelaneFile result = new TradelaneFile(); List <ExpressReportBagLabel> model = new ExpressReportRepository().GetBagLabelReportObj(BagId, userId); // List<TradelaneBookingReportMAWB> model = new TradelaneReportsRepository().GetMAWBObj(tradelaneShipmentId); ReportTemplate.Express.EXSBagLabel report = new ReportTemplate.Express.EXSBagLabel(); report.DataSource = model; ImageExportOptions options = new ImageExportOptions(); options.Resolution = 150; string fileName = "EXS-BGL-" + model[0].Hub + "-" + model[0].Ref + ".jpeg"; //int tradelaneShipmentId = model[0].TradelaneShipmentId; string filePath = AppSettings.WebApiPath + "/UploadFiles/ExpressBag/" + BagId + "/" + fileName; string filePhysicalPath = HttpContext.Current.Server.MapPath("~/UploadFiles/ExpressBag/" + BagId + "/" + fileName); if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath("~/UploadFiles/ExpressBag/" + BagId + "/"))) { System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/UploadFiles/ExpressBag/" + BagId + "/")); } if (File.Exists(filePhysicalPath)) { File.Delete(filePhysicalPath); } report.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 ShipmentDriverManifest(int tradelaneShipmentId, int userId) { TradelaneFile result = new TradelaneFile(); List <ExpressReportDriverManifest> model = new ExpressReportRepository().GetDriverManifestReportObj(tradelaneShipmentId, userId); ReportTemplate.Express.DriverManifestExpressSolution report = new ReportTemplate.Express.DriverManifestExpressSolution(); report.DataSource = model; string filePhysicalPath = string.Empty; string fileName = "Destination Manifest EXS" + "-" + "MN" + "-" + model[0].Hub + "-" + model[0].Ref + ".pdf"; string filePath = AppSettings.WebApiPath + "/UploadFiles/Tradelane/" + tradelaneShipmentId + "/" + fileName; if (AppSettings.ShipmentCreatedFrom == "BATCH") { filePhysicalPath = AppSettings.UploadFolderPath + "/Tradelane/" + tradelaneShipmentId + "/" + fileName; if (!System.IO.Directory.Exists(AppSettings.UploadFolderPath + "/Tradelane/" + tradelaneShipmentId + "/")) { System.IO.Directory.CreateDirectory(AppSettings.UploadFolderPath + "/Tradelane/" + tradelaneShipmentId + "/"); } } else { 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); }