using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; using BLL; using Newtonsoft.Json.Linq; namespace FineUIPro.Web.CQMS.ManageReportNew { public partial class MonthReportEdit : PageBase { #region 定义项 /// /// 主键 /// public string ReportId { get { return (string)ViewState["ReportId"]; } set { ViewState["ReportId"] = value; } } public string AddOrUpdate { get { return (string)ViewState["AddOrUpdate"]; } set { ViewState["AddOrUpdate"] = value; } } #endregion #region 列表集合 private static List detailsGrid1 = new List(); #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.EnableViewState = true; this.lblProjectName.Text = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectName; this.ReportId = Request.Params["reportId"]; if (!string.IsNullOrEmpty(Request.Params["view"])) { this.Button1.Visible = false; this.Button2.Visible = false; } if (!string.IsNullOrEmpty(this.ReportId)) { Model.Report_WeekAndMonthReport_New weekAndMonthReport = WeekAndMonthReportNewService.Detail(this.ReportId); if (weekAndMonthReport != null) { if (weekAndMonthReport.SortId != null) { this.txtPeriod.Text = Convert.ToString(weekAndMonthReport.SortId); } if (weekAndMonthReport.StartDate != null) { this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.StartDate); } if (weekAndMonthReport.EndDate != null) { this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", weekAndMonthReport.EndDate); } } AddOrUpdate = "update"; #region 加载本月质量目标管理情况 detailsGrid1.Clear(); detailsGrid1 = (from x in Funs.DB.Report_CqmsTarget where x.ReportId == this.ReportId orderby x.SortId select x).ToList(); if (detailsGrid1.Count>0) { Grid1.Hidden = false; Grid1.DataSource = detailsGrid1; Grid1.DataBind(); } #endregion #region 加载文本框内容 var txtReportList = Funs.DB.Report_TextBoxContent.Where(x => x.ReportId == ReportId).ToList(); txtAre0.Text = txtReportList.FirstOrDefault(x => x.ContentType == "0").ContentText; txtAre1.Text = txtReportList.FirstOrDefault(x => x.ContentType == "1").ContentText; txtAre2.Text = txtReportList.FirstOrDefault(x => x.ContentType == "2").ContentText; txtAre20.Text = txtReportList.FirstOrDefault(x => x.ContentType == "20").ContentText; txtAre21.Text = txtReportList.FirstOrDefault(x => x.ContentType == "21").ContentText; txtAre22.Text = txtReportList.FirstOrDefault(x => x.ContentType == "22").ContentText; #endregion //加载所有grid lodAllGrid("1"); } else { this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["startdate"]; this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).AddDays(-1)) : Request.Params["enddate"]; //给个新的主键 ReportId = Guid.NewGuid().ToString(); AddOrUpdate = "add"; //加载所有grid lodAllGrid("0"); } hidReportId.Value = ReportId; } } /// /// 加载grid /// /// void lodAllGrid(string objType) { //加载一般施工方案审批情况 loadGeneralPlanApproval(objType); //加载危大工程方案审批情况 loadMajorPlanApproval(objType); //质量控制点或检验试验计划(ITP)情况 loadInspectionTestPlan(objType); //加载设计交底管理情况 loadDesignDetailsApprove(objType); //加载图纸会审管理情况 loadReviewDrawings(objType); //加载设计变更管理情况 loadDesignChangeOrder(); } #endregion #region 时间选择事件 /// /// 开始时间选择事件 /// /// /// protected void txtStartDate_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim())) { string url = Request.Url.ToString(); if (url.Contains("?")) { url = Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf('?')); } Response.Redirect(url + "?startdate=" + txtStartDate.Text + "&enddate=" + txtEndDate.Text); } } protected void TextBox_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim())&& !string.IsNullOrEmpty(this.txtEndDate.Text.Trim())) { if (Funs.GetNewDateTime(this.txtStartDate.Text.Trim()) > Funs.GetNewDateTime(this.txtEndDate.Text.Trim())) { Alert.ShowInTop("开始时间不能大于结束时间!", MessageBoxIcon.Warning); return; } if (AddOrUpdate == "update") { lodAllGrid("1"); } else { lodAllGrid("0"); } } } #endregion #region 本月质量目标管理情况 Grid1方法 protected void btnAddGrid1_Click(object sender, EventArgs e) { Grid1.Hidden = false; JArray teamGroupData = Grid1.GetMergedData(); List list = new List(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); values.Add("Id", teamGroupRow.Value("id")); list.Add(values); } JObject defaultObj = new JObject { { "Id",Guid.NewGuid() }, { "ReportId", ReportId }, { "ProStage", "" }, { "ProDescribe",""}, { "TargetValue", "" }, { "MonthPer","" }, { "Remarks", "" }, { "SortId","" }, { "Delete1", String.Format("", GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) } }; list.Add(defaultObj); Grid1.DataSource = list; Grid1.DataBind(); } protected void Grid1_PreDataBound(object sender, EventArgs e) { // 设置LinkButtonField的点击客户端事件 LinkButtonField deleteField = Grid1.FindColumn("Delete1") as LinkButtonField; deleteField.OnClientClick = GetDeleteScriptGrid1(); } /// /// 删除提示 /// /// private string GetDeleteScriptGrid1() { return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty); } #endregion #region 3.1一般施工方案审批情况 Grid2方法 /// /// 加载一般施工审批情况 /// void loadGeneralPlanApproval(string objType) { var db = Funs.DB; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); var list = new List(); int i = 1; int Quantity1Sum = 0; int Quantity2Sum = 0; //加载所有单位 var units = from x in Funs.DB.Project_ProjectUnit join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2|| x.UnitType == BLL.Const.ProjectUnitType_1) orderby y.UnitCode select new { x.UnitId, y.UnitName }; foreach (var item in units) { var query = from c in db.Comprehensive_GeneralPlanApproval join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin from u in unitJoin.DefaultIfEmpty() where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId select new { c.ApprovalDate, c.ProjectId, u.UnitId, u.UnitName, c.CompileDate }; var AllList = query.ToList(); var monethCount = query .Where(x => (x.ApprovalDate >= Convert.ToDateTime(startDate) && x.ApprovalDate <= Convert.ToDateTime(endDate))); Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); model.Id = Guid.NewGuid().ToString(); model.UnitOrMajor = item.UnitName; model.Quantity1 = monethCount.Count(); model.Quantity2 = AllList.Count(); model.ReportId = ReportId; //如果是修改,查询表中数据 if (objType=="1") { var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.UnitName && x.ReType == "0"); if (NewModel!=null) { model.Remarks = NewModel.Remarks; } } list.Add(model); Quantity1Sum+= monethCount.Count(); Quantity2Sum += AllList.Count(); i++; } Grid2.DataSource = list; Grid2.DataBind(); //合计 JObject summary = new JObject(); summary.Add("UnitOrMajor", "合计"); summary.Add("Quantity1", Quantity1Sum.ToString()); summary.Add("Quantity2", Quantity2Sum.ToString()); Grid2.SummaryData = summary; } #endregion #region 3.2 危大工程方案审批情况 Grid3方法 /// /// 加载一般施工审批情况 /// void loadMajorPlanApproval(string objType) { var db = Funs.DB; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); var list = new List(); int i = 1; int Quantity1Sum = 0; int Quantity2Sum = 0; int Quantity3Sum = 0; //加载所有单位 var units = from x in Funs.DB.Project_ProjectUnit join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId where x.ProjectId == this.CurrUser.LoginProjectId && (x.UnitType == BLL.Const.ProjectUnitType_2 || x.UnitType == BLL.Const.ProjectUnitType_1) orderby y.UnitCode select new { x.UnitId, y.UnitName }; foreach (var item in units) { var query = from c in db.Comprehensive_MajorPlanApproval join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin from u in unitJoin.DefaultIfEmpty() where c.ProjectId == this.CurrUser.LoginProjectId && c.UnitId == item.UnitId select new { c.ApprovalDate, c.ProjectId, u.UnitId, u.UnitName, c.ExpertReviewMan, c.CompileDate }; var AllList = query.ToList(); var monethCount = query .Where(x => (x.ApprovalDate >= Convert.ToDateTime(startDate) && x.ApprovalDate <= Convert.ToDateTime(endDate))); Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); model.Id = Guid.NewGuid().ToString(); model.UnitOrMajor = item.UnitName; model.Quantity1 = monethCount.Count(); model.Quantity2 = AllList.Count(); model.Quantity3 = AllList.Where(x => x.ExpertReviewMan != "").ToList().Count(); model.ReportId = ReportId; //如果是修改,查询表中数据 if (objType == "1") { var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.UnitName && x.ReType == "1"); if (NewModel != null) { model.Remarks = NewModel.Remarks; } } list.Add(model); Quantity1Sum += monethCount.Count(); Quantity2Sum += AllList.Count(); Quantity3Sum += Convert.ToInt32(model.Quantity3); i++; } Grid3.DataSource = list; Grid3.DataBind(); //合计 JObject summary = new JObject(); summary.Add("UnitOrMajor", "合计"); summary.Add("Quantity1", Quantity1Sum.ToString()); summary.Add("Quantity2", Quantity2Sum.ToString()); summary.Add("Quantity3", Quantity3Sum.ToString()); Grid3.SummaryData = summary; } #endregion #region 3.3 质量控制点或检验试验计划(ITP)情况 Grid4方法 /// /// 加载一般施工审批情况 /// void loadInspectionTestPlan(string objType) { var db = Funs.DB; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); var list = new List(); int i = 1; int Quantity1Sum = 0; int Quantity2Sum = 0; //加载所有专业 var CNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select new { x.CNProfessionalId, x.ProfessionalName }; foreach (var item in CNProfessionals) { var query = from c in db.Inspection_Test_Plan join u in db.Base_Unit on c.UnitId equals u.UnitId into unitJoin from u in unitJoin.DefaultIfEmpty() where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId select new { c.ApprovalDate, c.ProjectId, u.UnitId, u.UnitName, c.CreateDate }; var AllList = query.ToList(); var monethCount = query .Where(x => (x.CreateDate >= Convert.ToDateTime(startDate) && x.CreateDate <= Convert.ToDateTime(endDate))); Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); model.Id = Guid.NewGuid().ToString(); model.UnitOrMajor = item.ProfessionalName; model.Quantity1 = monethCount.Count(); model.Quantity2 = AllList.Count(); model.ReportId = ReportId; //如果是修改,查询表中数据 if (objType == "1") { var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "2"); if (NewModel != null) { model.Remarks = NewModel.Remarks; } } list.Add(model); Quantity1Sum += monethCount.Count(); Quantity2Sum += AllList.Count(); i++; } Grid4.DataSource = list; Grid4.DataBind(); //合计 JObject summary = new JObject(); summary.Add("UnitOrMajor", "合计"); summary.Add("Quantity1", Quantity1Sum.ToString()); summary.Add("Quantity2", Quantity2Sum.ToString()); Grid4.SummaryData = summary; } #endregion #region 4 设计交底管理情况 Grid5方法 /// /// 加载一般施工审批情况 /// void loadDesignDetailsApprove(string objType) { var db = Funs.DB; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); var list = new List(); int i = 1; int Quantity1Sum = 0; int Quantity2Sum = 0; //加载所有专业 var CNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select new { x.CNProfessionalId, x.ProfessionalName }; foreach (var item in CNProfessionals) { var query = from c in db.Comprehensive_DesignDetails where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId && c.Status=="3" select new { c.Status, c.CompileDate, c.ProjectId, }; var AllList = query.ToList(); var monethCount = query .Where(x => (x.CompileDate >= Convert.ToDateTime(startDate) && x.CompileDate <= Convert.ToDateTime(endDate))); Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); model.Id = Guid.NewGuid().ToString(); model.UnitOrMajor = item.ProfessionalName; model.Quantity1 = monethCount.Count(); model.Quantity2 = AllList.Count(); model.ReportId = ReportId; //如果是修改,查询表中数据 if (objType == "1") { var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "3"); if (NewModel != null) { model.Remarks = NewModel.Remarks; } } list.Add(model); Quantity1Sum += monethCount.Count(); Quantity2Sum += AllList.Count(); i++; } Grid5.DataSource = list; Grid5.DataBind(); //合计 JObject summary = new JObject(); summary.Add("UnitOrMajor", "合计"); summary.Add("Quantity1", Quantity1Sum.ToString()); summary.Add("Quantity2", Quantity2Sum.ToString()); Grid5.SummaryData = summary; } #endregion #region 5 图纸会审管理情况 Grid6方法 /// /// 加载一图纸会审管理情况 /// void loadReviewDrawings(string objType) { var db = Funs.DB; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); var list = new List(); int i = 1; int Quantity1Sum = 0; int Quantity2Sum = 0; //加载所有专业 var CNProfessionals = from x in Funs.DB.Base_CNProfessional where x.CNProfessionalId != BLL.Const.CNProfessionalConstructId orderby x.SortIndex select new { x.CNProfessionalId, x.ProfessionalName }; foreach (var item in CNProfessionals) { var query = from c in db.Comprehensive_ReviewDrawings where c.ProjectId == this.CurrUser.LoginProjectId && c.CNProfessionalId == item.CNProfessionalId && c.Status == "3" select new { c.Status, c.ReviewDate, c.ProjectId, }; var AllList = query.ToList(); var monethCount = query .Where(x => (x.ReviewDate >= Convert.ToDateTime(startDate) && x.ReviewDate <= Convert.ToDateTime(endDate))); Model.Report_Construction_Plan model = new Model.Report_Construction_Plan(); model.Id = Guid.NewGuid().ToString(); model.UnitOrMajor = item.ProfessionalName; model.Quantity1 = monethCount.Count(); model.Quantity2 = AllList.Count(); model.ReportId = ReportId; //如果是修改,查询表中数据 if (objType == "1") { var NewModel = db.Report_Construction_Plan.FirstOrDefault(x => x.ReportId == ReportId && x.UnitOrMajor == item.ProfessionalName && x.ReType == "4"); if (NewModel != null) { model.Remarks = NewModel.Remarks; } } list.Add(model); Quantity1Sum += monethCount.Count(); Quantity2Sum += AllList.Count(); i++; } Grid6.DataSource = list; Grid6.DataBind(); //合计 JObject summary = new JObject(); summary.Add("UnitOrMajor", "合计"); summary.Add("Quantity1", Quantity1Sum.ToString()); summary.Add("Quantity2", Quantity2Sum.ToString()); Grid6.SummaryData = summary; } #endregion #region 6 设计变更管理情况 Grid7方法 /// /// 加载设计变更管理情况 /// void loadDesignChangeOrder() { int Quantity1Sum=0, Quantity2Sum=0, Quantity3Sum=0, Quantity4Sum=0, Quantity5Sum=0, Quantity6Sum = 0; DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); DateTime projectStartDate = Convert.ToDateTime("2015-01-01"); List StatisticsList = new List(); Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId); if (project != null) { if (project.StartDate != null) { projectStartDate = Convert.ToDateTime(project.StartDate); } } int i = 1; var cNProfessionals = from x in Funs.DB.Base_CNProfessional orderby x.SortIndex select x; foreach (var item in cNProfessionals) { //专业下所有集合 List totalManagementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, projectStartDate, DateTime.Now); //专业下当期集合 List managementList = BLL.DesignChangeOrderService.GetDesignChangeOrderListByCNProfessionalIdAndDate(this.CurrUser.LoginProjectId, item.CNProfessionalId, startDate, endDate); Model.CheckStatisc checkStatisc = new Model.CheckStatisc(); checkStatisc.Num = i; checkStatisc.WorkName = item.ProfessionalName; checkStatisc.CheckNum = managementList.Count(); checkStatisc.TotalCheckNum = totalManagementList.Count(); checkStatisc.OKNum = managementList.Count(x => x.ApprovalDate != null); checkStatisc.TotalOKNum = totalManagementList.Count(x => x.ApprovalDate != null); checkStatisc.OneOKRate = managementList.Count(x => x.Status == "3").ToString(); //当期完成数 checkStatisc.TotalOneOKRate = totalManagementList.Count(x => x.Status == "3").ToString(); //累计完成数 StatisticsList.Add(checkStatisc); Quantity1Sum += checkStatisc.CheckNum; Quantity2Sum += checkStatisc.TotalCheckNum; Quantity3Sum+= checkStatisc.OKNum; Quantity4Sum += checkStatisc.TotalOKNum; Quantity5Sum += Convert.ToInt32(checkStatisc.OneOKRate); Quantity6Sum += Convert.ToInt32(checkStatisc.TotalOneOKRate); } Grid7.DataSource = StatisticsList; Grid7.DataBind(); //合计 JObject summary = new JObject(); summary.Add("WorkName", "合计"); summary.Add("CheckNum", Quantity1Sum.ToString()); summary.Add("TotalCheckNum", Quantity2Sum.ToString()); summary.Add("OKNum", Quantity3Sum.ToString()); summary.Add("TotalOKNum", Quantity4Sum.ToString()); summary.Add("OneOKRate", Quantity5Sum.ToString()); summary.Add("TotalOneOKRate", Quantity6Sum.ToString()); Grid7.SummaryData = summary; } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { Model.Report_WeekAndMonthReport_New report = new Model.Report_WeekAndMonthReport_New(); report.Id = ReportId; report.ProjectId = this.CurrUser.LoginProjectId; if (!string.IsNullOrEmpty(this.txtPeriod.Text.Trim())) { try { report.SortId = this.txtPeriod.Text.Trim(); } catch (Exception) { ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('周期输入格式不正确,请重新输入!')", true); return; } } if (!string.IsNullOrEmpty(this.txtStartDate.Text)) { report.StartDate = Convert.ToDateTime(this.txtStartDate.Text); } if (!string.IsNullOrEmpty(this.txtEndDate.Text)) { report.EndDate = Convert.ToDateTime(this.txtEndDate.Text); } report.CreateDate = DateTime.Now; report.CreateMan = CurrUser.UserId; #region 删除所有子表 //本月质量目标管理情况 CqmsTargetService.Delete(ReportId); //所有文本框表 TextBoxContentService.Delete(ReportId); //删除施工方案及检验试验计划审批情况 BLL.CQMS.ManageReport.ReportNew.ConstructionPlanService.Delete(ReportId); #endregion #region 保存所有子表 //保存本月质量目标管理情况 saveTarget(); //保存3.1一般施工方案审批情况 saveYbsgfa(); //保存3.2危大工程方案审批情况 saveWdgcfa(); //保存3.2质量控制点或检验试验计划(ITP)情况 saveJysyjh(); //保存4 设计交底管理情况 saveSjjd(); //保存4图纸会审管理情况 saveTzhs(); //保存文本框 saveTxtContent(); #endregion if (AddOrUpdate == "add") { WeekAndMonthReportNewService.Insert(report); } else { WeekAndMonthReportNewService.Update(report); } ShowNotify("编辑成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #region 保存本月质量目标管理情况 void saveTarget() { List detailLists = new List(); JArray teamGroupData = Grid1.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_CqmsTarget newDetail = new Model.Report_CqmsTarget { //Id = values.Value("Id"), ReportId = ReportId, ProStage = values.Value("ProStage"), ProDescribe = values.Value("ProDescribe"), TargetValue = values.Value("TargetValue"), MonthPer = values.Value("MonthPer"), Remarks = values.Value("Remarks"), SortId = rowIndex + 1 }; if (Grid1.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid1.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count>0) { Funs.DB.Report_CqmsTarget.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } #endregion /// /// 3.1保存一般施工方案审批情况 /// void saveYbsgfa() { List detailLists = new List(); JArray teamGroupData = Grid2.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan { //Id = values.Value("Id"), ReportId = ReportId, ReType = "0", UnitOrMajor = values.Value("UnitOrMajor"), Quantity1 = values.Value("Quantity1"), Quantity2 = values.Value("Quantity2"), Remarks = values.Value("Remarks") }; if (Grid2.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid2.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count > 0) { Funs.DB.Report_Construction_Plan.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } /// /// 3.2保存危大工程方案审批情况 /// void saveWdgcfa() { List detailLists = new List(); JArray teamGroupData = Grid3.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan { //Id = values.Value("Id"), ReportId = ReportId, ReType = "1", UnitOrMajor = values.Value("UnitOrMajor"), Quantity1 = values.Value("Quantity1"), Quantity2 = values.Value("Quantity2"), Quantity3 = values.Value("Quantity3"), Remarks = values.Value("Remarks") }; if (Grid3.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid3.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count > 0) { Funs.DB.Report_Construction_Plan.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } /// /// 3.3 质量控制点或检验试验计划(ITP)情况 /// void saveJysyjh() { List detailLists = new List(); JArray teamGroupData = Grid4.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan { //Id = values.Value("Id"), ReportId = ReportId, ReType = "2", UnitOrMajor = values.Value("UnitOrMajor"), Quantity1 = values.Value("Quantity1"), Quantity2 = values.Value("Quantity2"), Remarks = values.Value("Remarks") }; if (Grid4.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid4.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count > 0) { Funs.DB.Report_Construction_Plan.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } /// /// 保存设计交底管理情况 /// void saveSjjd() { List detailLists = new List(); JArray teamGroupData = Grid5.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan { //Id = values.Value("Id"), ReportId = ReportId, ReType = "3", UnitOrMajor = values.Value("UnitOrMajor"), Quantity1 = values.Value("Quantity1"), Quantity2 = values.Value("Quantity2"), Remarks = values.Value("Remarks") }; if (Grid5.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid5.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count > 0) { Funs.DB.Report_Construction_Plan.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } /// /// 保存图纸会审 /// void saveTzhs() { List detailLists = new List(); JArray teamGroupData = Grid6.GetMergedData(); foreach (JObject teamGroupRow in teamGroupData) { JObject values = teamGroupRow.Value("values"); int rowIndex = teamGroupRow.Value("index"); Model.Report_Construction_Plan newDetail = new Model.Report_Construction_Plan { //Id = values.Value("Id"), ReportId = ReportId, ReType = "4", UnitOrMajor = values.Value("UnitOrMajor"), Quantity1 = values.Value("Quantity1"), Quantity2 = values.Value("Quantity2"), Remarks = values.Value("Remarks") }; if (Grid6.Rows[rowIndex].DataKeys.Length > 0) { newDetail.Id = Grid6.Rows[rowIndex].DataKeys[0].ToString(); } detailLists.Add(newDetail); } if (detailLists.Count > 0) { Funs.DB.Report_Construction_Plan.InsertAllOnSubmit(detailLists); Funs.DB.SubmitChanges(); } } /// /// 保存文本框内容 /// void saveTxtContent() { var txtContentList = new List(); #region 给实体赋值 var model0 = new Model.Report_TextBoxContent(); model0.Id = Guid.NewGuid().ToString(); model0.ReportId = ReportId; model0.ContentType = "0"; model0.ContentText = txtAre0.Text; txtContentList.Add(model0); var model1 = new Model.Report_TextBoxContent(); model1.Id = Guid.NewGuid().ToString(); model1.ReportId = ReportId; model1.ContentType = "1"; model1.ContentText = txtAre1.Text; txtContentList.Add(model1); var model2 = new Model.Report_TextBoxContent(); model2.Id = Guid.NewGuid().ToString(); model2.ReportId = ReportId; model2.ContentType = "2"; model2.ContentText = txtAre2.Text; txtContentList.Add(model2); var model20 = new Model.Report_TextBoxContent(); model20.Id = Guid.NewGuid().ToString(); model20.ReportId = ReportId; model20.ContentType = "20"; model20.ContentText = txtAre20.Text; txtContentList.Add(model20); var model21 = new Model.Report_TextBoxContent(); model21.Id = Guid.NewGuid().ToString(); model21.ReportId = ReportId; model21.ContentType = "21"; model21.ContentText = txtAre21.Text; txtContentList.Add(model21); var model22 = new Model.Report_TextBoxContent(); model22.Id = Guid.NewGuid().ToString(); model22.ReportId = ReportId; model22.ContentType = "22"; model22.ContentText = txtAre22.Text; txtContentList.Add(model22); #endregion Funs.DB.Report_TextBoxContent.InsertAllOnSubmit(txtContentList); Funs.DB.SubmitChanges(); } #endregion } }