private byte[] GenerateReportForCover(string imageUrl, rptProjectCwaIwpDTO rptInfo) { byte[] bytes = null; Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string DeviceInfo = "<DeviceInfo>" + " <OutputFormat>JPEG</OutputFormat>" + " <EndPage>1</EndPage>" + " <PageWidth>17in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0in</MarginTop>" + " <MarginLeft>0in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; List<ReportParameter> paramList = new List<ReportParameter>(); //Default Parameter paramList = GetReportParams(rptInfo); //Cover Image Parameter if (!string.IsNullOrEmpty(imageUrl)) { var imageBytes = (new TrueTask.Common()).FileToByteArray(imageUrl); //System.IO.File.ReadAllBytes(imageUrl); if (imageBytes != null) imageUrl = Convert.ToBase64String(imageBytes); } paramList.Add(new ReportParameter("par_imageurl", imageUrl)); LocalReport report = new LocalReport(); report.ReportPath = @".\Prev\Resource\rdl\RPTCreateFIWPP1.rdl"; report.EnableExternalImages = true; report.SetParameters(paramList); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource("CostCode", new List<CostcodeDTO>())); bytes = report.Render("Image", DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); return bytes; }
private List<ReportParameter> GetReportParams(rptProjectCwaIwpDTO rptInfo) { List<ReportParameter> paramList = new List<ReportParameter>(); paramList.Add(new ReportParameter("par_fiwp", string.IsNullOrEmpty(rptInfo.FiwpName) ? "" : rptInfo.FiwpName)); //FIWP paramList.Add(new ReportParameter("par_schid", string.IsNullOrEmpty(rptInfo.ProjectScheduleName) ? "" : rptInfo.ProjectScheduleName)); //SchID paramList.Add(new ReportParameter("txtTitle", string.IsNullOrEmpty(rptInfo.Description) ? "" : rptInfo.Description)); //TITLE paramList.Add(new ReportParameter("par_client", string.IsNullOrEmpty(rptInfo.ClientCompanyName) ? "" : rptInfo.ClientCompanyName)); //Client paramList.Add(new ReportParameter("par_project", string.IsNullOrEmpty(rptInfo.ClientProjectName) ? "" : rptInfo.ClientProjectName)); //Client Project paramList.Add(new ReportParameter("par_job", string.IsNullOrEmpty(rptInfo.ProjectName) ? "" : rptInfo.ProjectName)); //Ledcor Project paramList.Add(new ReportParameter("par_ewp", string.IsNullOrEmpty(rptInfo.CwaName) ? "" : rptInfo.CwaName)); //CWA Ref //Logo string logoUrl = string.Empty; var logoBytes = (new TrueTask.Common()).FileToByteArray(HttpContext.Current.Server.MapPath(@"..\Prev\Resource\images\element_2x07_02.png")); //var logoBytes = (new TrueTask.Common()).FileToByteArray(HttpContext.Current.Server.MapPath(@".\Resource\images\element_2x07_02.png")); if (logoBytes != null) logoUrl = Convert.ToBase64String(logoBytes); paramList.Add(new ReportParameter("par_logoUrl", logoUrl)); //Logo return paramList; }
private byte[] GenerateReportForCombo(List<ComboBoxDTO> combos, rptProjectCwaIwpDTO rptInfo, string listTitle) { byte[] bytes = null; Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string DeviceInfo = "<DeviceInfo>" + " <OutputFormat>JPEG</OutputFormat>" + " <EndPage>1</EndPage>" + " <PageWidth>8in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0in</MarginTop>" + " <MarginLeft>0in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; List<ReportParameter> paramList = new List<ReportParameter>(); //Default Parameter paramList = GetReportParams(rptInfo); //Defined Parameter For Combo paramList.Add(new ReportParameter("par_title", string.IsNullOrEmpty(listTitle) ? "" : listTitle)); //List Title if (combos == null || combos.Count <= 0) combos = new List<ComboBoxDTO>(); LocalReport report = new LocalReport(); report.ReportPath = @".\Prev\Resource\rdl\RPTAssembleList.rdl"; report.EnableExternalImages = true; report.SetParameters(paramList); report.DataSources.Clear(); //Material DataSource report.DataSources.Add(new ReportDataSource("rptCombobox", combos)); bytes = report.Render("Image", DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); return bytes; }
private byte[] GenerateReportForMaterial(List<FiwpmaterialDTO> fiwpmaterials, rptProjectCwaIwpDTO rptInfo) { byte[] bytes = null; Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string DeviceInfo = "<DeviceInfo>" + " <OutputFormat>JPEG</OutputFormat>" + " <EndPage>1</EndPage>" + " <PageWidth>17in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0in</MarginTop>" + " <MarginLeft>0in</MarginLeft>" + " <MarginRight>0in</MarginRight>" + " <MarginBottom>0in</MarginBottom>" + "</DeviceInfo>"; List<ReportParameter> paramList = new List<ReportParameter>(); //Default Parameter paramList = GetReportParams(rptInfo); if (fiwpmaterials == null || fiwpmaterials.Count <= 0) fiwpmaterials = new List<FiwpmaterialDTO>(); LocalReport report = new LocalReport(); report.ReportPath = @".\Prev\Resource\rdl\RPTCreateFIWPP3.rdl"; report.EnableExternalImages = true; report.SetParameters(paramList); report.DataSources.Clear(); //Material DataSource report.DataSources.Add(new ReportDataSource("rptMaterial", fiwpmaterials)); bytes = report.Render("Image", DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); return bytes; }