//左侧导航(一级及以下目录) public string hy_nav() { string hy_nav = ""; if (Request.QueryString["mlid"] != null) { this.ls_mlid = Request.QueryString["mlid"].ToString(); this.ls_mlid_fir = Request.QueryString["mlid"].ToString(); if (this.ls_mlid_fir.Length > 3) { this.ls_mlid_fir = this.ls_mlid_fir.Substring(0, 3); } } HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //得到一级目录 HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.GetFirstmls(); if (dt.Rows.Count > 0) { string ls_flag1 = "0"; //无权限 int j = 0; for (int i = 0; i < dt.Rows.Count; i++) { ls_flag1 = "0"; //输出一级 if (dt.Rows[i]["hy_role"].ToString() == "" || dt.Rows[i]["hy_role"] == null) { ls_flag1 = "1"; //有权限(没有设置role) } else { if (Hyoa_global.isHaveRole(dt.Rows[i]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag1 = "1"; //有权限 } } if (dt.Rows[i]["hy_ifqy"].ToString() != "是") { //未启用,直接赋为无权限 ls_flag1 = "0"; } if (ls_flag1 == "1") { if (this.ls_mlid_fir == "") { this.ls_mlid_fir = dt.Rows[i]["MLID"].ToString(); //如果ls_mlid_fir还是空值则表示URL没有传过来参数,则显示第一个能显示的一级栏目 } if (this.ls_mlid_fir == dt.Rows[i]["MLID"].ToString()) { hy_nav += "<div title=\"<img src=" + dt.Rows[i]["hy_pic"].ToString() + " /> " + dt.Rows[i]["MLName"].ToString() + "\" iconcss=\"menu-icon-model\" class=\"l-scroll\" >"; hy_nav += "<ul id=\"global_channel_tree" + (j + 1).ToString() + "\" style=\"margin-top: 3px;\">"; hy_nav += GetSecMl(dt.Rows[i]["MLID"].ToString()); hy_nav += "</ul>"; hy_nav += "</div>"; j += 1; } } } } return hy_nav; }
//保存 protected void Button_Save_Click(object sender, EventArgs e) { if (this.Session["hyuid"].ToString() == "") this.Response.Redirect("../login.aspx"); string ls_tip = "保存成功!"; //新文档时 HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); if (this.txtop.Value == "add") { Hyoa_ml.MLID = this.lblid.Text; Hyoa_ml.MLName = this.txtname.Value; Hyoa_ml.hy_mudelid = this.ddlmudelid.SelectedValue; Hyoa_ml.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_ml.hy_pic = this.fdPic.Items[this.fdPic.SelectedIndex].Value; Hyoa_ml.hy_link = this.txtlink.Value; Hyoa_ml.hy_target = this.ddltarget.SelectedValue; Hyoa_ml.hy_ifqy = this.ddlisenabled.SelectedValue; Hyoa_ml.hy_listid = this.ddllistid.SelectedValue; if(this.ddlrole.SelectedIndex == 0) Hyoa_ml.hy_role = ""; else Hyoa_ml.hy_role = this.ddlrole.SelectedValue; Hyoa_ml.hy_tableid = this.ddltableid.SelectedValue; Hyoa_ml.Insert(); } else { Hyoa_ml.MLID = this.lblid.Text; Hyoa_ml.MLName = this.txtname.Value; Hyoa_ml.hy_mudelid = this.ddlmudelid.SelectedValue; Hyoa_ml.hy_sort = System.Int32.Parse(this.txtsort.Value); Hyoa_ml.hy_pic = this.fdPic.Items[this.fdPic.SelectedIndex].Value; Hyoa_ml.hy_link = this.txtlink.Value; Hyoa_ml.hy_target = this.ddltarget.SelectedValue; Hyoa_ml.hy_ifqy = this.ddlisenabled.SelectedValue; Hyoa_ml.hy_listid = this.ddllistid.SelectedValue; if (this.ddlrole.SelectedIndex == 0) Hyoa_ml.hy_role = ""; else Hyoa_ml.hy_role = this.ddlrole.SelectedValue; Hyoa_ml.hy_tableid = this.ddltableid.SelectedValue; Hyoa_ml.Update(); } //处理完成后的提示及跳转 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 btndelinfo_Click(object sender, EventArgs e) { HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); String[] v_uids = this.txtuids.Value.Split(','); for (var i = 0; i < v_uids.Length; i++) { if (v_uids[i] != "") { Hyoa_ml.MLID = v_uids[i]; Hyoa_ml.Delete(); } } this.txtuids.Value = ""; //DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
public string hy_nav() { string hy_nav = ""; HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //得到一级目录 HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.GetFirstmls(); if (dt.Rows.Count > 0) { string ls_flag1 = "0"; //无权限 int j = 0; for (int i = 0; i < dt.Rows.Count; i++) { ls_flag1 = "0"; //输出一级 if (dt.Rows[i]["hy_role"].ToString() == "" || dt.Rows[i]["hy_role"] == null) { ls_flag1 = "1"; //有权限(没有设置role) } else { if (Hyoa_global.isHaveRole(dt.Rows[i]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag1 = "1"; //有权限 } } if (dt.Rows[i]["hy_ifqy"].ToString() != "是") { //未启用,直接赋为无权限 ls_flag1 = "0"; } if (ls_flag1 == "1") { hy_nav += "<div id=\"div_" + i.ToString() + "\" title=\"<img src=" + dt.Rows[i]["hy_pic"].ToString() + " /> " + dt.Rows[i]["MLName"].ToString() + "\" iconcss=\"menu-icon-model\" class=\"l-scroll\" >"; hy_nav += "<ul id=\"global_channel_tree" + (j + 1).ToString() + "\" style=\"margin-top: 3px;\">"; hy_nav += GetSecMl(dt.Rows[i]["MLID"].ToString()); hy_nav += "</ul>"; hy_nav += "</div>"; j += 1; } } } return hy_nav; }
//得到默认打开的一级目录和二级目录 public string dkcurmudel() { string ls_retrun = ""; if (this.Request.QueryString["mid"] != null) { //根据模块ID得到二级目录ID string ls_firstmid = ""; string ls_secondmid = ""; HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.Getsecondmlbymudelid(this.Request.QueryString["mid"].ToString()); if (dt.Rows.Count > 0) { ls_secondmid = dt.Rows[0]["MLID"].ToString(); //根据二级目录ID得到一级目录ID ls_firstmid = ls_secondmid.Substring(0, ls_secondmid.Length - 3); } ls_retrun += "var s=document.getElementById('" + ls_firstmid + "');"; ls_retrun += " if(s){s.click();}"; ls_retrun += "var k=document.getElementById('" + ls_secondmid + "');"; ls_retrun += " if(s){k.click();}"; } return ls_retrun; }
private void DataPlay() { //加载一级目录ID、一级目录名称、每个一级目录最大的二级目录 HyoaClass.Hyoa_ml Hyoa_firstml = new HyoaClass.Hyoa_ml(); DataTable dtfirstml = Hyoa_firstml.GetFirstmls(); if (dtfirstml.Rows.Count > 0) { this.ddlfirstmlid.DataSource = dtfirstml; this.ddlfirstmlid.DataTextField = "MLID"; this.ddlfirstmlid.DataValueField = "MLID"; this.ddlfirstmlid.DataBind(); this.ddlfirstmlid.Items.Insert(0, "--请选择--"); this.ddlfirstmlid.SelectedIndex = 0; this.ddlfirstmlname.DataSource = dtfirstml; this.ddlfirstmlname.DataTextField = "MLName"; this.ddlfirstmlname.DataValueField = "MLName"; this.ddlfirstmlname.DataBind(); this.ddlfirstmlname.Items.Insert(0, "--请选择--"); this.ddlfirstmlname.SelectedIndex = 0; //加载每个一级目录最大的二级目录 string ls_id; for (var i = 0; i < dtfirstml.Rows.Count; i++) { ls_id = Hyoa_firstml.GetMaxMLID(dtfirstml.Rows[i]["MLID"].ToString()); this.ddlsecondmlid.Items.Insert(i, ls_id); } this.ddlsecondmlid.Items.Insert(0, "--请选择--"); this.ddlsecondmlid.SelectedIndex = 0; } //加载模块信息 HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel(); DataTable dtmudel = Hyoa_mudel.Getmudels(); if (dtmudel.Rows.Count > 0) { this.ddlmudelid.DataSource = dtmudel; this.ddlmudelid.DataTextField = "hy_mudelname"; this.ddlmudelid.DataValueField = "hy_mudelid"; this.ddlmudelid.DataBind(); this.ddlmudelid.Items.Insert(0, "--请选择--"); this.ddlmudelid.SelectedIndex = 0; } //加载权限 HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); DataTable dtrole = Hyoa_role.Getroles(); if (dtrole.Rows.Count > 0) { this.ddlrole.DataSource = dtrole; this.ddlrole.DataTextField = "hy_rolename"; this.ddlrole.DataValueField = "hy_roleid"; this.ddlrole.DataBind(); this.ddlrole.Items.Insert(0, "--请选择--"); this.ddlrole.SelectedIndex = 0; } this.ddlisenabled.Items.Insert(0, "是"); this.ddlisenabled.Items.Insert(1, "否"); if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 //判断当前用户是否有保存的权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; //保存 } else { this.btn_submit.Visible = false; //保存 } HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); //旧文档 if (this.Request.QueryString["op"] == "modify") { if (this.Request.QueryString["id"] != null) { //根据id得到信息 this.lblid.Value = this.Request.QueryString["id"].ToString(); this.txtMLID.Value = this.Request.QueryString["id"].ToString(); DataTable dt = Hyoa_ml.Getml(this.lblid.Value); if (dt.Rows.Count > 0) { this.txtname.Value = dt.Rows[0]["MLName"].ToString(); this.txtlink.Value = dt.Rows[0]["hy_link"].ToString(); this.ddltarget.SelectedValue = dt.Rows[0]["hy_target"].ToString(); this.ddlrole.SelectedValue = dt.Rows[0]["hy_role"].ToString(); this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString(); //模块信息定位 for (var i = 0; i < this.ddlmudelid.Items.Count; i++) { if (this.ddlmudelid.Items[i].Value == dt.Rows[0]["hy_mudelid"].ToString()) { this.ddlmudelid.SelectedIndex = i; } } //一级目录定位 for (var i = 0; i < this.ddlfirstmlid.Items.Count; i++) { if (this.ddlfirstmlid.Items[i].Value == dt.Rows[0]["MLID"].ToString().Substring(0,3)) { this.ddlfirstmlid.SelectedIndex = i; this.ddlfirstmlname.SelectedIndex = i; } } if (dt.Rows[0]["hy_ifqy"].ToString() == "是") this.ddlisenabled.SelectedIndex = 0; else this.ddlisenabled.SelectedIndex = 1; //根据模块信息得到对应的选择表单值 if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null) { this.ddltableid.Items.Clear(); //根据模块ID得到表单ID HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig(); DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString()); if (dtgettableid.Rows.Count > 0) { for (var i = 0; i < dtgettableid.Rows.Count; i++) { this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString())); } this.ddltableid.Items.Insert(0, new ListItem("--请选择--", "")); //定位 this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString(); } } } dt.Clear(); } } } }
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.DAO db = new HyoaClass.DAO(); String sql = " select * from hyt_ml where len(MLID)=6 "; if (this.hy_bt.Value != "") { sql += " and MLName like '%" + this.hy_bt.Value + "%'"; } sql += " order by left(MLID,3),hy_sort"; DataTable dt = db.GetDataTable(sql); HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); //DataTable dt; //dt = Hyoa_ml.Getsecondmls(); DataTable tempTable = dt.Clone(); DataColumn col = new DataColumn("firstmlname", typeof(String)); tempTable.Columns.Add(col); 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]; } //-------得到一级目录名称-------- DataTable dt_getlast = Hyoa_ml.Getml(dt.Rows[i]["MLID"].ToString().Substring(0,(dt.Rows[i]["MLID"].ToString().Length-3))); if(dt_getlast.Rows.Count>0) dr["firstmlname"] = dt_getlast.Rows[0]["MLName"].ToString(); else dr["firstmlname"] = ""; //-------得到一级目录名称-------- 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(); }
//得到组织树 public string gettrees() { string ls_retrun = ""; HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); //得到一级目录 DataTable dt = Hyoa_ml.GetFirstmls(); if (dt.Rows.Count > 0) { ls_retrun += "document.write('<ul id=MenuUl>');"; for (var i = 0; i < dt.Rows.Count; i++) { ls_retrun += "document.write('<li class=level1><div class=level1Style id=" + dt.Rows[i]["MLID"].ToString() + " onclick=menuClick(this);><img class=Icon src=\"" + dt.Rows[i]["hy_pic"].ToString() + "\" border=0> " + dt.Rows[i]["MLName"].ToString() + "</div>');"; ls_retrun += "document.write('<ul class=MenuLevel2 id=" + dt.Rows[i]["MLID"].ToString() + "d style=\"DISPLAY: none\">');"; //得到二级目录 DataTable dt2 = Hyoa_ml.GetSubmls_qy(dt.Rows[i]["MLID"].ToString()); if (dt2.Rows.Count > 0) { for (var j = 0; j < dt2.Rows.Count; j++) { //判断二级目录当前用户是否有权限(根据配置role权限) string ls_flag2 = "0"; //无权限 if (dt2.Rows[j]["hy_role"].ToString() == "" || dt2.Rows[j]["hy_role"].ToString() == null) { ls_flag2 = "1"; //有权限(没有设置role) } else { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole(dt2.Rows[j]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag2 = "1"; //有权限 } } if (ls_flag2 == "1") { //开始输出二级目录 if (dt2.Rows[j]["hy_link"].ToString() == "") { ls_retrun += "document.write('<li class=level2><div class=level2Style id=" + dt2.Rows[j]["MLID"].ToString() + " onclick=subMenuClick(this);><img id=" + dt2.Rows[j]["MLID"].ToString() + "_img src=\"/hyhtml/images/menu/menu_arrow_close.gif\" border=0> " + dt2.Rows[j]["MLName"].ToString() + "</div>');"; } else { if (dt2.Rows[j]["hy_target"].ToString() == "_self") ls_retrun += "document.write('<li class=level2><div class=level2Style id=" + dt2.Rows[j]["MLID"].ToString() + " onclick=subMenuClick(this);><img id=" + dt2.Rows[j]["MLID"].ToString() + "_img src=\"/hyhtml/images/menu/menu_arrow_close.gif\" border=0> <a href=\"" + dt2.Rows[j]["hy_link"].ToString() + "\" target=\"RightIframeWin\"><font color=005790>" + dt2.Rows[j]["MLName"].ToString() + "</font></a></div>');"; else ls_retrun += "document.write('<li class=level2><div class=level2Style id=" + dt2.Rows[j]["MLID"].ToString() + " onclick=subMenuClick(this);><img id=" + dt2.Rows[j]["MLID"].ToString() + "_img src=\"/hyhtml/images/menu/menu_arrow_close.gif\" border=0> <a href=\"" + dt2.Rows[j]["hy_link"].ToString() + "\" target=\"" + dt2.Rows[j]["hy_target"].ToString() + "\"><font color=005790>" + dt2.Rows[j]["MLName"].ToString() + "</font></a></div>');"; } ls_retrun += "document.write('<ul class=MenuLevel2 id=" + dt2.Rows[j]["MLID"].ToString() + "d style=\"DISPLAY: none\">');"; //得到三级目录 DataTable dt3 = Hyoa_ml.GetSubmls_qy(dt2.Rows[j]["MLID"].ToString()); if (dt3.Rows.Count > 0) { for (var k = 0; k < dt3.Rows.Count; k++) { //判断三级目录当前用户是否有权限(根据配置role权限) string ls_flag3 = "0"; //无权限 if (dt3.Rows[k]["hy_role"].ToString() == "" || dt3.Rows[k]["hy_role"].ToString() == null) { ls_flag3 = "1"; //有权限(没有设置role) } else { HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole(dt3.Rows[k]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag3 = "1"; //有权限 } } if (ls_flag3 == "1") { //模块ID string ls_mudelid = ""; if (dt3.Rows[k]["hy_link"].ToString().Contains("?")) ls_mudelid = "&mid=" + dt3.Rows[k]["hy_mudelid"].ToString(); else ls_mudelid = "?mid=" + dt3.Rows[k]["hy_mudelid"].ToString(); //表单ID string ls_tableid = ""; ls_tableid = "&tableid=" + dt3.Rows[k]["hy_tableid"].ToString(); if (k == dt3.Rows.Count - 1) { if (dt3.Rows[k]["hy_target"].ToString() == "_self") ls_retrun += "document.write('<li><a href=\"" + dt3.Rows[k]["hy_link"].ToString() + ls_mudelid + ls_tableid + "\" target=\"RightIframeWin\" class=level32>" + dt3.Rows[k]["MLName"].ToString() + "</a></li>');"; else ls_retrun += "document.write('<li><a href=\"" + dt3.Rows[k]["hy_link"].ToString() + ls_mudelid + ls_tableid + "\" target=\"" + dt3.Rows[k]["hy_target"].ToString() + "\" class=level32>" + dt3.Rows[k]["MLName"].ToString() + "</a></li>');"; } else { if (dt3.Rows[k]["hy_target"].ToString() == "_self") ls_retrun += "document.write('<li><a href=\"" + dt3.Rows[k]["hy_link"].ToString() + ls_mudelid + ls_tableid + "\" target=\"RightIframeWin\" class=level3Head>" + dt3.Rows[k]["MLName"].ToString() + "</a></li>');"; else ls_retrun += "document.write('<li><a href=\"" + dt3.Rows[k]["hy_link"].ToString() + ls_mudelid + ls_tableid + "\" target=\"" + dt3.Rows[k]["hy_target"].ToString() + "\" class=level3Head>" + dt3.Rows[k]["MLName"].ToString() + "</a></li>');"; } } } } ls_retrun += "document.write('</ul>');"; ls_retrun += "document.write('</li>');"; } } } ls_retrun += "document.write('</ul>');"; ls_retrun += "document.write('</li>');"; } ls_retrun += "document.write('</ul>');"; } return ls_retrun; }
//得到二级目录的信息 private string GetSecMl(string pis_mlid) { string hy_nav = ""; HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.GetSubMlsOrderbysort(pis_mlid); if (dt.Rows.Count > 0) { string ls_flag1 = "0"; //无权限 //还有下一级目录,先输出当前信息,然后再继续往下 for (int i = 0; i < dt.Rows.Count; i++) { //得到URL string ls_url = dt.Rows[i]["hy_link"].ToString(); string ls_modelid = ""; if (dt.Rows[i]["hy_mudelid"].ToString() != "--请选择--") { ls_modelid = dt.Rows[i]["hy_mudelid"].ToString(); } if (ls_url.Contains("?")) { ls_url += "&mid=" + ls_modelid + "&tableid=" + dt.Rows[i]["hy_tableid"].ToString() + "&listid=" + dt.Rows[i]["hy_listid"].ToString() + "&rnd=" + Hyoa_global.GetRandom(); } else { ls_url += "?mid=" + ls_modelid + "&tableid=" + dt.Rows[i]["hy_tableid"].ToString() + "&listid=" + dt.Rows[i]["hy_listid"].ToString() + "&rnd=" + Hyoa_global.GetRandom(); } ls_flag1 = "0"; if (dt.Rows[i]["hy_role"].ToString() == "" || dt.Rows[i]["hy_role"] == null) { ls_flag1 = "1"; //有权限(没有设置role) } else { if (Hyoa_global.isHaveRole(dt.Rows[i]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag1 = "1"; //有权限 } } if (dt.Rows[i]["hy_ifqy"].ToString() != "是") { //未启用,直接赋为无权限 ls_flag1 = "0"; } if (ls_flag1 == "1") { if (this.ls_mlid == dt.Rows[i]["MLID"].ToString()) { hy_nav += "<li "; } else { hy_nav += "<li isexpand=\"false\""; } if (dt.Rows[i]["hy_link"].ToString() == "") { hy_nav += "><span>" + dt.Rows[i]["MLName"].ToString() + "</span>"; } else { if (dt.Rows[i]["hy_target"].ToString() == "_self") { hy_nav += " url=\"" + ls_url + "\" ><span>" + dt.Rows[i]["MLName"].ToString() + "</span>"; } else { hy_nav += "><span><a href=\"" + ls_url + "\" target=\"" + dt.Rows[i]["hy_target"].ToString() + "\"><font color=#34313a>" + dt.Rows[i]["MLName"].ToString() + "</font></a></span>"; } } hy_nav += GetNextMl(dt.Rows[i]["MLID"].ToString()); hy_nav += "</li>"; } } } else { //没有下一级目录 DataTable dt2 = Hyoa_ml.Getml(pis_mlid); string ls_flag1 = "0"; //无权限 //得到URL string ls_url = dt2.Rows[0]["hy_link"].ToString(); string ls_modelid = ""; if (dt2.Rows[0]["hy_mudelid"].ToString() != "--请选择--") { ls_modelid = dt2.Rows[0]["hy_mudelid"].ToString(); } if (ls_url.Contains("?")) { ls_url += "&mid=" + ls_modelid + "&tableid=" + dt2.Rows[0]["hy_tableid"].ToString() + "&listid=" + dt2.Rows[0]["hy_listid"].ToString() + "&rnd=" + Hyoa_global.GetRandom(); } else { ls_url += "?mid=" + ls_modelid + "&tableid=" + dt2.Rows[0]["hy_tableid"].ToString() + "&listid=" + dt2.Rows[0]["hy_listid"].ToString() + "&rnd=" + Hyoa_global.GetRandom(); } ls_flag1 = "0"; if (dt2.Rows[0]["hy_role"].ToString() == "" || dt2.Rows[0]["hy_role"] == null) { ls_flag1 = "1"; //有权限(没有设置role) } else { if (Hyoa_global.isHaveRole(dt2.Rows[0]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag1 = "1"; //有权限 } } if (ls_flag1 == "1") { if (this.ls_mlid == dt2.Rows[0]["MLID"].ToString()) { hy_nav += "<li "; } else { hy_nav += "<li isexpand=\"false\""; } if (dt2.Rows[0]["hy_link"].ToString() == "") { hy_nav += "><span>" + dt2.Rows[0]["MLName"].ToString() + "</span>"; } else { if (dt2.Rows[0]["hy_target"].ToString() == "_self") { hy_nav += " url=\"" + ls_url + "\" ><span>" + dt2.Rows[0]["MLName"].ToString() + "</span>"; } else { hy_nav += "><span><a href=\"" + ls_url + "\" target=\"" + dt2.Rows[0]["hy_target"].ToString() + "\"><font color=#34313a>" + dt2.Rows[0]["MLName"].ToString() + "</font></a></span>"; } } hy_nav += "</li>"; } else { hy_nav += "<li isexpand=\"false\"><span>" + dt2.Rows[0]["MLName"].ToString() + "</span></li>"; } } return hy_nav; }
//头部导航(一级目录) public string hy_nav_top() { string hy_nav = ""; HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); //得到一级目录 HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.GetFirstmls(); if (dt.Rows.Count > 0) { string ls_flag1 = "0"; //无权限 for (int i = 0; i < dt.Rows.Count; i++) { ls_flag1 = "0"; //输出一级 if (dt.Rows[i]["hy_role"].ToString() == "" || dt.Rows[i]["hy_role"] == null) { ls_flag1 = "1"; //有权限(没有设置role) } else { if (Hyoa_global.isHaveRole(dt.Rows[i]["hy_role"].ToString(), Session["hyuid"].ToString())) { ls_flag1 = "1"; //有权限 } } if (dt.Rows[i]["hy_ifqy"].ToString() != "是") { //未启用,直接赋为无权限 ls_flag1 = "0"; } if (ls_flag1 == "1") { if (hy_nav == "") { hy_nav = "<b><a href=\"/\" >首页</a></b> | <a href=\"index_style2.aspx?mlid=" + dt.Rows[i]["MLid"].ToString() + "\" /><b>" + dt.Rows[i]["MLName"].ToString() + "</b></a>"; } else { hy_nav += " | <a href=\"index_style2.aspx?mlid=" + dt.Rows[i]["MLid"].ToString() + "\" /><b>" + dt.Rows[i]["MLName"].ToString() + "</b></a>"; } } } } return hy_nav; }
//移动目录 protected void btnmove_Click(object sender, EventArgs e) { HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); string ls_mdml = this.ddlyjml.Items[this.ddlyjml.SelectedIndex].Value; //001 String[] v_uids = this.txtuids.Value.Split(','); if (v_uids.Length > 0) { //先得到目的地栏目最大mlid值(二级) string ls_maxmlid = Hyoa_ml.GetMaxMLID(ls_mdml); string ls_str = v_uids[0]; //002002 //判断002002是否有子目录002002***,如果有也需要更新为ls_maxmlid*** DataTable dt = Hyoa_ml.GetALLLevmls_all(ls_str); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ls_xzml = dt.Rows[i]["MLID"].ToString(); string ls_hsw = ls_xzml.Substring(6, ls_xzml.Length - 6); string ls_new = ls_maxmlid + ls_hsw; //001002 //将002002更新为001002 Hyoa_ml.UpdateMLID(ls_new, ls_xzml); } } } this.txtuids.Value = ""; DataPlay(1); DataPlay(System.Int32.Parse(this.curpage.Text)); }
// 选择一级目录 private void GetYjml() { HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); DataTable dt = Hyoa_ml.GetFirstmls_qy(); DataView dv = new DataView(dt); this.ddlyjml.DataSource = dv; this.ddlyjml.DataValueField = "MLID"; this.ddlyjml.DataTextField = "MLName"; this.ddlyjml.DataBind(); this.ddlyjml.Items.Insert(0, "---请选择---"); }
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_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); tdyjml.Visible = false; tdmove.Visible = false; DataTable dt; if (txtmlid.Text == "") { tdsjml.Visible = false; dt = Hyoa_ml.GetFirstmls(); } else { tdsjml.Visible = true; if (txtmlid.Text.Length == 3) { tdyjml.Visible = true; tdmove.Visible = true; } dt = Hyoa_ml.GetSubmls(txtmlid.Text); } DataTable tempTable = dt.Clone(); 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]; } 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(); }
private void DataPlay() { //加载权限 HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role(); DataTable dtrole = Hyoa_role.Getroles(); if (dtrole.Rows.Count > 0) { this.ddlrole.DataSource = dtrole; this.ddlrole.DataTextField = "hy_rolename"; this.ddlrole.DataValueField = "hy_roleid"; this.ddlrole.DataBind(); this.ddlrole.Items.Insert(0, "--请选择--"); this.ddlrole.SelectedIndex = 0; } this.ddlisenabled.Items.Insert(0, "是"); this.ddlisenabled.Items.Insert(1, "否"); if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 //判断当前用户是否有保存的权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.btn_submit.Visible = true; //保存 } else { this.btn_submit.Visible = false; //保存 } HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml(); //新文档,自动得到最大目录号 if (this.Request.QueryString["op"] == "add") { this.lblid.Text = Hyoa_ml.GetMaxFirstMLID(); } //旧文档 if (this.Request.QueryString["op"] == "modify") { if (this.Request.QueryString["id"] != null) { //根据id得到信息 this.lblid.Text = this.Request.QueryString["id"].ToString(); DataTable dt = Hyoa_ml.Getml(this.lblid.Text); if (dt.Rows.Count > 0) { this.txtname.Value = dt.Rows[0]["MLName"].ToString(); for (var i = 0; i < this.fdPic.Items.Count; i++) { if (this.fdPic.Items[i].Value == dt.Rows[0]["hy_pic"].ToString()) { this.fdPic.SelectedIndex = i; } } //图片 this.ml_pic.Src = dt.Rows[0]["hy_pic"].ToString(); this.txtlink.Value = dt.Rows[0]["hy_link"].ToString(); this.ddltarget.SelectedValue = dt.Rows[0]["hy_target"].ToString(); this.ddlrole.SelectedValue = dt.Rows[0]["hy_role"].ToString(); this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString(); if (dt.Rows[0]["hy_ifqy"].ToString() == "是") this.ddlisenabled.SelectedIndex = 0; else this.ddlisenabled.SelectedIndex = 1; } dt.Clear(); this.lblid.Enabled = false; } } } }