//保存排序 protected void btnSave_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } JpDepts.Updatedeptsort(id, sortId); } string pageUrl = JpCommon.CombUrlTxt("list_bmxx.aspx", "page={0}&rnd={1}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "保存排序", "批量保存组织排序号", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('保存排序成功!');window.location='" + pageUrl + "';</script>"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); TPortalClass.JpUsers JpUsers = new TPortalClass.JpUsers(); string ls_tip = "删除成功!"; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //判断是否还有子部门,如果有子部门不能删除 DataTable dt_sub = JpDepts.GetSubDepts(id); if (dt_sub.Rows.Count > 0) { ls_tip = "有下一级组织的信息无法删除,请先删除下一级信息!"; } else { //判断部门下边是否存在人员,存在人员也不能删除! DataTable dt_user = JpUsers.GetUsersBydeptid(id); if (dt_user.Rows.Count > 0) { ls_tip = "该组织下还存在用户,无法进行删除!"; } else { JpDepts.deptid = id; JpDepts.Delete(); } } } } string pageUrl = JpCommon.CombUrlTxt("list_bmxx.aspx", "page={0}&rnd={1}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "删除", "批量删除组织记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); JpDepts.deptid = this.txtdeptid.Text; JpDepts.deptname = this.txtdeptname.Text; JpDepts.deptsort = System.Int32.Parse(this.txtdeptsort.Text.ToString()); JpDepts.factdeptid = ""; JpDepts.HeadUnit = ""; JpDepts.SubDept = ""; if (this.txtop.Value == "add") { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "新增", "新增组织记录[id:" + this.txtdeptid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpDepts.Insert(); } else { //写系统日志 TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "修改", "修改组织记录[id:" + this.txtdeptid.Text + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpDepts.Update(); } Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
protected void Page_Load(object sender, EventArgs e) { //if (!this.IsPostBack) //{ if (Session["uid"].ToString() == "") { this.Response.Redirect("login.aspx?url=" + this.Request.RawUrl.ToString()); } else { TPortalClass.JpUsers JpUsers = new TPortalClass.JpUsers(Session["uid"].ToString()); lbluserinfo.Text = JpUsers.uname; if (JpUsers.deptid != "") { TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); DataTable dt = JpDepts.GetDept(JpUsers.deptid); if (dt.Rows.Count > 0) { lbluserinfo.Text += "(" + dt.Rows[0]["deptname"].ToString() + ")"; } } TPortalClass.JpSite JpSite = new TPortalClass.JpSite(); webname.Text = JpSite.SiteName; weburl.Text = JpSite.host; webcompany.Text = "宁波移信"; dbname.Text = JpSite.dbname; versions.Text = JpSite.version; //读取登录信息 TPortalClass.JpLog JpLog = new TPortalClass.JpLog(); DataTable dt_log = JpLog.Getlogs(); if (dt_log.Rows.Count > 0) { litIP.Text = dt_log.Rows[0]["hy_oppip"].ToString(); } if (dt_log.Rows.Count > 1) { litBackIP.Text = dt_log.Rows[1]["hy_oppip"].ToString(); litBackTime.Text = dt_log.Rows[1]["hy_createtime"].ToString(); } } //} }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["id"] != null) { this.txtdeptid.Text = this.Request.QueryString["id"].ToString(); //部门ID } if (this.Request.QueryString["lastid"] != null) { this.txtlastdeptid.Value = this.Request.QueryString["lastid"].ToString(); //上级部门ID } TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); //新文档 if (this.txtop.Value == "add") { this.txtdeptid.Text = JpDepts.GetMaxDeptid(txtlastdeptid.Value); } //旧文档 if (this.txtop.Value == "modify") { DataTable dt = JpDepts.GetDept(this.txtdeptid.Text); if (dt.Rows.Count > 0) { this.txtdeptname.Text = dt.Rows[0]["deptname"].ToString(); this.txtdeptsort.Text = dt.Rows[0]["deptsort"].ToString(); } } }
private void DeptBind() { this.ddldept.Items.Clear(); this.ddldept.Items.Add(new ListItem("--请选择组织--", "")); TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); DataTable dt = JpDepts.GetDepts_tree(); foreach (DataRow dr in dt.Rows) { string Id = dr["deptid"].ToString(); string Title = dr["deptname"].ToString().Trim(); int classLayer = Convert.ToInt32(Id.Length / 3); if (classLayer == 1) { this.ddldept.Items.Add(new ListItem(Title, Id)); } else { string ls_temp = ""; for (int i = 0; i < (classLayer - 1); i++) { ls_temp += "├ "; } ls_temp += Title; this.ddldept.Items.Add(new ListItem(ls_temp, Id)); } } }
//得到下一级部门的信息 private void GetNextDept(string pis_DeptId, string ls_users) { //得到二级部门 TPortalClass.JpDepts Hyoa_dept = new TPortalClass.JpDepts(); DataTable dtdept = Hyoa_dept.GetSubDeptsOrderbysort(pis_DeptId); if (dtdept.Rows.Count > 0) { for (int i = 0; i < dtdept.Rows.Count; i++) { //输出二级部门头部 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dtdept.Rows[i]["deptid"].ToString() + "\" value=\"" + dtdept.Rows[i]["deptid"].ToString() + "\">"); Response.Write(dtdept.Rows[i]["deptname"].ToString()); Response.Write("<dl>"); //有下一级部门 if (Hyoa_dept.isHaveSubDept(dtdept.Rows[i]["deptid"].ToString()) == true) { GetNextDept(dtdept.Rows[i]["deptid"].ToString(), ls_users); } //输出二级部门的人员 TPortalClass.JpUsers Hyoa_user = new TPortalClass.JpUsers(); DataTable dtuser = Hyoa_user.GetUsers(dtdept.Rows[i]["deptid"].ToString()); if (dtuser.Rows.Count > 0) { for (int j = 0; j < dtuser.Rows.Count; j++) { //判断已选中 if (ls_users.Contains("," + dtuser.Rows[j]["uid"].ToString() + ",")) { Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" checked=\"checked\" name=\"User" + dtuser.Rows[j]["uid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["uid"].ToString() + "|" + dtuser.Rows[j]["uname"].ToString() + "\" text=\"" + dtuser.Rows[j]["uname"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["uname"].ToString()); Response.Write("</dt>"); } else { Response.Write("<dt>"); Response.Write("<input type=\"checkbox\" name=\"User" + dtuser.Rows[j]["uid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["uid"].ToString() + "|" + dtuser.Rows[j]["uname"].ToString() + "\" text=\"" + dtuser.Rows[j]["uname"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["uname"].ToString()); Response.Write("</dt>"); } } } //输出二级部门尾部 Response.Write("</dl>"); Response.Write("</dd>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["uid"].ToString() == "") this.Response.Redirect("../login.aspx"); if (!this.IsPostBack) { string ls_roleid=""; string ls_roleusers=""; TPortalClass.JpRoleuser Hyoa_roleuser = new TPortalClass.JpRoleuser(); 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 (int 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>"); //得到一级部门 TPortalClass.JpDepts Hyoa_dept = new TPortalClass.JpDepts(); DataTable dt = Hyoa_dept.GetFirstlevdepts(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //输出一级部门头部 Response.Write("<dd class=\"folderClose\">"); Response.Write("<input type=\"checkbox\" name=\"Dept" + dt.Rows[i]["deptid"].ToString() + "\" value=\"" + dt.Rows[i]["deptid"].ToString() + "\">"); Response.Write(dt.Rows[i]["deptname"].ToString()); Response.Write("<dl>"); //有下一级部门 if (Hyoa_dept.isHaveSubDept(dt.Rows[i]["deptid"].ToString()) == true) { GetNextDept(dt.Rows[i]["deptid"].ToString(), ls_roleusers); } else { //输出一级部门的人员 TPortalClass.JpUsers Hyoa_user = new TPortalClass.JpUsers(); DataTable dtuser = Hyoa_user.GetUsers(dt.Rows[i]["deptid"].ToString()); if (dtuser.Rows.Count > 0) { for (int j = 0; j < dtuser.Rows.Count; j++) { Response.Write("<dt>"); //判断已选中 if (ls_roleusers.Contains("," + dtuser.Rows[j]["uid"].ToString() + ",")) { Response.Write("<input type=\"checkbox\" checked=\"checked\" name=\"User" + dtuser.Rows[j]["uid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["uid"].ToString() + "|" + dtuser.Rows[j]["uname"].ToString() + "\" text=\"" + dtuser.Rows[j]["uname"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["uname"].ToString()); Response.Write("</dt>"); } else { Response.Write("<input type=\"checkbox\" name=\"User" + dtuser.Rows[j]["uid"].ToString() + "_subuser\" value=\""); Response.Write(dtuser.Rows[j]["uid"].ToString() + "|" + dtuser.Rows[j]["uname"].ToString() + "\" text=\"" + dtuser.Rows[j]["uname"].ToString() + "\">"); Response.Write(dtuser.Rows[j]["uname"].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>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["uid"].ToString() == "") { this.Response.Redirect("login.aspx?url=" + this.Request.RawUrl.ToString()); } else { TPortalClass.JpUsers JpUsers = new TPortalClass.JpUsers(Session["uid"].ToString()); DataTable dt = new DataTable(); lbluserinfo.Text = JpUsers.uname; if (JpUsers.deptid != "") { TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); dt = JpDepts.GetDept(JpUsers.deptid); if (dt.Rows.Count > 0) { lbluserinfo.Text += "(" + dt.Rows[0]["deptname"].ToString() + ")"; } } #region 根据权限判断导航显示情况 this.pis_wzfb.Visible = false; this.pis_wztg.Visible = false; this.pis_wzsh.Visible = false; this.pis_yhgl.Visible = false; this.pis_lmgl.Visible = false; this.pis_xtsz.Visible = false; this.pis_plgl.Visible = false; this.pis_gggl.Visible = false; this.pis_hdgl.Visible = false; this.li_adv_tg.Visible = false; this.li_adv_sh.Visible = false; li_activity_tg.Visible = false; li_activity_sh.Visible = false; li_activityusers.Visible = false; pis_wqgl.Visible = false; this.pis_xwgl.Visible = false; pis_ssyz.Visible = false; //文章发布 if (ChkRole("Role0001") == "1") { this.pis_wzfb.Visible = true; } else { if (ChkRole("Role0002") == "1") { ls_gobal1 = "global_channel_tree2"; ls_gobal2 = "global_channel_tree1"; } else { if (ChkRole("Role0003") == "1") { ls_gobal1 = "global_channel_tree3"; ls_gobal3 = "global_channel_tree1"; } } } //文章投稿 if (ChkRole("Role0002") == "1") { this.pis_wztg.Visible = true; } //文章审核 if (ChkRole("Role0003") == "1") { this.pis_wzsh.Visible = true; } //评论管理 if (ChkRole("Role0004") == "1") { this.pis_plgl.Visible = true; } //维权帮办 if (ChkRole("Role0012") == "1") { this.pis_wqgl.Visible = true; } //新闻爆料 if (ChkRole("Role0013") == "1") { this.pis_xwgl.Visible = true; } //新闻爆料 if (ChkRole("Role0014") == "1") { this.pis_ssyz.Visible = true; } //活动管理 if (ChkRole("Role0005") == "1") { this.pis_hdgl.Visible = true; TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), "008")) { li_activity_tg.Visible = true; } if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), "008")) { li_activity_sh.Visible = true; } } //广告管理 if (ChkRole("Role0006") == "1") { this.pis_gggl.Visible = true; TPortalClass.JpRoles JpRoles = new TPortalClass.JpRoles(); if (JpRoles.ifshowcolumn_tg(Session["uid"].ToString(), "007")) { li_adv_tg.Visible = true; } if (JpRoles.ifshowcolumn_sh(Session["uid"].ToString(), "007")) { li_adv_sh.Visible = true; } } //活动报名审核 if (ChkRole("Role0010") == "1") { this.li_activityusers.Visible = true; } //用户管理 if (ChkRole("Role0007") == "1") { this.pis_yhgl.Visible = true; } //栏目管理 if (ChkRole("Role0008") == "1") { this.pis_lmgl.Visible = true; } //系统设置 if (ChkRole("Role0011") == "1") { this.pis_xtsz.Visible = true; } #endregion } }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; //this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.JpDepts JpDepts = new TPortalClass.JpDepts(); DataTable dt = JpDepts.GetDepts_tree(); this.totalCount = dt.Rows.Count; DataTable tempTable = dt.Clone(); for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; 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]; } tempTable.Rows.Add(dr); } rptList.DataSource = tempTable; rptList.DataBind(); //翻页 //string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", // this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string pageUrl = JpCommon.CombUrlTxt("list_bmxx.aspx", "page={0}&rnd={1}", "__id__", "" + System.Guid.NewGuid().ToString() + ""); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }