diff --git a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs index db5aa02f..eb6b11b9 100644 --- a/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/ManageReportNew/MonthReport.aspx.cs @@ -2972,140 +2972,153 @@ namespace FineUIPro.Web.CQMS.ManageReportNew #region 23.施工照片 string imageUrl = "res/images/R-C.png"; - var imageUrl1 = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl1) && imageUrl1 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-1") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl1; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl1"); - if (!string.IsNullOrEmpty(url)) + var imageUrl1 = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl1) && imageUrl1 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl1, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl1; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl1"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl1, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } - - var imageUrl2 = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl2) && imageUrl2 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-2") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl2; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl2"); - if (!string.IsNullOrEmpty(url)) + var imageUrl2 = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl2) && imageUrl2 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl2, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl2; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl2"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl2, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } - - var imageUrl3 = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl3) && imageUrl3 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-3") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl3; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl3"); - if (!string.IsNullOrEmpty(url)) + var imageUrl3 = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl3) && imageUrl3 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl3, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl3; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl3"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl3, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } - - var imageUrl4 = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl4) && imageUrl4 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-4") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl4; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl4"); - if (!string.IsNullOrEmpty(url)) + var imageUrl4 = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl4) && imageUrl4 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl4, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl4; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl4"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl4, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } - - var imageUrl5 = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl5) && imageUrl5 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-5") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl5; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl5"); - if (!string.IsNullOrEmpty(url)) + var imageUrl5 = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl5) && imageUrl5 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl5, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl5; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl5"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl5, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } - - var imageUrl6 = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ImageUrl; - if (!string.IsNullOrWhiteSpace(imageUrl6) && imageUrl6 != imageUrl) + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-6") != null) { - string rootPathUrl = rootPath.Replace("\\", "/"); - string url = rootPathUrl + imageUrl6; - //DocumentBuilder builder = new DocumentBuilder(doc); - builder.MoveToBookmark("ImageUrl6"); - if (!string.IsNullOrEmpty(url)) + var imageUrl6 = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ImageUrl; + if (!string.IsNullOrWhiteSpace(imageUrl6) && imageUrl6 != imageUrl) { - System.Drawing.Size JpgSize; - float Wpx; - float Hpx; - UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl6, out JpgSize, out Wpx, out Hpx); - //double w = 1; - //w = JpgSize.Width / 50.0; - if (File.Exists(url)) + string rootPathUrl = rootPath.Replace("\\", "/"); + string url = rootPathUrl + imageUrl6; + //DocumentBuilder builder = new DocumentBuilder(doc); + builder.MoveToBookmark("ImageUrl6"); + if (!string.IsNullOrEmpty(url)) { - //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); - builder.InsertImage(url, 200, 150); + System.Drawing.Size JpgSize; + float Wpx; + float Hpx; + UploadAttachmentService.getJpgSize(rootPathUrl + imageUrl6, out JpgSize, out Wpx, out Hpx); + //double w = 1; + //w = JpgSize.Width / 50.0; + if (File.Exists(url)) + { + //builder.InsertImage(url, JpgSize.Width / w, JpgSize.Height / w); + builder.InsertImage(url, 200, 150); + } } } } @@ -3113,37 +3126,55 @@ namespace FineUIPro.Web.CQMS.ManageReportNew bkmark = doc.Range.Bookmarks["ImageContent1"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-1") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-1").ContentText; + } } bkmark = doc.Range.Bookmarks["ImageContent2"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-2") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-2").ContentText; + } } bkmark = doc.Range.Bookmarks["ImageContent3"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-3") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-3").ContentText; + } } bkmark = doc.Range.Bookmarks["ImageContent4"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-4") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-4").ContentText; + } } bkmark = doc.Range.Bookmarks["ImageContent5"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-5") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-5").ContentText; + } } bkmark = doc.Range.Bookmarks["ImageContent6"]; if (bkmark != null) { - bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ContentText; + if (txtReportList.FirstOrDefault(x => x.ContentType == "23-6") != null) + { + bkmark.Text = txtReportList.FirstOrDefault(x => x.ContentType == "23-6").ContentText; + } } #endregion