protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { if (this.Request.QueryString["roleid"] != null) { this.txtroleid.Value = this.Request.QueryString["roleid"].ToString(); //得到已授权的用户 //得到该权限下边已经配置的人员 HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(this.txtroleid.Value); if (dtjudeg.Rows.Count > 0) { for (var i = 0; i < dtjudeg.Rows.Count; i++) { if(lblusernames_ysq.Text=="") lblusernames_ysq.Text += getusernamebyuserid(dtjudeg.Rows[i]["hy_userid"].ToString()); else lblusernames_ysq.Text += "," + getusernamebyuserid(dtjudeg.Rows[i]["hy_userid"].ToString()); } } } } }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); ////---增加模块权限------- if (this.fdAddRoleid.Value != "") { string[] v_AddRoleid = this.fdAddRoleid.Value.Split(','); for (var i = 0; i < v_AddRoleid.Length; i++) { Hyoa_roleuser.ID = Hyoa_global.GetRandom(); Hyoa_roleuser.hy_roleid = v_AddRoleid[i].ToString(); Hyoa_roleuser.hy_userid = this.txtuserid.Value; Hyoa_roleuser.Insert(); } } ////---删除模块权限------- if (this.fdDelRoleid.Value != "") { string[] v_DelRoleid = this.fdDelRoleid.Value.Split(','); for (var i = 0; i < v_DelRoleid.Length; i++) { Hyoa_roleuser.Deletebyroleidanduserid(v_DelRoleid[i].ToString(), this.txtuserid.Value); } } HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); ////---增加流程权限------- if (this.fdAddFlowTacheid.Value != "") { string[] v_AddFlowTacheid = this.fdAddFlowTacheid.Value.Split(','); for (var i = 0; i < v_AddFlowTacheid.Length; i++) { Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); Hyoa_flowtacheuser.hy_flowid = v_AddFlowTacheid[i].ToString().Substring(0,v_AddFlowTacheid[i].ToString().IndexOf('^')); Hyoa_flowtacheuser.hy_tacheid = v_AddFlowTacheid[i].ToString().Substring(v_AddFlowTacheid[i].ToString().IndexOf('^')+1, (v_AddFlowTacheid[i].ToString().Length - v_AddFlowTacheid[i].ToString().IndexOf('^')-1)); Hyoa_flowtacheuser.hy_userid = this.txtuserid.Value; Hyoa_flowtacheuser.Insert(); } } //---删除流程权限------- if (this.fdDelFlowTacheid.Value != "") { string[] v_DelFlowTacheid = this.fdDelFlowTacheid.Value.Split(','); string ls_flowid; string ls_tacheid; for (var i = 0; i < v_DelFlowTacheid.Length; i++) { ls_flowid = v_DelFlowTacheid[i].ToString().Substring(0, v_DelFlowTacheid[i].ToString().IndexOf('^')); ls_tacheid = v_DelFlowTacheid[i].ToString().Substring(v_DelFlowTacheid[i].ToString().IndexOf('^') + 1, (v_DelFlowTacheid[i].ToString().Length - v_DelFlowTacheid[i].ToString().IndexOf('^') - 1)); Hyoa_flowtacheuser.Deletebyroleidtacheiduserid(ls_flowid, ls_tacheid, this.txtuserid.Value); } } Response.Write("<script>alert('保存成功!');self.close();</script>"); }
protected void btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); String[] v_uids = this.txtuids.Value.Split(','); for (int i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { //先删除权限下边对应的人员 Hyoa_roleuser.DeleteAllbyroleid(v_uids[i]); Hyoa_role.hy_roleid = v_uids[i]; Hyoa_role.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { //先删除当前权限ID下边所有的用户 HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); Hyoa_roleuser.DeleteAllbyroleid(this.txtroleid.Value); //添加选中的用户 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); string[] v_uids = this.txtuserids.Value.Split('+'); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { Hyoa_roleuser.ID = Hyoa_global.GetRandom(); Hyoa_roleuser.hy_roleid = this.txtroleid.Value; Hyoa_roleuser.hy_userid = v_uids[i]; Hyoa_roleuser.Insert(); } } Response.Write("<script>alert('保存成功!');self.close();</script>"); }
//判断是否有权限操作(ROLE中判断) //返回值:0(无权限)1(有权限) //如果模块未设置权限,则所有人有权限(个人通讯录等模块) private string Hy_IfHaveRole(string mudelid, string userid) { string ls_return = "0"; //根据模块ID得到ROLEID HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dt_mudel = Hyoa_mudel.Getmudel(mudelid); string ls_roleid = ""; if (dt_mudel.Rows.Count > 0) { if (dt_mudel.Rows[0]["hy_roleid"].ToString() == "") { //所有人开放权限 ls_return = "1"; } else { ls_roleid = dt_mudel.Rows[0]["hy_roleid"].ToString(); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); ls_return = Hyoa_roleuser.GetIfHaveRoleByroleidanduserid(ls_roleid, userid); } } return ls_return; }
//模块权限列表 protected string fRoleNames() { string ls_return = ""; string ls_userid = ""; string ls_roleids = ""; if(this.Request.QueryString["userid"]!=null) { ls_userid = this.Request.QueryString["userid"].ToString(); //得到已有的模块权限 HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); DataTable dtroleuser = Hyoa_roleuser.Getrolesbyuserid(ls_userid); if (dtroleuser.Rows.Count > 0) { for (var i = 0; i < dtroleuser.Rows.Count; i++) { ls_roleids += "," + dtroleuser.Rows[i]["hy_roleid"].ToString(); } this.fdHaveRoleid.Value = ls_roleids + ","; } //加载 HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); DataTable dt = Hyoa_role.Getroles(); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { if (ls_roleids == "") { ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>"; } else { if (ls_roleids.Contains(dt.Rows[i]["hy_roleid"].ToString())) { ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" checked=\"checked\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>"; } else { ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>"; } } if (((i + 1) % 4) == 0 && i < dt.Rows.Count) ls_return += "</tr><tr style=\"border-bottom:1px\">"; } } dtroleuser.Clear(); dt.Clear(); } return ls_return; }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_jiaose Hyoa_jiaose = new HyoaClass.Hyoa_jiaose(); string lsrnd = ""; if (this.txtop.Value == "add") { lsrnd = Hyoa_global.GetRandom(); Hyoa_jiaose.id = lsrnd; Hyoa_jiaose.hy_jsname = this.txthy_jsname.Text; Hyoa_jiaose.hy_roleids = this.txthy_roleids.Text; Hyoa_jiaose.hy_rolenames = this.txthy_rolenames.Text; Hyoa_jiaose.hy_flowtacheids = this.txthy_flowtacheids.Text; Hyoa_jiaose.hy_flowtachenames = this.txthy_flowtachenames.Text; Hyoa_jiaose.hy_sort = float.Parse(this.txthy_sort.Text); Hyoa_jiaose.hy_bz = this.txthy_bz.Text; Hyoa_jiaose.Insert(); } else { Hyoa_jiaose.id = this.txtdocid.Value; Hyoa_jiaose.hy_jsname = this.txthy_jsname.Text; Hyoa_jiaose.hy_roleids = this.txthy_roleids.Text; Hyoa_jiaose.hy_rolenames = this.txthy_rolenames.Text; Hyoa_jiaose.hy_flowtacheids = this.txthy_flowtacheids.Text; Hyoa_jiaose.hy_flowtachenames = this.txthy_flowtachenames.Text; Hyoa_jiaose.hy_sort = float.Parse(this.txthy_sort.Text); Hyoa_jiaose.hy_bz = this.txthy_bz.Text; Hyoa_jiaose.Update(); //更新对应的ROLE //先找出该角色对应的人 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); DataTable dt = Hyoa_user.Getusersbyjiaoseid(this.txtdocid.Value); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); //for (int i = 0; i < dt.Rows.Count; i++) //{ // //将人员+老roleid的先删除 // string[] lv_roleid; // lv_roleid = this.txthy_roleids2.Text.Split(','); // for (int j = 0; j < lv_roleid.Length; j++) // { // if (lv_roleid[j] != "") // { // Hyoa_roleuser.Deletebyroleidanduserid(lv_roleid[j], dt.Rows[i]["hy_userid"].ToString()); // } // } // //将人员+新roleid的插入 // string[] lv_roleidnew; // lv_roleidnew = this.txthy_roleids.Text.Split(','); // for (int j = 0; j < lv_roleidnew.Length; j++) // { // if (lv_roleidnew[j] != "") // { // Hyoa_roleuser.ID = Hyoa_global.GetRandom(); // Hyoa_roleuser.hy_roleid = lv_roleidnew[j]; // Hyoa_roleuser.hy_userid = dt.Rows[i]["hy_userid"].ToString(); // Hyoa_roleuser.Insert(); // } // } //} ////更新对应的flowtache ////先找出该角色对应的人 //HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); //for (int i = 0; i < dt.Rows.Count; i++) //{ // //将人员+老flowtacheid的先删除 // string[] lv_flowtacheidid; // lv_flowtacheidid = this.txthy_flowtacheids2.Text.Split(','); // for (int j = 0; j < lv_flowtacheidid.Length; j++) // { // if (lv_flowtacheidid[j] != "") // { // string ls_temp = lv_flowtacheidid[j]; // string[] lv_temp = ls_temp.Split('_'); // if (lv_temp.Length == 2) // { // string ls_flowid = lv_temp[0]; // string ls_tacheid = lv_temp[1]; // Hyoa_flowtacheuser.Deletebyroleidtacheiduserid(ls_flowid, ls_tacheid, dt.Rows[i]["hy_userid"].ToString()); // } // } // } // //将人员+新flowtacheid的插入 // string[] lv_flowtacheididnew; // lv_flowtacheididnew = this.txthy_flowtacheids.Text.Split(','); // for (int j = 0; j < lv_flowtacheididnew.Length; j++) // { // if (lv_flowtacheididnew[j] != "") // { // string ls_temp = lv_flowtacheididnew[j]; // string[] lv_temp = ls_temp.Split('_'); // if (lv_temp.Length == 2) // { // string ls_flowid = lv_temp[0]; // string ls_tacheid = lv_temp[1]; // Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); // Hyoa_flowtacheuser.hy_flowid = ls_flowid; // Hyoa_flowtacheuser.hy_tacheid = ls_tacheid; // Hyoa_flowtacheuser.hy_userid = dt.Rows[i]["hy_userid"].ToString(); // Hyoa_flowtacheuser.Insert(); // } // } // } //} } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (this.txtop.Value == "add") { //先判断这个用户是否已经存在 DataTable dtjudge = Hyoa_user.Getuserbyuserid(this.txtuserid.Text); if (dtjudge.Rows.Count > 0) { Response.Write("<script>alert('该用户名已注册,请重新注册!');history.back();</script>"); return; } else { //判断是否超过用户数限制 HyoaClass_conn.Hyoa_nbheyi Hyoa_nbheyi = new HyoaClass_conn.Hyoa_nbheyi(); DataTable dt1 = Hyoa_nbheyi.Getfirstnbheyi(); Int32 li_user1 = 0; if (dt1.Rows.Count > 0) { li_user1 = System.Int32.Parse(dt1.Rows[0]["hy_usernum"].ToString()) + 1; } DataTable dt2 = Hyoa_user.Getusers_jzcw(); Int32 li_user2 = 0; li_user2 = System.Int32.Parse(dt2.Rows.Count.ToString()); if (li_user1 <= li_user2) { //删除最近注册的账号 Response.Write("<script>alert('您的系统注册用户数授权已满,请联系管理员或宁波合益!');</script>"); return; } Hyoa_user.id = Hyoa_global.GetRandom(); Hyoa_user.hy_loginuid = this.txtuserid.Text; Hyoa_user.hy_userid = this.txtuserid.Text; Hyoa_user.hy_deptid = this.hy_deptid.Text; Hyoa_user.hy_username = this.txtusername.Value; Hyoa_user.hy_post = this.txtposition.Value; Hyoa_user.hy_ifleader = this.ddlifleader.SelectedValue.ToString(); Hyoa_user.hy_officetel = this.txtofficetel.Value; Hyoa_user.hy_hometel = this.txthometel.Value; Hyoa_user.hy_mobile = this.txtmobile.Value; Hyoa_user.hy_virtualnumber = this.txtvirtualtel.Value; Hyoa_user.hy_sort = float.Parse(this.txtuserno.Value); Hyoa_user.hy_isenabled = this.ddlisenabled.SelectedValue.ToString(); Hyoa_user.hy_createtime = System.DateTime.Now.ToString(); Hyoa_user.hy_edittime = System.DateTime.Now.ToString(); Hyoa_user.hy_birthday = this.txtbirthday.Value; Hyoa_user.hy_ifsrtx = ""; Hyoa_user.hy_fjh = this.txtfjh.Value; Hyoa_user.hy_xb = this.ddlxb.SelectedValue; Hyoa_user.hy_zzmm = this.txtzzmm.Value; Hyoa_user.hy_xl = this.txtxl.Value; Hyoa_user.hy_byyx = this.txtbyyx.Value; Hyoa_user.hy_jdwsj = this.txtjdwsj.Value; Hyoa_user.hy_jtzz = this.txtjtzz.Value; Hyoa_user.hy_sfzhm = this.txtsfzhm.Value; Hyoa_user.hy_bz = ""; Hyoa_user.hy_jsids = this.txtjsids.Value; Hyoa_user.hy_jsnames = this.txtjsnames.Value; Hyoa_user.hy_field1 = ""; Hyoa_user.hy_field2 = this.ddlhy_field2.SelectedValue.ToString(); Hyoa_user.hy_field3 = ""; Hyoa_user.hy_field4 = ""; Hyoa_user.hy_field5 = ""; Hyoa_user.Insert(); //写新增人员系统日志start HyoaClass.Hyoa_log Hyoa_log = new HyoaClass.Hyoa_log(); Hyoa_log.ID = System.Guid.NewGuid().ToString(); Hyoa_log.hy_createtime = System.DateTime.Now.ToString(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } Hyoa_log.hy_oppip = userip; Hyoa_log.hy_opptype = "新增"; Hyoa_log.hy_oppcontent = "新增用户:" + this.txtusername.Value; Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString(); Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString(); Hyoa_log.Insert(); } } else { Hyoa_user.id = this.txtid.Text; Hyoa_user.hy_loginuid = this.txtuserid.Text; Hyoa_user.hy_userid = this.txtuserid.Text; Hyoa_user.hy_deptid = this.hy_deptid.Text; Hyoa_user.hy_username = this.txtusername.Value; Hyoa_user.hy_post = this.txtposition.Value; Hyoa_user.hy_ifleader = this.ddlifleader.SelectedValue.ToString(); Hyoa_user.hy_officetel = this.txtofficetel.Value; Hyoa_user.hy_hometel = this.txthometel.Value; Hyoa_user.hy_mobile = this.txtmobile.Value; Hyoa_user.hy_virtualnumber = this.txtvirtualtel.Value; Hyoa_user.hy_sort = float.Parse(this.txtuserno.Value); Hyoa_user.hy_isenabled = this.ddlisenabled.SelectedValue.ToString(); Hyoa_user.hy_edittime = System.DateTime.Now.ToString(); Hyoa_user.hy_birthday = this.txtbirthday.Value; Hyoa_user.hy_ifsrtx = ""; Hyoa_user.hy_fjh = this.txtfjh.Value; Hyoa_user.hy_xb = this.ddlxb.SelectedValue; Hyoa_user.hy_zzmm = this.txtzzmm.Value; Hyoa_user.hy_xl = this.txtxl.Value; Hyoa_user.hy_byyx = this.txtbyyx.Value; Hyoa_user.hy_jdwsj = this.txtjdwsj.Value; Hyoa_user.hy_jtzz = this.txtjtzz.Value; Hyoa_user.hy_sfzhm = this.txtsfzhm.Value; Hyoa_user.hy_bz = ""; Hyoa_user.hy_jsids = this.txtjsids.Value; Hyoa_user.hy_jsnames = this.txtjsnames.Value; Hyoa_user.hy_field1 = ""; Hyoa_user.hy_field2 = this.ddlhy_field2.SelectedValue.ToString(); Hyoa_user.hy_field3 = ""; Hyoa_user.hy_field4 = ""; Hyoa_user.hy_field5 = ""; Hyoa_user.Update(); //写新增人员系统日志start HyoaClass.Hyoa_log Hyoa_log = new HyoaClass.Hyoa_log(); Hyoa_log.ID = System.Guid.NewGuid().ToString(); Hyoa_log.hy_createtime = System.DateTime.Now.ToString(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } Hyoa_log.hy_oppip = userip; Hyoa_log.hy_opptype = "修改"; Hyoa_log.hy_oppcontent = "修改用户:" + this.txtusername.Value; Hyoa_log.hy_oppuserid = this.Session["hyuid"].ToString(); Hyoa_log.hy_oppusername = this.Session["hyuname"].ToString(); Hyoa_log.Insert(); } //根据角色分配权限 if (this.txtjsids.Value != this.txtjsids2.Text) { //选择的角色有所变化,则需要更新 HyoaClass.Hyoa_jiaose Hyoa_jiaose = new HyoaClass.Hyoa_jiaose(); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); HyoaClass.Hyoa_flowtacheuser Hyoa_flowtacheuser = new HyoaClass.Hyoa_flowtacheuser(); ///////////////////删除老角色的权限/////////////////////////////////// string[] lv_deljiaoseid = this.txtjsids2.Text.Split(','); if (lv_deljiaoseid.Length > 0) { for (int i = 0; i < lv_deljiaoseid.Length; i++) { if (lv_deljiaoseid[i] != "") { DataTable dt = Hyoa_jiaose.Getdocbyid(lv_deljiaoseid[i]); if (dt.Rows.Count > 0) { //更新对应的ROLE if (dt.Rows[0]["hy_roleids"].ToString() != "") { string[] lv_roleid; lv_roleid = dt.Rows[0]["hy_roleids"].ToString().Split(','); for (int j = 0; j < lv_roleid.Length; j++) { if (lv_roleid[j] != "") { Hyoa_roleuser.Deletebyroleidanduserid(lv_roleid[j], this.txtuserid.Text); } } } //更新对应的flowtache if (dt.Rows[0]["hy_flowtacheids"].ToString() != "") { string[] lv_flowtacheidid; lv_flowtacheidid = dt.Rows[0]["hy_flowtacheids"].ToString().Split(','); for (int j = 0; j < lv_flowtacheidid.Length; j++) { if (lv_flowtacheidid[j] != "") { string ls_temp = lv_flowtacheidid[j]; string[] lv_temp = ls_temp.Split('_'); if (lv_temp.Length == 2) { string ls_flowid = lv_temp[0]; string ls_tacheid = lv_temp[1]; Hyoa_flowtacheuser.Deletebyroleidtacheiduserid(ls_flowid, ls_tacheid, this.txtuserid.Text); } } } } } } } } ///////////////////增加新角色的权限/////////////////////////////////// string[] lv_addjiaoseid = this.txtjsids.Value.Split(','); if (lv_addjiaoseid.Length > 0) { for (int i = 0; i < lv_addjiaoseid.Length; i++) { if (lv_addjiaoseid[i] != "") { DataTable dt = Hyoa_jiaose.Getdocbyid(lv_addjiaoseid[i]); if (dt.Rows.Count > 0) { //更新对应的ROLE if (dt.Rows[0]["hy_roleids"].ToString() != "") { string[] lv_roleid; lv_roleid = dt.Rows[0]["hy_roleids"].ToString().Split(','); for (int j = 0; j < lv_roleid.Length; j++) { if (lv_roleid[j] != "") { Hyoa_roleuser.ID = Hyoa_global.GetRandom(); Hyoa_roleuser.hy_roleid = lv_roleid[j]; Hyoa_roleuser.hy_userid = this.txtuserid.Text; Hyoa_roleuser.Insert(); } } } //更新对应的flowtache if (dt.Rows[0]["hy_flowtacheids"].ToString() != "") { string[] lv_flowtacheidid; lv_flowtacheidid = dt.Rows[0]["hy_flowtacheids"].ToString().Split(','); for (int j = 0; j < lv_flowtacheidid.Length; j++) { if (lv_flowtacheidid[j] != "") { string ls_temp = lv_flowtacheidid[j]; string[] lv_temp = ls_temp.Split('_'); if (lv_temp.Length == 2) { string ls_flowid = lv_temp[0]; string ls_tacheid = lv_temp[1]; Hyoa_flowtacheuser.ID = Hyoa_global.GetRandom(); Hyoa_flowtacheuser.hy_flowid = ls_flowid; Hyoa_flowtacheuser.hy_tacheid = ls_tacheid; Hyoa_flowtacheuser.hy_userid = this.txtuserid.Text; Hyoa_flowtacheuser.Insert(); } } } } } } } } } //处理完成后的提示及跳转 if (this.txtifpop.Value == "") { Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); } else { Response.Write("<script>alert('" + ls_tip + "');self.close();</script>"); } }
private void DataPlay(int PageNo) { //判断当前用户是否有新建删除权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.tdnewdoc.Visible = true; //新建 this.tddeldoc.Visible = true; //删除 } else { this.isrole.Value = "0"; this.tdnewdoc.Visible = false; //新建 this.tddeldoc.Visible = false; //删除 } //得到当前页号 this.curpage.Text = PageNo.ToString(); HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); DataTable dt = new DataTable(); if (this.hy_name.Value != "") { dt = Hyoa_role.Getrolesbyrolename(this.hy_name.Value); } else { dt = Hyoa_role.Getroles(); } DataTable tempTable = dt.Clone(); DataColumn col1 = new DataColumn("hy_roleuser", typeof(String)); //定义新的一列 add原因说明 tempTable.Columns.Add(col1); //追加一列 add for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } //得到该权限下边已经配置的人员 string ls_roleuser = ""; if (dt.Rows[i]["hy_roleid"].ToString() != "") { DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(dt.Rows[i]["hy_roleid"].ToString()); if (dtjudeg.Rows.Count > 0) { for (var ii = 0; ii < dtjudeg.Rows.Count; ii++) { if (ls_roleuser == "") { ls_roleuser = getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString()); } else { ls_roleuser = ls_roleuser + "," + getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString()); } } } } if (ls_roleuser.Length > 50) { ls_roleuser = ls_roleuser.Substring(0, 50) + "..."; } dr["hy_roleuser"] = ls_roleuser; tempTable.Rows.Add(dr); } int TotalRecord = dt.Rows.Count; this.sumts.Text = TotalRecord.ToString(); this.sumts2.Text = TotalRecord.ToString(); this.ShowTotalRecord.Text = TotalRecord.ToString(); //计算及显示总页数 int TotalPage; if (TotalRecord < System.Int32.Parse(PageSize.Text)) { TotalPage = 1; } else { if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0) { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1; } else { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text); } } this.ShowTotalPage.Text = TotalPage.ToString(); this.rptlist.DataSource = tempTable; this.rptlist.DataBind(); dt.Clear(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("/login.aspx"); if (!this.IsPostBack) { string ls_roleid=""; string ls_roleusers=""; HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); if (this.Request.QueryString["roleid"] != null) { ls_roleid = this.Request.QueryString["roleid"].ToString(); //得到该权限下边已经配置的人员 DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(ls_roleid); if (dtjudeg.Rows.Count > 0) { for (var i = 0; i < dtjudeg.Rows.Count; i++) { ls_roleusers += "," + dtjudeg.Rows[i]["hy_userid"].ToString(); } ls_roleusers += ","; } } Response.Write("<HTML><Head><Title>人员列表</Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<link href=\"/hyhtml/ltree/resources/css/css.css\" rel=\"stylesheet\" type=\"text/css\" />"); Response.Write("<link href=\"/hyhtml/ltree/resources/css/lTREE.default.css\" rel=\"stylesheet\" type=\"text/css\" />"); Response.Write("<script language=\"JavaScript\" src=\"/hyhtml/ltree/js/lTREE.js\"></script>"); Response.Write("<SCRIPT language=JavaScript src=\"/hyhtml/tree/xtree.js\"></SCRIPT>"); Response.Write("<SCRIPT language=JavaScript src=\"/hyhtml/tree/OrgSwitchForTree.js\"></SCRIPT>"); Response.Write("<SCRIPT language=JavaScript src=\"/hyhtml/tree/DeptSelection.js\"></SCRIPT>"); Response.Write("</Head>"); Response.Write("<Body topmargin=10 leftmargin=10 vlink=#FFFFFF >"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenu {width:380px;border:0px solid #ccc;margin:3px;padding:3px;}"); Response.Write("BODY{ PADDING-RIGHT:0px; PADDING-LEFT:0px; PADDING-BOTTOM:0px; PADDING-TOP:0px;}"); Response.Write("</style>"); Response.Write("<Form>"); Response.Write("<TABLE width=\"98%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"BORDER-left: #D4D4D4 1px solid;BORDER-right: #D4D4D4 1px solid;BORDER-top: #D4D4D4 1px solid\">"); Response.Write("<TR class=\"treeshow\">"); Response.Write("<td align=\"left\" valign=\"top\" class=\"lTREEMenu lTREENormal\" id=\"lTREEMenu\">"); Response.Write("<dl>"); Response.Write("<dd><input type=\"checkbox\" name=\"SelAll\" value=\"全选\" onclick=\"SelectAll();\" style=\"width:13;\"> <b>人员列表</b>"); Response.Write("<dl>"); //得到第一级部门 HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept(); DataTable dt = Hyoa_dept.GetFirstlevdepts(); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { //判断有子部门 if (Hyoa_dept.isHaveSubDept(dt.Rows[i]["hy_deptid"].ToString())==true) { //存在子部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept"+dt.Rows[i]["hy_deptid"].ToString()+"\" value=\"" + dt.Rows[i]["hy_deptid"].ToString() +"\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); Response.Write(dt.Rows[i]["hy_deptname"].ToString()); Response.Write("<dl>"); //显示子部门以及部门人员 GetNextDept(dt.Rows[i]["hy_deptid"].ToString(), dt.Rows[i]["hy_deptname"].ToString(), i.ToString(), "Dept" + dt.Rows[i]["hy_deptid"].ToString(), ls_roleusers); Response.Write("</dl>"); Response.Write("</dd>"); } else { //不存在子部门 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["hy_deptid"].ToString() + "\" value=\"" + dt.Rows[i]["hy_deptid"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> "); Response.Write(dt.Rows[i]["hy_deptname"].ToString()); Response.Write("<dl>"); //输出当前部门下的人员 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); DataTable dtuser = Hyoa_user.GetUsers(dt.Rows[i]["hy_deptid"].ToString()); if (dtuser.Rows.Count > 0) { for (var j = 0; j < dtuser.Rows.Count; j++) { Response.Write("<dt>"); //判断已选中 if (ls_roleusers.Contains(","+dtuser.Rows[j]["hy_userid"].ToString()+",")) { Response.Write("<input type=\"checkbox\" checked=\"checked\" name=\"Dept" + dt.Rows[i]["hy_deptid"].ToString() + "_subuser" + j.ToString() + "\" value=\""); Response.Write(dtuser.Rows[j]["hy_userid"].ToString() + "\" text=\"" + dtuser.Rows[j]["hy_username"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); Response.Write(dtuser.Rows[j]["hy_username"].ToString()); Response.Write("</dt>"); } else { Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["hy_deptid"].ToString() + "_subuser" + j.ToString() + "\" value=\""); Response.Write(dtuser.Rows[j]["hy_userid"].ToString() + "\" text=\"" + dtuser.Rows[j]["hy_username"].ToString() + "\" align=\"left\" style=\"width:13;\"> "); Response.Write(dtuser.Rows[j]["hy_username"].ToString()); Response.Write("</dt>"); } } } Response.Write("</dl>"); Response.Write("</dd>"); } } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</td>"); Response.Write("</TR>"); Response.Write("</TABLE>"); Response.Write("<script class=\"lJSFDemo\" type=\"text/javascript\"> "); Response.Write(" var lTree = new lTREE();"); Response.Write(" lTree.config({"); Response.Write(" path : \"dl dd\""); Response.Write(" });"); Response.Write(" lTree.tagName({"); Response.Write(" folder : \"DD\","); Response.Write(" file : \"DT\""); Response.Write(" });"); Response.Write(" lTree.className({"); Response.Write(" folderClose : \"folderClose\","); Response.Write(" lastChild : \"lastChild\""); Response.Write(" });"); Response.Write(" lTree.build(\"lTREEMenu\");"); Response.Write(" </script>"); Response.Write("</Form>"); Response.Write("</Body></HTML>"); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { string ls_roleid=""; string ls_roleusers=""; HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser(); if (this.Request.QueryString["roleid"] != null) { ls_roleid = this.Request.QueryString["roleid"].ToString(); //得到该权限下边已经配置的人员 DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(ls_roleid); if (dtjudeg.Rows.Count > 0) { for (var i = 0; i < dtjudeg.Rows.Count; i++) { ls_roleusers += "," + dtjudeg.Rows[i]["hy_userid"].ToString(); } ls_roleusers += ","; } } Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"zh-cn\">"); Response.Write("<Head><Title>人员列表</Title>"); Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"); Response.Write("<meta name=\"generator\" content=\"editplus\" />"); Response.Write("<link type=\"text/css\" rel=\"stylesheet\" href=\"/hyhtml/ltree/resources/css/lTREE.checkbox.css\" />"); Response.Write("<style type=\"text/css\">"); Response.Write("#lTREEMenuDEMO {border:1px solid #ccc;margin:3px;padding:3px;}"); Response.Write("#infoBox {position:absolute;left:450px;top:40px;border:1px solid #ccc;width:400px;padding:0 10px;font-family:\"宋体\",Geneva,Arial,sans-serif;line-height:150%;}"); Response.Write("#debugMSG strong {color:#f00;}"); Response.Write("</style>"); Response.Write("<!--[if IE 6]>"); Response.Write("<script>"); Response.Write("document.execCommand(\"BackgroundImageCache\", false, true);"); Response.Write("</script>"); Response.Write("<![endif]-->"); Response.Write("</Head>"); Response.Write("<body style=\"padding:2px;\">"); //Response.Write("<form>"); Response.Write("<div class=\"lTREEMenu lTREENormal\" id=\"lTREEMenuDEMO\">"); Response.Write("<dl>"); Response.Write("<dl>"); Response.Write("<dd><input type=\"checkbox\" name=\"SelAll\" value=\"全选\" onclick=\"SelectAll();\" style=\"width:13;\"> <b>人员列表</b>"); Response.Write("<dl>"); //得到一级部门 HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept(); DataTable dt = Hyoa_dept.GetFirstlevdepts(); if (dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { //输出一级部门头部 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["hy_deptid"].ToString() + "\" value=\"" + dt.Rows[i]["hy_deptid"].ToString() + "\">"); Response.Write(dt.Rows[i]["hy_deptname"].ToString()); Response.Write("<dl>"); //有下一级部门 if (Hyoa_dept.isHaveSubDept(dt.Rows[i]["hy_deptid"].ToString()) == true) { GetNextDept(dt.Rows[i]["hy_deptid"].ToString(), ls_roleusers); } //输出一级部门的人员 HyoaClass.Hyoa_user Hyoa_user = new HyoaClass.Hyoa_user(); DataTable dtuser = Hyoa_user.GetUsers(dt.Rows[i]["hy_deptid"].ToString()); if (dtuser.Rows.Count > 0) { for (var j = 0; j < dtuser.Rows.Count; j++) { Response.Write("<dt>"); //判断已选中 if (ls_roleusers.Contains("," + dtuser.Rows[j]["hy_userid"].ToString() + ",")) { Response.Write("<input type=\"checkbox\" checked=\"checked\" name=\"User" + dtuser.Rows[j]["hy_userid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["hy_userid"].ToString() + "|" + dtuser.Rows[j]["hy_username"].ToString() + "\" text=\"" + dtuser.Rows[j]["hy_username"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["hy_username"].ToString()); Response.Write("</dt>"); } else { Response.Write("<input type=\"checkbox\" name=\"User" + dtuser.Rows[j]["hy_userid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["hy_userid"].ToString() + "|" + dtuser.Rows[j]["hy_username"].ToString() + "\" text=\"" + dtuser.Rows[j]["hy_username"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["hy_username"].ToString()); Response.Write("</dt>"); } } } //输出一级部门尾部 Response.Write("</dl>"); Response.Write("</dd>"); } } Response.Write("</dl>"); Response.Write("</dd>"); Response.Write("</dl>"); Response.Write("</div>"); Response.Write("<script type=\"text/javascript\" src=\"/hyhtml/ltree/js/lTREE.js\"></script>"); Response.Write("<script class=\"lJSFDemo\" type=\"text/javascript\"> "); Response.Write(" var lTree = new lTREE();"); Response.Write(" lTree.config({"); Response.Write(" path : \"dl dd\""); Response.Write(" });"); Response.Write(" lTree.tagName({"); Response.Write(" folder : \"DD\","); Response.Write(" file : \"DT\""); Response.Write(" });"); Response.Write(" lTree.className({"); Response.Write(" folderClose : \"folderClose\","); Response.Write(" lastChild : \"lastChild\""); Response.Write(" });"); Response.Write("var t=new Date(),timer=[];"); Response.Write("lTree.build(\"lTREEMenuDEMO\");"); Response.Write("timer.push(new Date()-t);"); /************************************** * 给树内所有复选框添加相应事件 * * Start */ Response.Write("function chkAll(){"); Response.Write("var a=this.parentNode.getElementsByTagName(\"input\"),b=this.checked;"); Response.Write("for(var i=0,l=a.length; i<l;i++) {"); Response.Write("a[i].checked=b;"); Response.Write("}"); Response.Write("}"); Response.Write("function chkOne(){"); Response.Write("var a=this,b=this.checked,p=lDOM.$(\"lTREEMenuDEMO\"),pn=null;"); Response.Write("while(a.tagName!=\"DD\" && a!=p) a=a.parentNode;"); Response.Write("pn=a.getElementsByTagName(\"input\");"); Response.Write("if(b){"); Response.Write("for(var i=1,l=pn.length; i<l;i++) {"); Response.Write("if(!pn[i].checked){"); Response.Write("b=false;"); Response.Write("break;"); Response.Write("}"); Response.Write("}"); Response.Write("}"); Response.Write("pn[0].checked=b;"); Response.Write("}"); Response.Write("var arrCHK=lDOM.find(\"dl dd input\",lDOM.$(\"lTREEMenuDEMO\"),{type:\"checkbox\"});"); Response.Write("arrCHK.each(function(s){"); Response.Write("if(s.parentNode.tagName==\"DT\"){"); Response.Write("s.onclick=chkOne;"); Response.Write("} else {"); Response.Write("s.onclick=chkAll;"); Response.Write("}"); Response.Write("});"); Response.Write(" </script>"); //Response.Write("</form>"); Response.Write("</Body></HTML>"); } }