protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     foreach (RepeaterItem item in this.RptModelList2.Items)
     {
         Repeater    repeater = item.FindControl("RptFieldList") as Repeater;
         HiddenField field    = item.FindControl("HdnModelId") as HiddenField;
         if (repeater != null)
         {
             foreach (RepeaterItem item2 in repeater.Items)
             {
                 CheckBox    box    = item2.FindControl("ChkFieldPurview") as CheckBox;
                 HiddenField field2 = item2.FindControl("HdnFieldName") as HiddenField;
                 if (box.Checked)
                 {
                     StringHelper.AppendString(this.m_modelIdList, field.Value);
                     StringHelper.AppendString(this.m_fieldNameList, field2.Value);
                 }
             }
             continue;
         }
     }
     RolePermissions.DeleteFieldPermissionFromRoles(this.m_RoleId);
     RolePermissions.AddFieldPermissions(this.m_RoleId, OperateCode.ContentFieldInput, this.m_modelIdList.ToString(), this.m_fieldNameList.ToString());
     AdminPage.WriteSuccessMsg("<li>设置字段权限成功!</li>", "RoleManage.aspx");
 }
Example #2
0
 private void GetFieldPermission()
 {
     foreach (RepeaterItem item in this.RptModelList2.Items)
     {
         Repeater    repeater = item.FindControl("RptFieldList") as Repeater;
         HiddenField field    = item.FindControl("HdnModelId") as HiddenField;
         if (repeater != null)
         {
             foreach (RepeaterItem item2 in repeater.Items)
             {
                 CheckBox    box    = item2.FindControl("ChkFieldPurview") as CheckBox;
                 HiddenField field2 = item2.FindControl("HdnFieldName") as HiddenField;
                 if (box.Checked)
                 {
                     StringHelper.AppendString(this.m_modelIdList, field.Value);
                     StringHelper.AppendString(this.m_fieldNameList, field2.Value);
                 }
             }
             continue;
         }
     }
     if (this.m_Action == "Add")
     {
         if (!RolePermissions.AddFieldPermissions(this.m_RoleId, OperateCode.ContentFieldInput, this.m_modelIdList.ToString(), this.m_fieldNameList.ToString()))
         {
             this.m_strMsg.Append("<li>模型字段权限添加失败!</li>");
         }
     }
     else
     {
         RolePermissions.DeleteFieldPermissionFromRoles(this.m_RoleId);
         if (!RolePermissions.AddFieldPermissions(this.m_RoleId, OperateCode.ContentFieldInput, this.m_modelIdList.ToString(), this.m_fieldNameList.ToString()))
         {
             this.m_strMsg.Append("<li>模型字段权限修改失败!</li>");
         }
     }
 }