///<summary> ///会商人员插入表2信息 ///</summary> ///<returns>会商人员插入表2信息</returns> public bool AddConSecMessage(TmidReportDataModel model) { string strSql = "insert into T_Mid_ReportData(ReportCode,AQI,TimeType,FutureDate) values('" + model.ReportCode + "','" + model.AQI + "','" + model.TimeType + "','" + model.FutureDate + "')"; int rows = sqlh.ExecuteSQLNonQuery(strSql); if (rows > 0) { return(true); } else { return(false); } }
//市环境监测站人员保存操作,其中包括数据插入,数据修改等 protected void btn_save_Click(object sender, EventArgs e) { TmidReportModel SecModel = new TmidReportModel(); TmidReportDataModel FmoDel = new TmidReportDataModel(); bool result = false; int rows = 0; DataTable dt = bill.SelectReport(strReportDate); int int_data = dt.Rows.Count; string YJ = ""; string YJColor = ""; string firstP = ""; //首要污染物 Int32 PolLast = 0; //污染物持续时间 bool firstDay = false, secondDay = false; //某天是否超标 try { int td = Convert.ToInt32(txt_td.Value); int su = Convert.ToInt32(txt_su.Value); int fu = Convert.ToInt32(txt_tfu.Value); if (!chk_jch.Checked && !chk_tsh.Checked) { if (td >= 500 || su >= 500 || fu >= 500) { YJ = "一级"; YJColor = "红色"; } else if (td >= 300 || su >= 300 || fu >= 300) { YJ = "二级"; YJColor = "橙色"; } else if (td >= 200 || su >= 200 || fu >= 200) { YJ = "三级"; YJColor = "黄色"; } else if (td >= 200 || su >= 200 || fu >= 200) { YJ = "四级"; YJColor = "蓝色"; } #region 判断是否超标 if (td >= 500 || td >= 300 || td >= 200) { SecModel.PolStart = ReportDate.Date; firstP = hd_day.Value; PolLast = 1; firstDay = true; } if ((su >= 500 || su >= 300 || su >= 200) && firstDay) { firstP = hd_day.Value + ";" + hd_day1.Value; PolLast += 1; secondDay = true; } else if ((su >= 500 || su >= 300 || su >= 200) && firstDay == false) { SecModel.PolStart = ReportDate; firstP = hd_day1.Value; PolLast = 1; secondDay = true; } if ((fu >= 500 || fu >= 300 || fu >= 200) && firstDay && secondDay) { firstP = hd_day.Value + ";" + hd_day1.Value + ";" + hd_day2.Value; PolLast += 1; } else if ((fu >= 500 || fu >= 300 || fu >= 200) && firstDay == false && secondDay) { SecModel.PolStart = ReportDate.Date.AddDays(1); firstP = hd_day1.Value + ";" + hd_day2.Value; PolLast = 2; } else if ((fu >= 500 || fu >= 300 || fu >= 200) && firstDay && secondDay == false) { SecModel.PolStart = ReportDate; firstP = hd_day.Value; PolLast = 1; } else if ((fu >= 500 || fu >= 300 || fu >= 200) && firstDay == false && secondDay == false) { SecModel.PolStart = ReportDate.AddDays(2); firstP = hd_day2.Value; PolLast = 1; } SecModel.PolLast = PolLast; if (PolLast > 0) { SecModel.Firstp = RemoveRepeatFirstP(firstP); } #endregion } SecModel.PolRange = getCurCityName(); SecModel.YJDJ = YJ; SecModel.YJColor = YJColor; SecModel.JCSubmit = 0; SecModel.JCUser = Session["UserID"].ToString(); SecModel.QXSubmit = 0; SecModel.IsJCH = chk_jch.Checked.ToString(); SecModel.IsTSH = chk_tsh.Checked.ToString(); SecModel.ReprtTime = ReportDate.Date; SecModel.QXText = taID.Value; //if (int_data > 0 && dt.Rows[0]["JCSubmit"].ToString()!="1") //{ // result = bill.UpdataConMessage(SecModel, ref strCode); //} //else //{ // result = bill.AddConMessage(SecModel, ref strCode); //} if (int_data == 0 || dt.Rows[0]["JCSubmit"].ToString() == "1") { result = bill.AddConMessage(SecModel, ref strCode); dt = bill.SelectReport(strReportDate); } result = bill.UpdataConMessage(SecModel, ref strCode); InArray(strCode, ref rows); if (waitSubmit.Value == "true") { int sub = bill.SubmitData(strReportDate, 1); result = bill.AddConMessage(SecModel, ref strCode); InArray(strCode, ref rows); } if (YJ.Length > 0) { strCode = bill.strCode(strReportDate, "1"); } } catch { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "WasSave", "WasSave('fail')", true); } if (result && rows == 3) { this.btn_save.Text = "修改"; BindDataSelect(); if (int_data > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "WasSave", "WasSave('modify','" + YJ + "','" + chk_jch.Checked + "');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "WasSave", "WasSave('OK','" + YJ + "','" + chk_jch.Checked + "');", true); } } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "WasSave", "WasSave('fail')", true); } }