public static bool setpurview(string classname, string type) { bool bl = false; if (adminUser.GetLoginState() != null) { Cms.BLL.C_admin_role_value cvalue = new Cms.BLL.C_admin_role_value(); Cms.Model.C_admin admin = adminUser.GetLoginState(); HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["admin"]; string username = admin.user_name; if (username == "admin") { bl = true; } else { string role_id = admin.role_id.ToString();; DataTable dt = cvalue.GetList("nav_name='" + classname + "' and role_id=" + role_id + "").Tables[0]; if (dt.Rows.Count > 0) { string actiontype = dt.Rows[0]["action_type"].ToString(); if (actiontype.IndexOf(type) > -1) { bl = true; } } } } return(bl); }
private void ShowInfo(int _id) { Cms.BLL.C_admin_role bll = new Cms.BLL.C_admin_role(); Cms.Model.C_admin_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理权限 for (int i = 0; i < rptList.Items.Count; i++) { string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value; // CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5"); // for (int n = 0; n < cblActionType.Items.Count; n++) { Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); DataSet ds = bllrole_value.GetList("nav_name='" + navName + "' and role_id=" + _id); if (ds != null && ds.Tables[0].Rows.Count > 0) { string[] actionTypeArr = ds.Tables[0].Rows[0]["action_type"].ToString().Split(','); for (int j = 0; j < actionTypeArr.Length; j++) { if (j == 0) { checkbox1.Checked = true; } if (j == 1) { checkbox2.Checked = true; } if (j == 2) { checkbox3.Checked = true; } if (j == 3) { checkbox4.Checked = true; } if (j == 4) { checkbox5.Checked = true; } } //cblActionType.Items[n].Selected = true; } } } }
public void bind_RepeaterNav() { Cms.BLL.C_Column bllColumn = new Cms.BLL.C_Column(); DataSet ds = bllColumn.GetList("parentId=0 and nav_type='system' and isHidden=0 order by ordernumber desc"); string strNav = ""; string role_id = ""; string role_type = ""; HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["admin"]; if (cookie != null) { role_id = (string)cookie.Values["adminid"]; role_type = (string)cookie.Values["adminType"]; } else if (Session["adminid"] != null) { role_id = (string)Session["adminid"]; role_type = (string)Session["adminType"]; } Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); if (ds != null && ds.Tables[0].Rows.Count > 0) { StringBuilder sbuBuilder = new StringBuilder(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataSet ds1 = null; if (role_type == "1") { ds1 = ds; } else { ds1 = bllrole_value.GetList("nav_name='" + ds.Tables[0].Rows[i]["className"].ToString() + "' and role_id=" + Convert.ToInt32(role_id)); } if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { sbuBuilder.Append("<li><a href='index.aspx?id=" + ds.Tables[0].Rows[i]["classId"].ToString() + "'><i class='icon-" + i + "'></i><span>" + ds.Tables[0].Rows[i]["className"].ToString() + "</span></a></li>"); } else { continue; } } strNav = sbuBuilder.ToString(); } Application["strNav"] = strNav; }
public string ListControl_Bind(int n) { string role_id = ""; string role_type = ""; HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["admin"]; if (cookie != null) { role_id = (string)cookie.Values["adminid"]; role_type = (string)cookie.Values["adminType"]; } else if (Session["adminid"] != null) { role_id = (string)Session["adminid"]; role_type = (string)Session["adminType"]; } Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); Cms.BLL.C_Column bllcolumn = new Cms.BLL.C_Column(); Cms.Model.C_Column modelcolumn = new Cms.Model.C_Column(); DataSet dt = bllcolumn.GetList("parentId=" + n + "and isHidden=0 order by orderNumber desc"); string Temphtml = ""; dt.Tables[0].Columns.Add("Operate", typeof(string)); //操作 dt.Tables[0].Columns.Add("Colum", typeof(String)); //在dt中增加字段名为Colum的列 if (dt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { DataRow dr = dt.Tables[0].Rows[i]; string strchar = ""; string modelid = dr["modelId"].ToString(); string strhref = ""; if (modelid == "2")//文章模型 { strhref = "article/articlelist.aspx?classid=" + dr["classid"].ToString(); } else if (modelid == "3")//产品模型 { strhref = "article/productList.aspx?action=edit&classid=" + dr["classid"].ToString() + "&parentId=" + dr["parentId"].ToString(); } else if (modelid == "4")//单页模型 { strhref = "settings/SinglePage_edit.aspx?action=edit&classid=" + dr["classid"].ToString() + "&parentId=" + dr["parentId"].ToString(); } else if (modelid == "5") { strhref = "article/integralList.aspx?classid=" + dr["classid"].ToString(); } else { strhref = dr["listinfopath"].ToString() == "" ? "javascript:void(0);" : dr["listinfopath"].ToString(); } DataSet ds = null; if (role_type == "1") { ds = dt; } else { ds = bllrole_value.GetList("nav_name='" + dr["className"] + "' and role_id=" + Convert.ToInt32(role_id)); } if (ds != null && ds.Tables[0].Rows.Count > 0) { strchar += " <li><a class='item' target='mainframe' href='" + strhref + "'>" + dr["className"] + "</a><ul>"; strchar += InitChild(dr); strchar += "</ul></li>"; Temphtml += strchar; //this.files.InnerHtml = Temphtml; } else { Temphtml += strchar; //this.files.InnerHtml = Temphtml; } } } this.RepeaterColum.DataSource = dt; this.RepeaterColum.DataBind(); return(Temphtml.ToString()); }
private string InitChild(DataRow dr) { string role_id = ""; string role_type = ""; HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["admin"]; if (cookie != null) { role_id = (string)cookie.Values["adminid"]; role_type = (string)cookie.Values["adminType"]; } else if (Session["adminid"] != null) { role_id = (string)Session["adminid"]; role_type = (string)Session["adminType"]; } Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); Cms.BLL.C_Column bllcolumn = new Cms.BLL.C_Column(); Cms.Model.C_Column modelcolumn = new Cms.Model.C_Column(); DataSet dtt = bllcolumn.GetList("parentId=" + dr["classid"] + "and isHidden=0 order by orderNumber desc"); dtt.Tables[0].Columns.Add("Operate", typeof(string)); dtt.Tables[0].Columns.Add("Colum", typeof(String)); string temp = ""; string strchar = ""; if (dtt.Tables[0].Rows.Count > 0) { for (int k = 0; k < dtt.Tables[0].Rows.Count; k++) { DataRow dro = dtt.Tables[0].Rows[k]; Cms.BLL.C_Column bllcolumn1 = new Cms.BLL.C_Column(); DataSet dtt1 = bllcolumn1.GetList("parentId=" + dro["classid"] + "and isHidden=0 order by orderNumber desc"); if (dtt1.Tables[0].Rows.Count > 0) { DataRow dro1 = dtt.Tables[0].Rows[k]; string modelid = dro["modelId"].ToString(); string strhref = ""; if (modelid == "2")//文章模型 { strhref = "article/articlelist.aspx?classid=" + dro["classid"].ToString(); } else if (modelid == "3")//产品模型 { strhref = "article/productList.aspx?action=edit&classid=" + dro["classid"].ToString() + "&parentId=" + dro["parentId"].ToString(); } else if (modelid == "4")//单页模型 { strhref = "settings/SinglePage_edit.aspx?action=edit&classid=" + dro["classid"].ToString() + "&parentId=" + dro["parentId"].ToString(); } else if (modelid == "5") { strhref = "article/integralList.aspx?classid=" + dro["classid"].ToString(); } else { strhref = dro["listinfopath"].ToString() == "" ? "javascript:void(0);" : dro["listinfopath"].ToString(); } DataSet ds = null; if (role_type == "1") { ds = dtt; } else { ds = bllrole_value.GetList("nav_name='" + dro["className"] + "' and role_id=" + Convert.ToInt32(role_id)); } if (ds != null && ds.Tables[0].Rows.Count > 0) { strchar += " <li><a class='item' href='" + strhref + "' target='mainframe'>" + dro["className"].ToString() + "</a><ul>"; strchar += InitChild(dro1); strchar += "</ul></li>"; } } else { string modelid = dro["modelId"].ToString(); string strhref = ""; if (modelid == "2")//文章模型 { strhref = "article/articlelist.aspx?classid=" + dro["classid"].ToString(); } else if (modelid == "3")//产品模型 { strhref = "article/productList.aspx?action=edit&classid=" + dro["classid"].ToString() + "&parentId=" + dro["parentId"].ToString(); } else if (modelid == "4")//单页模型 { strhref = "settings/SinglePage_edit.aspx?action=edit&classid=" + dro["classid"].ToString() + "&parentId=" + dro["parentId"].ToString(); } else if (modelid == "5") { strhref = "article/integralList.aspx?action=edit&classid=" + dro["classid"].ToString() + "&parentId=" + dro["parentId"].ToString(); } else { strhref = dro["listinfopath"].ToString() == "" ? "javascript:void(0);" : dro["listinfopath"].ToString(); } DataSet ds = null; if (role_type == "1") { ds = dtt; } else { ds = bllrole_value.GetList("nav_name='" + dro["className"] + "' and role_id=" + Convert.ToInt32(role_id)); } if (ds != null && ds.Tables[0].Rows.Count > 0) { temp += "<li>"; temp += "<a class='item' target='mainframe' href='" + strhref + "'>" + dro["className"].ToString() + "</a>"; temp += "</li>"; } } } } return(strchar + temp); }