RoleLevelManager.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:5k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections.Generic;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Text;
- public partial class RoleManager : System.Web.UI.Page
- {
- Model.User_Priv MyMUP = new Model.User_Priv();
- BLL.User_Priv MyBUP = new BLL.User_Priv();
- /// <summary>
- /// 模板
- /// </summary>
- List<Model.ASPClass> LMUP = new List<Model.ASPClass>();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.ASPClass BUP = new BLL.ASPClass();
- public string User_Priv_List = "";
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("", "RoleManager");
- if (!IsPostBack)
- {
- if (Request.QueryString["id"] != null)
- {
- MyMUP = MyBUP.GetModel(int.Parse(Request.QueryString["id"].ToString()));
- User_Priv_List = MyMUP.FuncIdStr;
- MyDataBind(1);
- }
-
- }
- MyMUP = MyBUP.GetModel(int.Parse(Request.QueryString["id"].ToString()));
- User_Priv_List = MyMUP.FuncIdStr;
- }
- public bool IsHaveExcept(string ClassName)
- {
- bool IsCannotUse = false;
- // Model.Users MU = new BLL.Users().GetModel(int.Parse(SessionInclude.Id));
- Model.User_Priv MUP = new BLL.User_Priv().GetModel(int.Parse(Request.QueryString["id"] .ToString()));//MU.PrivId);
- string[] QXStr = MUP.FuncIdStr.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string QX in QXStr)
- {
- if (QX == ClassName)
- {
- IsCannotUse = true;
- break;
- }
- }
- return IsCannotUse;
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- public void MyDataBind(int idex)
- {
- AspNetPager1.RecordCount = BUP.GetCount("");
- List<Model.ASPClass> LRData = BUP.GetPageList(10,idex,"ID",true,"");
- if (LRData.Count == 0)
- {
- Model.ASPClass MR = new Model.ASPClass();
- LRData.Add(MR);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- string GRCTTS=GridView1.Rows[i].Cells[3].Text.ToString();
- if (IsHaveExcept(GRCTTS))
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- cbox.Checked = false;
- }
- }
-
-
-
- }
- }
- protected void DelButton1_Click(object sender, EventArgs e)
- {
- try
- {
- MyMUP = MyBUP.GetModel(int.Parse(Request.QueryString["id"].ToString()));
- string UpdatePrives = MyMUP.FuncIdStr;
- for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
- {
- CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBoxItem");
- if (cbox.Checked)
- {
- // Response.Write(GridView1.Rows[i].Cells[1].Text.ToString() + ":True");
- string classname = GridView1.Rows[i].Cells[3].Text.ToString();
- UpdatePrives= UpdatePrives.Replace(classname + ",","");
-
- }
- else
- {
- string classname = GridView1.Rows[i].Cells[3].Text.ToString();
- UpdatePrives= UpdatePrives.Replace(classname + ",", "");
- UpdatePrives += classname + ",";
- }
- }
-
- MyMUP.FuncIdStr=UpdatePrives;
- MyBUP.Update(MyMUP);
- MessageBox.Show("保存完毕!");
- }
- catch (Exception exp)
- { MessageBox.Show(exp.Message); }
- }
- protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
- {
- MyDataBind(e.NewPageIndex);
- }
- protected void AspNetPager1_PageChanged(object sender, EventArgs e)
- {
-
- }
- }