private List <string> checklist() { List <string> list = new List <string>(); string sql = "update OM_SP set "; if (asd.dt.Rows[0]["SPJB"].ToString() == "1") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_JL='" + rblSPR1_JL.SelectedValue + "',SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='y'"; } } } else if (asd.dt.Rows[0]["SPJB"].ToString() == "2") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_JL='" + rblSPR1_JL.SelectedValue + "',SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='1y'"; //邮件提醒 string sprid = ""; string sptitle = ""; string spcontent = ""; sprid = hidSPR2ID.Value.Trim(); sptitle = "年度培训计划审批"; spcontent = "有年度培训计划需要您审批,请登录查看!"; DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(sprid), new List <string>(), new List <string>(), sptitle, spcontent); } } else if (asd.username == asd.dt.Rows[0]["SPR2"].ToString()) { sql += " SPR2_JL='" + rblSPR2_JL.SelectedValue + "',SPR2_SJ='" + lbSPR2_SJ.Text.Trim() + "',SPR2_JY='" + txtSPR2_JY.Text + "',"; if (rblSPR2_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='y'"; } } } else if (asd.dt.Rows[0]["SPJB"].ToString() == "3") { if (asd.username == asd.dt.Rows[0]["SPR1"].ToString()) { sql += " SPR1_JL='" + rblSPR1_JL.SelectedValue + "',SPR1_SJ='" + lbSPR1_SJ.Text.Trim() + "',SPR1_JY='" + txtSPR1_JY.Text + "',"; if (rblSPR1_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='1y'"; //邮件提醒 string sprid = ""; string sptitle = ""; string spcontent = ""; sprid = hidSPR2ID.Value.Trim(); sptitle = "年度培训计划审批"; spcontent = "有年度培训计划需要您审批,请登录查看!"; DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(sprid), new List <string>(), new List <string>(), sptitle, spcontent); } } else if (asd.username == asd.dt.Rows[0]["SPR2"].ToString()) { sql += " SPR2_JL='" + rblSPR2_JL.SelectedValue + "',SPR2_SJ='" + lbSPR2_SJ.Text.Trim() + "',SPR2_JY='" + txtSPR2_JY.Text + "',"; if (rblSPR2_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='2y'"; //邮件提醒 string sprid = ""; string sptitle = ""; string spcontent = ""; sprid = hidSPR3ID.Value.Trim(); sptitle = "年度培训计划审批"; spcontent = "有年度培训计划需要您审批,请登录查看!"; DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(sprid), new List <string>(), new List <string>(), sptitle, spcontent); } } else if (asd.username == asd.dt.Rows[0]["SPR3"].ToString()) { sql += " SPR3_JL='" + rblSPR3_JL.SelectedValue + "',SPR3_SJ='" + lbSPR3_SJ.Text.Trim() + "',SPR3_JY='" + txtSPR3_JY.Text + "',"; if (rblSPR3_JL.SelectedValue == "n") { sql += " SPZT='n'"; } else { sql += " SPZT='y'"; } } } sql += " where SPFATHERID='" + asd.sjid + "'"; list.Add(sql); return(list); }
protected void btnSubmit_onserverclick(object sender, EventArgs e) { if (asd.action == "add" || asd.action == "alter") { string sql1 = "select count(SPID) from OM_SP where SPFATHERID='" + asd.sjid + "' and SPLX='NDPXJH'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql1); if (dt.Rows[0][0].ToString() == "0") { Response.Write("<script>alert('请先点击”保存“再提交审批!!!')</script>"); return; } string sql = "update OM_SP set SPZT='1',SPJB='" + rblSPJB.SelectedValue + "'"; if (rblSPJB.SelectedValue == "1") { if (txtSPR1.Text.Trim() == "") { Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>"); return; } sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'"; } else if (rblSPJB.SelectedValue == "2") { if (txtSPR2.Text.Trim() == "" || txtSPR1.Text.Trim() == "") { Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>"); return; } sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'"; sql += ",SPR2='" + txtSPR2.Text.Trim() + "',SPR2ID='" + hidSPR2ID.Value + "'"; } else if (rblSPJB.SelectedValue == "3") { if (txtSPR2.Text.Trim() == "" || txtSPR1.Text.Trim() == "" || txtSPR3.Text.Trim() == "") { Response.Write("<script>alert('请先选择审批人再提交审批!!!')</script>"); return; } sql += ",SPR1='" + txtSPR1.Text.Trim() + "',SPR1ID='" + hidSPR1ID.Value + "'"; sql += ",SPR2='" + txtSPR2.Text.Trim() + "',SPR2ID='" + hidSPR2ID.Value + "'"; sql += ",SPR3='" + txtSPR3.Text.Trim() + "',SPR3ID='" + hidSPR3ID.Value + "'"; } sql += " where SPFATHERID='" + asd.sjid + "' and SPLX='NDPXJH'"; try { DBCallCommon.ExeSqlText(sql); //邮件提醒 string sprid = ""; string sptitle = ""; string spcontent = ""; sprid = hidSPR1ID.Value.Trim(); sptitle = "年度培训计划审批"; spcontent = "有年度培训计划需要您审批,请登录查看!"; DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(sprid), new List <string>(), new List <string>(), sptitle, spcontent); } catch { Response.Write("<script>alert('提交审批的sql语句出现问题,请与管理员联系!!!')</script>"); return; } Response.Redirect("OM_NDPXJH_GL.aspx"); } }