public static string getInertStr(SummModel sm) { StringBuilder builder = new StringBuilder(); builder.Append("insert into pm_workplan_weeksummary ( wkpdetailsid,wkpsmcontents,wkppercent,wkprecorddate,wkpid) values('"); builder.Append(string.Concat(new object[] { sm.WkpDetailsId, "','", sm.WkpSmContents, "','", sm.WkpPercent, "','", sm.WkpRecordDate, "','", sm.WkpId, "')" })); return(builder.ToString()); }
public static string getUpdateStr(SummModel sm, Guid wkpdetailsid) { StringBuilder builder = new StringBuilder(); builder.Append(string.Concat(new object[] { "update pm_workplan_weeksummary set wkpsmcontents='", sm.WkpSmContents, "',wkppercent='", sm.WkpPercent, "',wkprecorddate='", sm.WkpRecordDate, "'" })); builder.Append(" where wkpdetailsid='" + wkpdetailsid + "'"); return(builder.ToString()); }
public static bool UpdateResult(SummModel sm) { return(publicDbOpClass.NonQuerySqlString(getUpdateStr(sm, sm.WkpDetailsId))); }
public static bool InsertResult(SummModel sm) { return(publicDbOpClass.NonQuerySqlString(getInertStr(sm))); }
protected void btnSave_Click(object sender, EventArgs e) { if (base.Request.QueryString["Action"] == "write") { string sqlString = "select IsValid from pm_workplan_plansummary where wkpid='" + base.Request.QueryString["wkpid"].ToString() + "'"; DataTable dataTable = publicDbOpClass.DataTableQuary(sqlString); if (dataTable.Rows[0][0].ToString() == "true") { base.RegisterScript("top.ui.alert('对不起,该计划已有相应总结,一个计划只能对应一个总结.')"); return; } string value = this.hdnNums.Value; int num = value.Split(new char[] { '?' }).Length - 1; string text = "begin "; SummModel summModel = new SummModel(); for (int i = 0; i < num; i++) { summModel.WkpDetailsId = new Guid(base.Request.Form["txtNormer" + i.ToString()]); summModel.WkpPercent = base.Request.Form["txtpecent" + i.ToString()]; summModel.WkpSmContents = base.Request.Form["txtsummer" + i.ToString()]; summModel.WkpRecordDate = DateTime.Now.Date; summModel.WkpId = new Guid(base.Request.QueryString["wkpid"].ToString()); text = text + SummModelAcion.getInertStr(summModel) + " "; } decimal num2 = 0m; if (!string.IsNullOrEmpty(this.txtScore.Text.Trim())) { num2 = Convert.ToDecimal(this.txtScore.Text.Trim()); } object obj = text; text = string.Concat(new object[] { obj, "update pm_workplan_plansummary set WkpSummary='", this.txtSummPro.Text.Trim(), "',WkpSelfScore='", num2, "',WkpSummaryDate='", DateTime.Now.Date, "',IsValid=1 where wkpid='", new Guid(base.Request.QueryString["wkpid"]), "' end" }); if (new MainPlanAndAction().ExecuteResult(text)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_WorkPlanMange'})"); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('保存失败!');", true); } } if (base.Request.QueryString["Action"] == "edit") { string value2 = this.hdnNums.Value; int num3 = value2.Split(new char[] { '?' }).Length - 1; string text2 = "begin "; SummModel summModel2 = new SummModel(); for (int j = 0; j < num3; j++) { string g = base.Request.Form["txtNormer" + j.ToString()]; summModel2.WkpPercent = base.Request.Form["txtpecent" + j.ToString()]; summModel2.WkpSmContents = base.Request.Form["txtsummer" + j.ToString()]; summModel2.WkpRecordDate = DateTime.Now.Date; summModel2.WkpId = new Guid(base.Request.QueryString["wkpid"].ToString()); string sqlString2 = "select 1 from pm_workplan_weeksummary where wkpdetailsid='" + new Guid(g) + "'"; if (publicDbOpClass.DataTableQuary(sqlString2).Rows.Count > 0) { text2 = text2 + SummModelAcion.getUpdateStr(summModel2, new Guid(g)) + " "; } else { summModel2.WkpDetailsId = new Guid(g); text2 += SummModelAcion.getInertStr(summModel2); } } decimal num4 = 0m; if (!string.IsNullOrEmpty(this.txtScore.Text.Trim())) { num4 = Convert.ToDecimal(this.txtScore.Text.Trim()); } object obj2 = text2; text2 = string.Concat(new object[] { obj2, "update pm_workplan_plansummary set WkpSummary='", this.txtSummPro.Text, "',WkpSelfScore='", num4, "',WkpSummaryDate='", DateTime.Now.Date, "' where wkpid='", base.Request.QueryString["wkpid"].ToString(), "' end" }); if (new MainPlanAndAction().ExecuteResult(text2)) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_WorkPlanMange'})"); this.hdnNums.Value = ""; return; } base.RegisterScript("top.ui.show(保存失败!)"); this.hdnNums.Value = ""; } }