Beispiel #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (this.txtRoleName.Text.Trim().Length <= 0)
     {
         MessageBox.ShowFailTip(this, SysManage.ErrorRoleIsNull);
     }
     else
     {
         try
         {
             Role role = new Role();
             if (!role.RoleExists(this.txtRoleName.Text.Trim()))
             {
                 role.Description = this.txtRoleName.Text;
                 role.Create();
                 LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("添加角色:【{0}】", this.txtRoleName.Text), this);
                 MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
             }
             else
             {
                 MessageBox.ShowFailTip(this, Site.TooltipDataExist);
             }
         }
         catch (Exception exception)
         {
             this.lblToolTip.Text = exception.Message;
             return;
         }
         this.txtRoleName.Text = "";
         this.dataBind();
     }
 }
Beispiel #2
0
 public void BtnUpName_Click(object sender, EventArgs e)
 {
     string newname = this.TxtNewname.Text.Trim();
     currentRole = new Role(Convert.ToInt32(lblRoleID.Text));
     currentRole.Description = newname;
     currentRole.Update();
     DoInitialDataBind();
     lblTiptool.Text = Resources.Site.TooltipUpdateOK;// "修改成功!";
 }
Beispiel #3
0
 public void BtnUpName_Click(object sender, EventArgs e)
 {
     string str = this.TxtNewname.Text.Trim();
     this.currentRole = new Role(Convert.ToInt32(this.lblRoleID.Text));
     this.currentRole.Description = str;
     this.currentRole.Update();
     this.DoInitialDataBind();
     this.lblTiptool.Text = Site.TooltipUpdateOK;
 }
Beispiel #4
0
 //移除权限
 public void RemovePermissionButton_Click(object sender, System.EventArgs e)
 {
     if (this.PermissionList.SelectedIndex > -1)
     {
         int currentRole = Convert.ToInt32(lblRoleID.Text);
         //RoleID = Request["RoleID"];
         Role bizRole = new Role(currentRole);
         bizRole.RemovePermission(Convert.ToInt32(this.PermissionList.SelectedValue));
         CategoryDownList_SelectedIndexChanged(sender, e);
     }
 }
Beispiel #5
0
 private void DoInitialDataBind()
 {
     this.currentRole = new Role(Convert.ToInt32(this.lblRoleID.Text));
     this.RoleLabel.Text = this.currentRole.Description;
     this.TxtNewname.Text = this.currentRole.Description;
     DataSet allCategories = AccountsTool.GetAllCategories();
     this.CategoryDownList.DataSource = allCategories.Tables[0];
     this.CategoryDownList.DataTextField = "Description";
     this.CategoryDownList.DataValueField = "CategoryID";
     this.CategoryDownList.DataBind();
 }
Beispiel #6
0
 public void FillCategoryList(int categoryId)
 {
     this.currentRole = new Role(Convert.ToInt32(this.lblRoleID.Text));
     DataTable table = this.currentRole.NoPermissions.Tables["Categories"];
     DataRow row = table.Rows.Find(categoryId);
     if (row != null)
     {
         DataRow[] childRows = row.GetChildRows("PermissionCategories");
         this.CategoryList.Items.Clear();
         foreach (DataRow row2 in childRows)
         {
             this.CategoryList.Items.Add(new ListItem((string) row2["Description"], Convert.ToString(row2["PermissionID"])));
         }
     }
 }
Beispiel #7
0
 //填充非权限列表
 public void FillCategoryList(int categoryId)
 {
     currentRole = new Role(Convert.ToInt32(lblRoleID.Text));
     DataTable categories = currentRole.NoPermissions.Tables["Categories"];
     DataRow currentCategory = categories.Rows.Find(categoryId);
     if (currentCategory != null)
     {
         DataRow[] permissions = currentCategory.GetChildRows("PermissionCategories");
         CategoryList.Items.Clear();
         foreach (DataRow currentRow in permissions)
         {
             CategoryList.Items.Add(
                 new ListItem((string)currentRow["Description"], Convert.ToString(currentRow["PermissionID"])));
         }
     }
 }
Beispiel #8
0
 public void btnSave_Click(object sender, System.EventArgs e)
 {
     Role bllRole = new Role();
     bllRole.RoleID = Convert.ToInt32(lblRoleID.Text);
     foreach (ListItem item in chkPermissions.Items)
     {
         if (item.Selected)
         {
             bllRole.AddPermission(Convert.ToInt32(item.Value));
         }
         else
         {
             bllRole.RemovePermission(Convert.ToInt32(item.Value));
         }
     }
     Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipSaveOK);
 }
Beispiel #9
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     Role role = new Role {
         RoleID = Convert.ToInt32(this.lblRoleID.Text)
     };
     foreach (ListItem item in this.chkPermissions.Items)
     {
         if (item.Selected)
         {
             role.AddPermission(Convert.ToInt32(item.Value));
         }
         else
         {
             role.RemovePermission(Convert.ToInt32(item.Value));
         }
     }
     LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "编辑角色权限", this);
     MessageBox.ShowSuccessTip(this, Site.TooltipSaveOK);
 }
Beispiel #10
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if(txtRoleName.Text.Trim().Length<=0)
     {
         Maticsoft.Common.MessageBox.Show(this,"角色为空不能保存");
         return;
     }
     Role role = new Role();
     role.Description = txtRoleName.Text;
     try
     {
         role.Create();
         Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipSaveOK);
     }
     catch(Exception ex)
     {
         lblToolTip.Text = ex.Message;
         return;
     }
     txtRoleName.Text = "";
     dataBind();
 }
Beispiel #11
0
 public void RemoveRoleButton_Click(object sender, System.EventArgs e)
 {
     int currentRole = Convert.ToInt32(lblRoleID.Text);
     Role bizRole = new Role(currentRole);
     bizRole.Delete();
     Server.Transfer("RoleAdmin.aspx");
 }
Beispiel #12
0
        //填充非权限列表
        public void FillCategoryList(int categoryId)
        {
            currentRole = new Role(Convert.ToInt32(lblRoleID.Text));
            GetRolePermissionlist();
            DataSet ds=AccountsTool.GetPermissionsByCategory(categoryId);

            DataView dv = ds.Tables[0].DefaultView;
            if (!UserPrincipal.HasPermissionID(GetPermidByActID(Act_ShowReservedPerm)))
            {
                dv.RowFilter = "PermissionID not in (" + ReservedPermIDs + ")";
            }
            chkPermissions.DataSource = dv;
            chkPermissions.DataValueField = "PermissionID";
            chkPermissions.DataTextField = "Description";
            chkPermissions.DataBind();
        }
Beispiel #13
0
 public void RemoveRoleButton_Click(object sender, System.EventArgs e)
 {
     if (ReservedRoleIDs.Contains(lblRoleID.Text))
     {
         Maticsoft.Common.MessageBox.Show(this,"该角色为系统保留角色,不能删除!");
         return;
     }
     int currentRole = Convert.ToInt32(lblRoleID.Text);
     Role bizRole = new Role(currentRole);
     bizRole.Delete();
     Server.Transfer("RoleAdmin.aspx");
 }
Beispiel #14
0
 public void BtnUpName_Click(object sender, EventArgs e)
 {
     string str = this.TxtNewname.Text.Trim();
     this.currentRole = new Role(Convert.ToInt32(this.lblRoleID.Text));
     this.currentRole.Description = str;
     this.currentRole.Update();
     this.DoInitialDataBind();
     LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, string.Format("编辑角色:【{0}】", str), this);
     this.lblTiptool.Text = Site.TooltipUpdateOK;
 }
Beispiel #15
0
 public void FillCategoryList(int categoryId)
 {
     this.currentRole = new Role(Convert.ToInt32(this.lblRoleID.Text));
     this.GetRolePermissionlist();
     DataSet permissionsByCategory = AccountsTool.GetPermissionsByCategory(categoryId);
     if (!DataSetTools.DataSetIsNull(permissionsByCategory))
     {
         DataView defaultView = permissionsByCategory.Tables[0].DefaultView;
         if (!base.UserPrincipal.HasPermissionID(base.GetPermidByActID(this.Act_ShowReservedPerm)))
         {
             defaultView.RowFilter = "PermissionID not in (" + this.ReservedPermIDs + ")";
         }
         this.chkPermissions.DataSource = defaultView;
         this.chkPermissions.DataValueField = "PermissionID";
         this.chkPermissions.DataTextField = "Description";
         this.chkPermissions.DataBind();
     }
 }