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"); } }
/// <summary> /// 批量导出BY sqltext(设置行数) /// </summary> /// <param name="sqltext"></param> /// <param name="filename"></param> /// <param name="filestandard"></param> /// <param name="row_hang"></param> /// <param name="ifwidth"></param> /// <param name="ifmyownstyle"></param> /// <param name="ifxuhao"></param> public static void exporteasy(string sqltext, string filename, string filestandard, int row_hang, bool ifwidth, bool ifmyownstyle, bool ifxuhao) { System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); exporteasy(dt, filename, filestandard, row_hang, ifwidth, ifmyownstyle, ifxuhao); }