protected void Page_Load(object sender, EventArgs e) { if (Session["jsh"] == null) { Response.Redirect("./SessionTimeOut.aspx?type=top"); } if (!IsPostBack) { str_sql = "select status from t_teacher_list where appNo = '" + Session["appNo"].ToString() + "'"; string str_status; try { str_status = DBFun.ExecuteScalar(str_sql).ToString(); } catch (Exception ee) { Response.Write("<script>alert('" + ee.Message + ",请与管理员联系。" + "');</script>"); CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), ee.Message); return; } str_sql = " select iif(count(*)=0,false,true) From t_dict where flm=10 and bm=1 " + " and date() between cdate(url) and cdate(content) "; hl_1.Enabled = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); if (str_status == "") { } } }
protected void bindData() { string str_sql = " SELECT jsh,xsh,jsm,dept from t_teacher "; if (tbx_spm.Text.Trim() != "") { str_sql += " where ( spm LIKE '%" + tbx_spm.Text.Trim() + "%') " + " or ( jsm LIKE '%" + tbx_spm.Text.Trim() + "%') " + " or ( jsh LIKE '%" + tbx_spm.Text.Trim() + "%') "; } //if (rbl_tj_status.SelectedIndex != 0) // str_sql += " ( isnull(" + rbl_tj_status.SelectedValue + ",'False') = 'False' )"; DataView dv = DBFun.GetDataView(str_sql); GridView1.DataSource = dv; GridView1.DataBind(); Session["dv_detail"] = dv; CommFun.Add_ConfirmAttrib(GridView1, "lbtn_del"); str_sql = "select url from t_dict where flm = 8 and bm = 15 "; if (DBFun.ExecuteScalar(str_sql) == null) { tbx_InitPwd.Text = ""; } else { tbx_InitPwd.Text = DBFun.ExecuteScalar(str_sql).ToString(); } str_sql = "SELECT url,name from t_dict where flm=1 ;"; DBFun.FillDwList(ddlist_dept, str_sql); TD_AddUser.Visible = false; }
public static bool IsAdmin(string str_AdminName) { string str_sql = "select count(*) from master where admin_name = '" + str_AdminName + "'"; bool b_flag = Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) == 1; return(b_flag); }
private void bindData() { //判断专家是否提交,如果已经提交,隐藏提交按钮 str_sql = "select tj_flag from t_ExpertList1 where appyear= year(date()) and LoginName='" + Session["admin_id"].ToString() + "'"; bool tj_flag = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); if (tj_flag) { TD2.Visible = false; GridView1.Columns[5].HeaderText = "评议结果"; } str_sql = " SELECT a.appNo,ktmc,sqr,Status,fs_pjys_sum,mid(a.jsh,5) as jsh,iif(sftj,'是','否') as sflx " + " FROM t_teacher_list a,t_dict b,t_zjry1 c" + " WHERE a.appNo= c.appNo and flm=11 and Status = bm" + " and left(a.appNo,4) = year(date()) " + " and Status = (select url from t_dict where flm= 11 and bm = 4)" + " and zjNo = '" + Session["admin_id"].ToString() + "'" + " order by sqbm , sqr "; ViewState["sql"] = str_sql; dv = DBFun.GetDataView(str_sql); PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.PageSize = AspNetPager1.PageSize; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.DataSource = dv; GridView1.DataSource = pds; GridView1.DataBind(); AspNetPager1.RecordCount = dv.Table.Rows.Count; }
/// <summary> /// 判断人事管理部门是否有权登陆页面,根据是否提交 /// </summary> /// <param name="str_type">人事部门登陆页面类型 zgj 正高级 ej 专业技术二级</param> /// <param name="str_adminid">人事部门ID</param> /// <returns>bool true 不允许登陆 FALSE 允许登陆</returns> public static bool IsTimeOut(string str_type, string str_adminid) { string str_sql = ""; bool b_flag = false; if (str_type == "zgj") { str_sql = "select tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "ej") { str_sql = "select ej_tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "ts") { str_sql = "select ts_tj_flag from t_dict where flm = 2 and url = '" + str_adminid + "'"; } else if (str_type == "lw") { str_sql = "select tj_flag from t_dict where flm = 11 and url = '" + str_adminid + "'"; } else if (str_type == "h") { str_sql = "select h_tj_flag from t_dict where flm = 11 and url = '" + str_adminid + "'"; } else if (str_type == "jy") { str_sql = "select tj_flag from t_dict where flm = 13 and url = '" + str_adminid + "'"; } b_flag = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); return(b_flag); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx';</script>"); return; } if (!IsPostBack) { string str_sql = "select flag from master where admin_name = '" + Session["admin_name"].ToString() + "'"; if ((int)DBFun.ExecuteScalar(str_sql) != 2) { Response.Write("<script>alert('您没有权限访问此页面!');location.href = './main.aspx';</script>"); return; } string str_Groupid = Request.QueryString["Groupid"]; if (str_Groupid == "") { return; } str_sql = "select bm,name,url from t_dict where flm = 4"; DataRow dr = DBFun.GetDataRow(str_sql); if (dr == null) { Response.Write("<script>alert('没有检索到数据!');</script>"); return; } bindData_zj(dr["name"].ToString()); bindData_cpry(dr["url"].ToString()); } }
protected void btn_confirm_Click(object sender, EventArgs e) { string str_sql = ""; if (lbl_editflag.Text == "insert") { str_sql = "SELECT iif(isnull(max(bm)),1,max(bm)+1) AS maxbm FROM t_dict WHERE flm=3"; int i_maxbm = Convert.ToInt16(DBFun.ExecuteScalar(str_sql)); str_sql = string.Format("Insert Into t_dict (flm,bm,name) Values ({0},{1},'{2}')", 3, i_maxbm, tbx_name.Text); } else { str_sql = string.Format("update t_dict set name = '{0}' where flm = 3 and bm = {1}", tbx_name.Text, lbl_id.Text); } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); bindData(); TD_Add.Visible = false; } else { Response.Write("<script>alert('保存失败!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { //Session["sfzh"] = "230103197803220939"; if (Session["sfzh"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');</script>"); Response.Redirect("admin/admin_login.aspx?type=zgcpry"); return; } if (!IsPostBack) { hdn_flag.Value = Request.QueryString["flag"]; if (hdn_flag.Value != "admin") { string str_sql = "select count(*) from cpry where edit_flag = true and sfzh = '" + Session["sfzh"].ToString() + "'"; if (DBFun.ExecuteScalar(str_sql).ToString() == "0") { Response.Write("<script>alert('已经提交,不能再修改!');window.history.go(-1);</script>"); return; } } bindData(); this.lbtn_commit.Attributes.Add("onclick", "return confirm (\"一旦提交就不可以在修改了,确定要提交吗?\");"); } }
protected void btn_ok_Click(object sender, EventArgs e) { string str_status; if (cbx_1.Checked) { str_sql = "select url from t_dict where flm= 11 and bm = 6"; } else { str_sql = "select url from t_dict where flm= 11 and bm = 5"; } str_status = DBFun.ExecuteScalar(str_sql).ToString(); str_sql = string.Format("update t_teacher_list set Status = {0} where xmbh = '{1}'", str_status, Session["xmbh"].ToString()); try { if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); bindData(); } else { Response.Write("<script>alert('保存失败!');</script>"); } } catch (Exception ee) { Response.Write("<script>alert('" + ee.Message + ",请与管理员联系。" + "');</script>"); CommFun.error_record(Session["jsh"].ToString(), Session["jsm"].ToString(), ee.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["dept_id"] == null) { Response.Redirect("../SessionTimeOut.aspx?type=top"); } if (CommFun.IsTimeOut("jy", Session["dept_id"].ToString())) { //Response.Write("<script>alert('您已经提交,不能再访问该页面!');location.href = './main.aspx','_main';</script>"); //return; TD1.Visible = false; btn_Save.Visible = false; } if (!IsPostBack) { bindData(); //this.btn_commit.Attributes.Add("onclick", "return confirm (\"一旦提交就不可以在修改了,确定要提交吗?\");"); } //else //{ // Save(false); //} string strqry = "exec Q_Para_CommitNum_By_sqbm '" + Session["dept_name"].ToString() + "'"; string ls_count = DBFun.ExecuteScalar(strqry).ToString(); this.btn_commit.Attributes.Add("onclick", "return confirm (\"拟推荐课题 " + ls_count + " 项,一旦提交不可修改,确定提交?\");"); }
protected void bindData() { string str_sql = "select * from cpry where gzdw = '" + Session["admin_id"].ToString() + "' order by shijian asc"; DataView dv = DBFun.GetDataView(str_sql); GridView1.DataSource = dv; GridView1.DataBind(); Session["dv_detail"] = dv; LinkButton lbtn; for (int i = 0; i < GridView1.Rows.Count; i++) { lbtn = (LinkButton)GridView1.Rows[i].FindControl("lbtn_del"); lbtn.Attributes.Add("onclick", "return confirm (\"是否删除?\");"); } str_sql = "select InitPwd from t_dict where flm = 2 and url = '" + Session["admin_id"].ToString() + "'"; if (DBFun.ExecuteScalar(str_sql) == null) { tbx_InitPwd.Text = ""; } else { tbx_InitPwd.Text = DBFun.ExecuteScalar(str_sql).ToString(); } }
protected void bindData() { string str_sql = "select * from zjry where flag = 1 and zj_sfzh='" + Session["admin_id"].ToString() + "' and cpry_sfzh='" + lbl_cpry_sfzh.Text + "'"; DataRow dr = DBFun.GetDataRow(str_sql); if (dr == null) { return; } str_sql = "select yourname from cpry where sfzh='" + lbl_cpry_sfzh.Text + "'"; lbl_xm.Text = DBFun.ExecuteScalar(str_sql).ToString(); rbtnlist_1.SelectedValue = dr["fs_pjys1"].ToString(); rbtnlist_2.SelectedValue = dr["fs_pjys2"].ToString(); rbtnlist_3.SelectedValue = dr["fs_pjys3"].ToString(); rbtnlist_4.SelectedValue = dr["fs_pjys4"].ToString(); rbtnlist_5.SelectedValue = dr["fs_pjys5"].ToString(); rbtnlist_6.SelectedValue = dr["fs_pjys6"].ToString(); lbl_sum.Text = dr["fs_pjys_sum"].ToString(); str_sql = "select tj_flag from pszj where flag = 1 and sfzh='" + Session["admin_id"].ToString() + "'"; bool tj_flag = Convert.ToBoolean(DBFun.ExecuteScalar(str_sql)); btn_commit.Visible = !tj_flag; btn_printpreview.Visible = tj_flag; if (tj_flag) { Response.Write("<script>location.href = '../PrintPreview_zhuanjia_psyjb.aspx?sfzh=" + lbl_cpry_sfzh.Text + "',target='_blank';</script>"); } try { rbtnlist_tuijian.SelectedValue = dr["fs_sftj"].ToString(); } catch {} ftb_content.Text = dr["jypj"].ToString(); }
protected void btn_commit_Click(object sender, EventArgs e) { string str_sql = " SELECT count(*) " + " FROM t_teacher_list a,t_zjry1 b" + " WHERE a.appNo = b.appNo" + " AND left(a.appNo,4)= year(date()) " + " and zjNo ='" + Session["admin_id"].ToString() + "'" + " and fs_pjys_sum is null"; if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) > 0) { Response.Write("<script>alert('您还有尚未评分的项目,请对所有项目评分后再提交!');</script>"); return; } str_sql = " update t_ExpertList1 set tj_flag = true " + " where appyear= year(date()) " + " and LoginName = '" + Session["admin_id"].ToString() + "'"; if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('提交成功!');location.replace(location.href);</script>"); } else { Response.Write("<script>alert('提交失败!');</script>"); return; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Redirect("../SessionTimeOut.aspx?type=top"); } if (!CommFun.IsAdmin(Session["admin_name"].ToString())) { Response.Redirect("../SessionTimeOut.aspx?type=isnotadmin"); } if (!IsPostBack) { Calc_fs(); str_sql = "SELECT name,name from t_dict where flm=3 ;"; DBFun.FillDwList(ddlist_cGroup, str_sql); ddlist_cGroup.Items.Insert(0, "全部"); str_sql = "SELECT url,name from t_dict where flm=11 ;"; DBFun.FillDwList(ddlist_xmzt0, str_sql); ddlist_xmzt0.Items.Insert(0, "全部"); str_sql = "select content from t_dict where flm = 14 and bm =3"; str_sql = DBFun.ExecuteScalar(str_sql).ToString(); DBFun.FillDwList(ddlist_year, str_sql); //读取PageSize信息 AspNetPager1.PageSize = Convert.ToInt16(ConfigurationManager.AppSettings.Get("PageSize")); bindData(); } }
//汇总的表格要有项目编号、负责人、项目名称、研究周期、批复金额、余额 //批量导出,单个导出 #region 导出到Excel protected void Exp2Excel_Click(object sender, EventArgs e) { //str_sql = "exec Q_Lxjg "; str_sql = "select content from t_dict where flm= 14 and bm = 1"; str_sql = DBFun.ExecuteScalar(str_sql).ToString(); ExcelManager.Exp2Excel(this.Page, str_sql); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_name"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx';</script>"); return; } if (!IsPostBack) { string str_sql = "select flag from master where admin_name = '" + Session["admin_name"].ToString() + "'"; if ((int)DBFun.ExecuteScalar(str_sql) != 2) { Response.Write("<script>alert('您没有权限访问此页面!');location.href = './main.aspx';</script>"); return; } str_sql = "select bm,name from t_dict where flm = 1"; DBFun.FillDwList(dw_group, str_sql); bindData(); this.GridView1.Columns[8].Visible = false; this.GridView1.Columns[7].Visible = false; this.GridView1.Columns[this.GridView1.Columns.Count - 4].Visible = false; this.GridView1.Columns[this.GridView1.Columns.Count - 2].Visible = false; this.GridView1.AllowSorting = false; this.GridView1.AllowPaging = false; this.GridView1.SelectedIndex = -1; } }
protected void btn_Save_Click(object sender, EventArgs e) { string str_appNo, str_tjjg; str_sql = ViewState["sql"].ToString(); dv = DBFun.GetDataView(str_sql); RadioButtonList rbtnList_1; for (int i = 0; i < GridView1.Rows.Count; i++) //循环GridView每一行 { str_appNo = dv.Table.Rows[i + (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize]["appNo"].ToString(); rbtnList_1 = (RadioButtonList)this.GridView1.Rows[i].FindControl("rbtnList_tjjg"); str_tjjg = rbtnList_1.SelectedValue; str_sql = "select url from t_dict where flm= 11 and bm = " + str_tjjg; str_sql = DBFun.ExecuteScalar(str_sql).ToString(); str_sql = "update t_teacher_list set Status = " + str_sql + " where appNo = '" + str_appNo + "'"; if (!DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存失败!');</script>"); return; } } Response.Write("<script>alert('保存成功!');</script>"); bindData(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_id"] == null) { Response.Write("<script>alert('页面失效,请您重新登录!');location.href = './admin_login.aspx?type=renshi';</script>"); return; } if (CommFun.IsTimeOut("zgj", Session["admin_id"].ToString())) { Response.Write("<script>alert('您已经提交,不能再访问该页面!');location.href = './main.aspx','_main';</script>"); return; } if (!IsPostBack) { bindData(); //this.btn_commit.Attributes.Add("onclick", "return confirm (\"一旦提交就不可以在修改了,确定要提交吗?\");"); } else { Save(false); } string strqry = "SELECT count(*) FROM cpry WHERE gzdw = '" + Session["admin_id"].ToString() + "' and edit_flag = false and iif(isnull(tj_flag),'未审核',tj_flag) = '推荐' "; string ls_count = DBFun.ExecuteScalar(strqry).ToString(); this.btn_commit.Attributes.Add("onclick", "return confirm (\"拟向中国地震局拟推荐参评人员 " + ls_count + " 位,一旦提交不可修改,确定提交?\");"); }
protected void lbtn_commit_Click(object sender, EventArgs e) { Save(); string str_sql = string.Format("update cpry set edit_flag = {0} where sfzh = '{1}'", false, Session["sfzh"].ToString()); //if (Hidden1.Value == "admin") //{ // str_sql = string.Format("update cpry set sh_flag = '{0}' where sfzh = '{1}'", // rbtnlist_sh.SelectedValue, Session["sfzh"].ToString()); //} if (DBFun.ExecuteUpdate(str_sql)) { str_sql = "select sbzw from cpry where sfzh='" + Session["sfzh"].ToString() + "'"; string str_sbzw = DBFun.ExecuteScalar(str_sql).ToString(); if (str_sbzw == "研究员") { str_sbzw = "PrintPreview_yjy.aspx"; } else { str_sbzw = "PrintPreview_zyjgg.aspx"; } Response.Write("<script>alert('提交成功!');location.href = '" + str_sbzw + "';</script>"); } else { Response.Write("<script>alert('提交失败!');</script>"); } }
protected void btn_confirm_Click(object sender, EventArgs e) { string str_sql = "select InitPwd from t_dict where flm = 2 and url = '" + Session["admin_id"].ToString() + "'"; if (DBFun.ExecuteScalar(str_sql) == null) { tbx_InitPwd.Text = ""; } else { tbx_InitPwd.Text = DBFun.ExecuteScalar(str_sql).ToString(); } string str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_csmm.Text, "MD5"); if (cbx_InitPwd.Checked) { str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_InitPwd.Text, "MD5"); } //新增 if (lbl_editflag.Text == "insert") { //判断身份证号是否重复 str_sql = "select count(*) from ej_cpry where sfzh = '" + tbx_sfzh.Text + "'"; if (DBFun.ExecuteScalar(str_sql).ToString() == "1") { Response.Write(@"<script>alert('一个身份证号只能注册一次,该身份证号已经注册过了!');</script>"); return; } str_sql = string.Format("insert into ej_cpry (yourname, pwd, sfzh,tj_flag,dw) values ( '{0}', '{1}', '{2}','{3}','{4}')", tbx_username.Text.Trim(), str_pwd, tbx_sfzh.Text.Trim(), "未审核", Session["admin_id"].ToString()); } //修改密码 else { //判断密码是否为空 if (tbx_csmm.Text == null || tbx_csmm.Text == "" || tbx_qrmm.Text == null || tbx_qrmm.Text == "") { Response.Write(@"<script>alert('密码不能为空!');</script>"); return; } else { str_sql = string.Format("update ej_cpry set pwd = '{0}' where sfzh = '{1}'", str_pwd, tbx_sfzh.Text); } } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('用户信息保存成功!');</script>"); bindData(); //TD_AddUser.Visible = false; } else { Response.Write("<script>alert('用户信息保存失败!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string str_id = Request.QueryString["id"]; string str_sql = "select content from news where id =" + str_id; ltl_content.Text = DBFun.ExecuteScalar(str_sql).ToString(); } }
protected void btn_confirm_Click(object sender, EventArgs e) { string str_pwd = tbx_pwd_new.Text.Trim(); string str_sql = ""; if (tbx_sfzh.Text == "") { Response.Write("<script>alert('身份证号不能为空!');</script>"); return; } if (lbl_editflag.Text == "insert") { if (tbx_sfzh.Text.Length == 18) { str_pwd = tbx_sfzh.Text.Substring(8, 6); } else { str_pwd = tbx_sfzh.Text.Substring(6, 6); } str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str_pwd, "MD5"); str_sql = "select count(*) from t_pszj where appyear=year(date()) and sfzh = '" + tbx_sfzh.Text.Trim() + "'"; if (DBFun.ExecuteScalar(str_sql).ToString() == "1") { Response.Write("<script>alert('身份证号已存在,请确认输入的身份证号是否正确!');</script>"); return; } str_sql = string.Format("Insert Into t_pszj (zjdm,Username,sfzh,pwd,xingbie,gzdw,zc,phone) Values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", tbx_admin_name.Text.Trim(), tbx_user_name.Text.Trim(), tbx_sfzh.Text, str_pwd, rbtnlist_xb.SelectedValue, tbx_gzdw.Text, tbx_zc.Text, ""); } else { if (str_pwd == null || str_pwd == "") { str_sql = string.Format("update t_pszj set loginname = '{0}',Username = '******',xingbie = '{2}',gzdw = '{3}',zc = '{4}',phone = '{5}'", tbx_admin_name.Text.Trim(), tbx_user_name.Text.Trim(), rbtnlist_xb.SelectedValue, tbx_gzdw.Text, tbx_zc.Text, ""); } else { str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_pwd_new.Text, "MD5"); str_sql = string.Format("update t_pszj set loginname = '{0}',Username = '******',pwd = '{2}',xingbie = '{3}',gzdw = '{4}',zc = '{5}',phone = '{6}'", tbx_admin_name.Text.Trim(), tbx_user_name.Text.Trim(), str_pwd, rbtnlist_xb.SelectedValue, tbx_gzdw.Text, tbx_zc.Text, ""); } str_sql = str_sql + " where appyear=year(date()) and sfzh = '" + lbl_id.Text + "'"; } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('用户信息保存成功!');</script>"); bindData(); TD_AddUser.Visible = false; } else { Response.Write("<script>alert('用户信息保存失败!');</script>"); } }
protected void gv_RowDeleting(object sender, GridViewDeleteEventArgs e) { //如果未提交,可以删除;如果已经提交,则不执行删除命令 str_sql = "select Status from t_teacher_list where appNo = '" + Session["appNo"].ToString() + "'"; if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) == 1) { GridViewDeleteRow(e.RowIndex); } }
protected void btn_Ok_Click(object sender, EventArgs e) { string str_sql = "", str_name, str_OldPwd, str_NewPwd, str_Pwd; //取得现有信息 str_name = lbl_ID.Text; str_OldPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tb_UserPwd.Text, "MD5"); str_NewPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tb_NewPwd.Text, "MD5"); //判断要修改密码的是管理员、人事管理部门、专家 if (lbl_type.Text == "admin") { str_sql = "Select admin_pwd From master Where id = " + str_name; } else if (lbl_type.Text == "jyrs") { str_sql = "Select pwd From t_dict Where flm = 13 and url = '" + str_name + "'"; } //else if (lbl_type.Text == "jyzj") // str_sql = "Select pwd From pszj Where flag = 1 and sfzh = '" + str_name + "'"; else if (lbl_type.Text == "jycpry") { str_sql = "Select pwd From t_teacher Where jsh = '" + str_name + "'"; } str_Pwd = DBFun.ExecuteScalar(str_sql).ToString(); if (str_Pwd.ToUpper() != str_OldPwd) { Response.Write("<script>alert('原始密码错误!');</script>"); SetFocus(tb_UserPwd); return; } if (lbl_type.Text == "admin") { str_sql = "Update master Set admin_pwd = '" + str_NewPwd + "' Where id = " + str_name; } else if (lbl_type.Text == "jyrs") { str_sql = "Update t_dict Set pwd = '" + str_NewPwd + "' Where flm = 13 and url = '" + str_name + "';"; } //else if (lbl_type.Text == "jyzj") // str_sql = "Update pszj Set pwd = '" + str_NewPwd + "' Where flag = 1 and sfzh = '" + str_name + "';"; //else if (lbl_type.Text == "ejzj") // str_sql = "Update pszj Set pwd = '" + str_NewPwd + "' Where flag = 2 and sfzh = '" + str_name + "';"; else if (lbl_type.Text == "jycpry") { str_sql = "Update t_teacher Set pwd = '" + str_NewPwd + "' Where jsh = '" + str_name + "';"; } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('密码修改成功!');</script>"); } else { Response.Write("<script>alert('密码修改失败!');</script>"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { TD1.Visible = true; DataView dv = (DataView)Session["dv_detail"]; string str_sfzh = dv.Table.Rows[e.RowIndex + GridView1.PageIndex * GridView1.PageSize]["sfzh"].ToString(); Session["sfzh"] = str_sfzh; string strqry = "select pingjia from cpry where sfzh = '" + str_sfzh + "'"; TextBox1.Text = DBFun.ExecuteScalar(strqry).ToString(); }
/// <summary> /// 判断SQL语句的行数JudgeRowCount /// </summary> /// <param name="str_sql">判断行数的SQL语句</param> /// <param name="MaxRowCount">最大行数</param> /// <returns>FALSE 没有超过最大行数 TRUE 超过了最大行数</returns> #region 判断SQL语句的行数 public static bool JudgeRowCount(string str_sql, int MaxRowCount) { if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) >= MaxRowCount) { return(true); } else { return(false); } }
protected void lbtn_next_Click(object sender, EventArgs e) { string str_sql = string.Format("select edit_flag From cpry where sfzh='{0}'", Session["sfzh"].ToString()); if (DBFun.ExecuteScalar(str_sql).ToString().ToLower() == "false") { Response.Write(@"<script>alert('信息已提交,不能修改!');</script>"); return; } Response.Redirect("zgsb_1.aspx"); }
//计算项目情况得分 protected decimal GetScore_xmrw(int i_ktly1, string str_ktjb, string str_drjs) { decimal dec_Score = 0; string str_sql = ""; string str_ly1 = "", str_ly2 = ""; if (i_ktly1 >= 3 && i_ktly1 <= 9 || i_ktly1 > 110 && i_ktly1 < 120) { str_ly1 = "国家级"; str_ly2 = "重大项目"; } else if (i_ktly1 >= 11 && i_ktly1 <= 15 || i_ktly1 > 120 && i_ktly1 < 130) { str_ly1 = "国家级"; str_ly2 = "重点项目"; } else if (i_ktly1 >= 17 && i_ktly1 <= 23 || i_ktly1 > 130 && i_ktly1 < 140) { str_ly1 = "国家级"; str_ly2 = "面上项目"; } else if (i_ktly1 >= 26 && i_ktly1 <= 29 || i_ktly1 > 210 && i_ktly1 < 220) { str_ly1 = "省部级"; str_ly2 = "重点项目"; } else if (i_ktly1 >= 31 && i_ktly1 <= 34 || i_ktly1 > 220 && i_ktly1 < 230) { str_ly1 = "省部级"; str_ly2 = "面上项目"; } else if (i_ktly1 >= 37 && i_ktly1 <= 38 || i_ktly1 > 310 && i_ktly1 < 320) { str_ly1 = "厅局级"; str_ly2 = "重点项目"; } else if (i_ktly1 >= 40 && i_ktly1 <= 42 || i_ktly1 >= 320 && i_ktly1 < 330) { str_ly1 = "厅局级"; str_ly2 = "面上项目"; } if (str_drjs == "主要参加者") { str_sql = "select pwd from t_dict where name = '" + str_ly1 + "' and url = '" + str_ly2 + "' and content = '" + str_drjs + "' and initpwd = '参加'"; } else { str_sql = "select pwd from t_dict where name = '" + str_ly1 + "' and url = '" + str_ly2 + "' and content = '" + str_drjs + "' and initpwd = '" + str_ktjb + "'"; } dec_Score = Convert.ToDecimal(DBFun.ExecuteScalar(str_sql)); return(dec_Score); }
protected void Save() { DropDownList ddlist_pjys; for (int i = 1; i <= 6; i++) { ddlist_pjys = (DropDownList)this.FindControl("ddlist_" + i.ToString()); if (Convert.ToInt16(ddlist_pjys.SelectedValue) == 0) { Response.Write("<script>alert('第 " + i.ToString() + " 项数据没有选择!');</script>"); return; } ddlist_pjys.Focus(); } if (rbtnList_1.SelectedValue == null || rbtnList_1.SelectedValue == "") { Response.Write("<script>alert('请选择是否推荐申请人!');</script>"); return; } string str_sql = "SELECT count(*) from zjry where sfzh = '" + Session["sfzh"].ToString() + "' and zjid = " + Session["zjid"].ToString(); string ls_jypj = ftb_jypj.Text.Replace("'", "’"); if (DBFun.ExecuteScalar(str_sql).ToString() == "1") { str_sql = string.Format("update zjry set fs_pjys1 = '{0}',fs_pjys2 = '{1}',fs_pjys3 = '{2}'," + "fs_pjys4 = '{3}',fs_pjys5 = '{4}',fs_pjys6 = '{5}',fs_pjys_sum = '{6}',fs_sftj = '{7}',jypj = '{8}'," + "psrq = '{9}' where zjid = {10} and sfzh = '{11}'", ddlist_1.SelectedValue, ddlist_2.SelectedValue, ddlist_3.SelectedValue, ddlist_4.SelectedValue, ddlist_5.SelectedValue, ddlist_6.SelectedValue, lbl_sum.Text, rbtnList_1.SelectedValue, ls_jypj, DateTime.Now.ToString("yyyy年MM月dd日"), Convert.ToInt16(Session["zjid"]), Session["sfzh"].ToString()); } else { str_sql = string.Format("insert into zjry (zjid,sfzh,fs_pjys1,fs_pjys2,fs_pjys3,fs_pjys4,fs_pjys5,fs_pjys6," + "fs_pjys_sum,fs_sftj,jypj,psrq) values ({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')", Convert.ToInt16(Session["zjid"]), Session["sfzh"].ToString(), ddlist_1.SelectedValue, ddlist_2.SelectedValue, ddlist_3.SelectedValue, ddlist_4.SelectedValue, ddlist_5.SelectedValue, ddlist_6.SelectedValue, lbl_sum.Text, rbtnList_1.SelectedValue, ls_jypj, DateTime.Now.ToString("yyyy年MM月dd日")); } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('保存成功!');</script>"); } else { Response.Write("<script>alert('保存失败!');</script>"); return; } bindData(); }
protected void btn_confirm_Click(object sender, EventArgs e) { string str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_pwd_new.Text, "MD5"); string str_sql = ""; string str_sftj = Convert.ToString((rbtnlist_sftj.SelectedValue == "已提交")); string str_flm = ""; string str_flag = ""; str_flm = "13"; str_flag = "tj_flag"; if (lbl_editflag.Text == "insert") { str_sql = "SELECT count(*) FROM t_dict WHERE flm = " + str_flm + " and url = '" + tbx_bm.Text + "'"; if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) > 0) { Response.Write("<script>alert('单位编码已存在!');</script>"); tbx_bm.Focus(); return; } str_sql = " SELECT iif(isnull(max(bm)),1,max(bm)+1) AS maxbm" + " FROM t_dict" + " WHERE flm = " + str_flm + ";"; int i_maxbm = Convert.ToInt16(DBFun.ExecuteScalar(str_sql)); str_sql = string.Format("Insert Into t_dict (flm,bm,name,url,pwd," + str_flag + ") Values ({0},{1},'{2}','{3}','{4}',{5})", str_flm, i_maxbm, tbx_dwmc.Text, tbx_bm.Text, str_pwd, str_sftj); } else { if (tbx_pwd_new.Text == null || tbx_pwd_new.Text == "") { str_sql = string.Format("update t_dict set name = '{0}',url = '{1}'," + str_flag + " = {2}", tbx_dwmc.Text.Trim(), tbx_bm.Text.Trim(), str_sftj); } else { str_sql = string.Format("update t_dict set name = '{0}',url = '{1}'," + str_flag + " = {2},pwd = '{3}'", tbx_dwmc.Text.Trim(), tbx_bm.Text.Trim(), str_sftj, str_pwd); } str_sql = str_sql + " where flm = " + str_flm + " and bm = " + lbl_id.Text; } if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('部门信息保存成功!');</script>"); bindData(); TD_AddUser.Visible = false; } else { Response.Write("<script>alert('部门信息保存失败!');</script>"); } }