📄 modifypurview.cs
字号:
namespace PowerEasy.WebSite.Admin.User
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.UserManage;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
public class ModifyPurview : AdminPage
{
protected Button BtnField;
protected Button BtnSetNode;
protected Button BtnSpecial;
protected Button BtnSubmit;
protected HiddenField HdnUsersId;
protected Label LblGroupName;
protected Label LblTitle;
protected Label LblUserName;
protected RadioButtonList RadlIsInheritGroupRole;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected PowerEasy.WebSite.Controls.UserIndividuation UserIndividuation;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
int userId = DataConverter.CLng(this.HdnUsersId.Value);
bool inheritGroupRole = DataConverter.CBool(this.RadlIsInheritGroupRole.SelectedValue);
if (!inheritGroupRole && !Users.SaveUserPurview(this.UserIndividuation.PurviewInfo, userId))
{
AdminPage.WriteErrMsg("<li>保存用户权限信息失败!</li>", "");
}
if (Users.SaveUserPurview(inheritGroupRole, userId))
{
AdminPage.WriteSuccessMsg("<li>修改会员权限成功!</li>", "UserShow.aspx?UserID=" + userId.ToString());
}
else
{
AdminPage.WriteErrMsg("<li>修改会员权限失败!</li>", "UserShow.aspx?UserID=" + userId.ToString());
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (!RolePermissions.AccessCheck(OperateCode.UserModifyPermissions))
{
throw new CustomException(PEExceptionType.ExceedAuthority);
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
UserInfo userById = Users.GetUserById(BasePage.RequestInt32("UserID"));
if (userById.IsInheritGroupRole)
{
this.UserIndividuation.Visible = false;
this.BtnSetNode.Visible = false;
this.BtnSpecial.Visible = false;
this.BtnField.Visible = false;
}
else
{
this.UserIndividuation.Visible = true;
}
this.LblUserName.Text = userById.UserName;
this.LblGroupName.Text = userById.GroupName;
this.RadlIsInheritGroupRole.SelectedValue = userById.IsInheritGroupRole.ToString();
this.HdnUsersId.Value = userById.UserId.ToString();
if (string.IsNullOrEmpty(userById.UserSetting))
{
UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(userById.GroupId);
if (userGroupById.GroupId != -2)
{
this.UserIndividuation.PurviewInfo = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
}
}
else
{
this.UserIndividuation.PurviewInfo = userById.UserPurview;
}
}
}
protected void RadlIsInheritGroupRole_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.RadlIsInheritGroupRole.Items[1].Selected)
{
this.UserIndividuation.Visible = true;
this.BtnSetNode.Visible = true;
this.BtnSpecial.Visible = true;
this.BtnField.Visible = true;
}
else
{
this.UserIndividuation.Visible = false;
this.BtnSetNode.Visible = false;
this.BtnSpecial.Visible = false;
this.BtnField.Visible = false;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -