📄 specials.cs
字号:
}
}
}
protected void EgvPermissions_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
UserGroupsInfo dataItem = (UserGroupsInfo) e.Row.DataItem;
CheckBox box = (CheckBox) e.Row.FindControl("ChkSpecialInput");
foreach (RoleSpecialPermissionsInfo info2 in UserPermissions.GetSpecialPermssionList(dataItem.GroupId, BasePage.RequestInt32("SpecialID"), OperateCode.None, 1))
{
bool flag = info2.SpecialId != -1;
if (info2.OperateCode == OperateCode.SpecialContentInput)
{
box.Checked = true;
if (!flag)
{
box.Enabled = flag;
}
}
}
}
}
protected void EgvRoleView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
RoleInfo dataItem = (RoleInfo) e.Row.DataItem;
CheckBox box = (CheckBox) e.Row.FindControl("ChkSpecialInput");
CheckBox box2 = (CheckBox) e.Row.FindControl("ChkSpecialManage");
IList<RoleSpecialPermissionsInfo> specialPermssionList = RolePermissions.GetSpecialPermssionList(dataItem.RoleId, BasePage.RequestInt32("SpecialID"));
bool flag = false;
foreach (RoleSpecialPermissionsInfo info2 in specialPermssionList)
{
flag = info2.SpecialId != -1;
if (info2.OperateCode == OperateCode.SpecialContentInput)
{
box.Checked = true;
if (!flag)
{
box.Enabled = flag;
}
}
if (info2.OperateCode == OperateCode.SepcialContentManage)
{
box2.Checked = true;
if (flag)
{
continue;
}
box2.Enabled = flag;
}
}
}
}
private SpecialInfo GetSpecialInfo()
{
int specialCategoryId = DataConverter.CLng(this.DropSpecialCategory.SelectedValue);
if (specialCategoryId <= 0)
{
AdminPage.WriteErrMsg("<li>请选择专题所属的类别!</li>", "Special.aspx");
}
SpecialInfo info = new SpecialInfo();
SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialCategoryId);
info.SpecialName = this.TxtSpecialName.Text;
info.SpecialCategoryId = specialCategoryId;
info.SpecialDir = specialCategoryInfoById.SpecialCategoryDir + "/" + this.TxtSpecialDir.Text;
info.SpecialIdentifier = this.TxtSpecialIdentifier.Text;
info.SpecialPic = this.TxtSpecialPic.Text;
info.SpecialTips = this.TxtSpecialTips.Text;
info.SpecialTemplatePath = this.FileCSpecialTemplatePath.Text;
info.SearchTemplatePath = this.FileCSearchTemplatePath.Text;
info.IsElite = DataConverter.CBool(this.RadlIsElite.SelectedValue);
info.OpenType = DataConverter.CLng(this.RadOpenType.SelectedValue);
info.Description = this.TxtDescription.Text;
info.IsCreateListPage = DataConverter.CBool(this.RadlCreatHtml.SelectedValue);
info.ListPageSavePathType = (ListPagePathType) Enum.Parse(typeof(ListPagePathType), this.RadlListPageHtmlDirType.SelectedValue);
info.ListPagePostfix = this.PagePostfix.Value;
int num2 = DataConverter.CLng(this.DropCustomNum.SelectedValue);
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= num2; i++)
{
StringHelper.AppendString(sb, ((TextBox) this.PnlCustomFileds.FindControl("Custom_Content" + i)).Text, "{#$$$#}");
}
info.CustomContent = sb.ToString();
return info;
}
private void InitEChklPermission()
{
IList<UserGroupsInfo> userGroupList = UserGroups.GetUserGroupList(0, 0);
this.EgvPermissions.DataSource = userGroupList;
this.EgvPermissions.DataBind();
this.EgvRoleView.DataSource = UserRole.GetRoleList();
this.EgvRoleView.DataBind();
}
private void InitialText()
{
RolePermissions.AccessCheck(OperateCode.SpecialManage);
string str = BasePage.RequestStringToLower("Action", "add");
if (this.Page.IsPostBack)
{
return;
}
IList<SpecialCategoryInfo> specialCategoryList = Special.GetSpecialCategoryList();
this.DropSpecialCategory.SelectedValue = this.specialCategoryId.ToString();
this.DropSpecialCategory.DataSource = specialCategoryList;
this.DropSpecialCategory.DataBind();
((DropDownList) this.PnlCustomFileds.FindControl("DropCustomNum")).Attributes.Add("onchange", "setFileFileds(this.value)");
this.InitEChklPermission();
string str2 = str;
if (str2 != null)
{
if (!(str2 == "add"))
{
if (str2 == "modify")
{
this.SmpNavigator.CurrentNode = "修改专题";
this.EBtnModify.Visible = true;
if (!this.Page.IsPostBack)
{
this.BindSpecial();
}
goto Label_0132;
}
}
else
{
this.SmpNavigator.CurrentNode = "添加专题";
this.EBtnAdd.Visible = true;
BasePage.SetSelectedIndexByValue(this.DropSpecialCategory, this.specialCategoryId.ToString());
goto Label_0132;
}
}
this.SmpNavigator.CurrentNode = "添加专题";
this.EBtnAdd.Visible = true;
Label_0132:
if (!RolePermissions.AccessCheck(OperateCode.AdministratorManage))
{
this.TabTitle1.Style.Add("display", "none");
}
}
private void InputPermissions(int specialsId)
{
StringBuilder roleIdList = new StringBuilder();
for (int i = 0; i < this.EgvPermissions.Rows.Count; i++)
{
CheckBox box = (CheckBox) this.EgvPermissions.Rows[i].FindControl("ChkSpecialInput");
string selectId = this.EgvPermissions.DataKeys[i].Value.ToString();
AppendSelectId(box.Checked, roleIdList, selectId);
}
if (!UserPermissions.AddSpecialPermissions(roleIdList.ToString(), OperateCode.SpecialContentInput, specialsId, 1))
{
AdminPage.WriteErrMsg("<li>专题信息录入权限添加失败!</li>");
}
}
private void InputRolePermission(int specialsId)
{
StringBuilder roleIdList = new StringBuilder();
StringBuilder builder2 = new StringBuilder();
for (int i = 0; i < this.EgvRoleView.Rows.Count; i++)
{
CheckBox box = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkSpecialInput");
CheckBox box2 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkSpecialManage");
string selectId = this.EgvRoleView.DataKeys[i].Value.ToString();
AppendSelectId(box.Checked, roleIdList, selectId);
AppendSelectId(box2.Checked, builder2, selectId);
}
RolePermissions.DeleteSpecialPermissionFromRoles(-1, specialsId);
RolePermissions.AddSepcialPermissionToRoles(roleIdList.ToString(), specialsId, OperateCode.SpecialContentInput);
RolePermissions.AddSepcialPermissionToRoles(builder2.ToString(), specialsId, OperateCode.SepcialContentManage);
}
protected void Page_Load(object sender, EventArgs e)
{
RolePermissions.BusinessAccessCheck(OperateCode.SpecialManage);
this.specialId = BasePage.RequestInt32("SpecialID");
this.specialCategoryId = BasePage.RequestInt32("SpecialCategoryID");
this.InitialText();
}
protected void ValxSpecialDir_ServerValidate(object source, ServerValidateEventArgs args)
{
if (string.IsNullOrEmpty(this.TxtSpecialDir.Text))
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -