private void getImageDailyBatteryAllCust(string ProcessDate, string WebAddress, string ImageFolder, string ReportPeriod, string WeekNumber, string YearNumber) { // throw new NotImplementedException(); //string WebParam; //Uri WebUrl; //string ImagePath; //Uri websiteName = new Uri(WebAddress); string CustomerId = string.Empty; DataTable dtCust = new DataTable(); DataTable dtVin = new DataTable(); GetData gd = new GetData(); dtCust = gd.DtGetCustomerInfo(DateTime.Parse(ProcessDate)); int i = 0; int j = 0; foreach (DataRow dRow in dtCust.Rows) { i++; j = 0; CustomerId = dRow["CustomerId"].ToString(); dtVin = gd.DtGetCustomerVehicleInfo(int.Parse(CustomerId), DateTime.Parse(ProcessDate)); foreach (DataRow vRow in dtVin.Rows) { j++; getImageDailyBatteryByVin(vRow["VinID"].ToString(), ProcessDate, WebAddress, ImageFolder, ReportPeriod, WeekNumber, YearNumber); } } }
private void GenerateBatteryChartByCustVin(string TempFolderPath, string ProcessDate) { Paragraph para = new Paragraph(); Section sec = new Section(); string CustomerId = string.Empty; string CustomerName = string.Empty; string Vin = string.Empty; int VinId = 0; string Bus = string.Empty; DataTable dtCust = new DataTable(); DataTable dtVin = new DataTable(); GetData gd = new GetData(); dtCust = gd.DtGetCustomerInfo(DateTime.Parse(ProcessDate)); int i = 0; int j = 0; foreach (DataRow dRow in dtCust.Rows) { i++; j = 0; CustomerId = dRow["CustomerId"].ToString(); CustomerName = dRow["CustomerName"].ToString(); dtVin = gd.DtGetCustomerVehicleInfo(int.Parse(CustomerId), DateTime.Parse(ProcessDate)); _doc.NewPage(); //para = new Paragraph(CustomerName); //Chapter chap = new Chapter(para, i); //Section section1 = chap.AddSection(20f, "Section 1.1", 1); //_doc.Add(chap); foreach (DataRow vRow in dtVin.Rows) { j++; Vin = string.Empty; Vin = vRow["Vin"].ToString(); Bus = vRow["Bus"].ToString(); VinId = int.Parse(vRow["VinID"].ToString()); if (j > 1) { _doc.NewPage(); } //Dashboard// // sec = chap.AddSection(20f, Vin, j); //PdfPTable tableHeader = GenerateBatteryAllCustHeader(ProcessDate, CustomerName, Vin, Bus); //_doc.Add(tableHeader); para = new Paragraph(Bus.ToUpper()); Chapter chap = new Chapter(para, j); _doc.Add(chap); string imageURL_VinDash = Path.Combine(TempFolderPath, string.Format("VinDashboard_{0}.png", vRow["VinID"].ToString())); //iTextSharp.text.Image jpg_VinDash = iTextSharp.text.Image.GetInstance(imageURL_VinDash); ////Resize image depend upon your need ////jpg.ScaleToFit(chartWidth, chartHeight); //// jpg_VinHist.ScaleToFit(600f, 250f); //jpg_VinDash.ScalePercent(75f); ////Give space before image //jpg_VinDash.SpacingBefore = 10f; ////Give some space after the image //jpg_VinDash.SpacingAfter = 1f; //jpg_VinDash.Alignment = Element.ALIGN_CENTER; //_doc.Add(jpg_VinDash); PdfPTable tablebat = GenerateBatteryVinDashboard(ProcessDate, VinId); _doc.Add(tablebat); //TMaxByPacks// string imageURL_TMaxByPacks = Path.Combine(TempFolderPath, string.Format("TMaxByPacks_{0}.png", vRow["VinID"].ToString())); iTextSharp.text.Image jpg_TMaxByPacks = iTextSharp.text.Image.GetInstance(imageURL_TMaxByPacks); //Resize image depend upon your need //jpg.ScaleToFit(chartWidth, chartHeight); // jpg_VinHist.ScaleToFit(600f, 250f); jpg_TMaxByPacks.ScalePercent(60f); //Give space before image jpg_TMaxByPacks.SpacingBefore = 10f; //Give some space after the image jpg_TMaxByPacks.SpacingAfter = 1f; jpg_TMaxByPacks.Alignment = Element.ALIGN_CENTER; _doc.Add(jpg_TMaxByPacks); //CurrentByPacks// string imageURL_CurrentByPacks = Path.Combine(TempFolderPath, string.Format("CurrentByPacks_{0}.png", vRow["VinID"].ToString())); iTextSharp.text.Image jpg_CurrentByPacks = iTextSharp.text.Image.GetInstance(imageURL_CurrentByPacks); //Resize image depend upon your need //jpg.ScaleToFit(chartWidth, chartHeight); // jpg_VinHist.ScaleToFit(600f, 250f); jpg_CurrentByPacks.ScalePercent(60f); //Give space before image jpg_CurrentByPacks.SpacingBefore = 10f; //Give some space after the image jpg_CurrentByPacks.SpacingAfter = 1f; jpg_CurrentByPacks.Alignment = Element.ALIGN_CENTER; _doc.Add(jpg_CurrentByPacks); //SoCByPacks_Min// string imageURL_SoCByPacks_Min = Path.Combine(TempFolderPath, string.Format("SoCByPacks_Min_{0}.png", vRow["VinID"].ToString())); iTextSharp.text.Image jpg_SoCByPacks_Min = iTextSharp.text.Image.GetInstance(imageURL_SoCByPacks_Min); //Resize image depend upon your need //jpg.ScaleToFit(chartWidth, chartHeight); // jpg_VinHist.ScaleToFit(600f, 250f); jpg_SoCByPacks_Min.ScalePercent(60f); //Give space before image jpg_SoCByPacks_Min.SpacingBefore = 10f; //Give some space after the image jpg_SoCByPacks_Min.SpacingAfter = 1f; jpg_SoCByPacks_Min.Alignment = Element.ALIGN_CENTER; _doc.Add(jpg_SoCByPacks_Min); //SoCByPacks_Max// string imageURL_SoCByPacks_Max = Path.Combine(TempFolderPath, string.Format("SoCByPacks_Max_{0}.png", vRow["VinID"].ToString())); iTextSharp.text.Image jpg_SoCByPacks_Max = iTextSharp.text.Image.GetInstance(imageURL_SoCByPacks_Max); //Resize image depend upon your need //jpg.ScaleToFit(chartWidth, chartHeight); // jpg_VinHist.ScaleToFit(600f, 250f); jpg_SoCByPacks_Max.ScalePercent(60f); //Give space before image jpg_SoCByPacks_Max.SpacingBefore = 10f; //Give some space after the image jpg_SoCByPacks_Max.SpacingAfter = 1f; jpg_SoCByPacks_Max.Alignment = Element.ALIGN_CENTER; _doc.Add(jpg_SoCByPacks_Max); //CurrentByPacks } } }