示例#1
0
        private bool DoAdd()
        {
            bool flag = false;

            Rain.Model.manager_role model       = new Rain.Model.manager_role();
            Rain.BLL.manager_role   managerRole = new Rain.BLL.manager_role();
            model.role_name = this.txtRoleName.Text.Trim();
            model.role_type = int.Parse(this.ddlRoleType.SelectedValue);
            List <manager_role_value> managerRoleValueList = new List <manager_role_value>();

            for (int index1 = 0; index1 < this.rptList.Items.Count; ++index1)
            {
                string       str     = ((HiddenField)this.rptList.Items[index1].FindControl("hidName")).Value;
                CheckBoxList control = (CheckBoxList)this.rptList.Items[index1].FindControl("cblActionType");
                for (int index2 = 0; index2 < control.Items.Count; ++index2)
                {
                    if (control.Items[index2].Selected)
                    {
                        managerRoleValueList.Add(new manager_role_value()
                        {
                            nav_name    = str,
                            action_type = control.Items[index2].Value
                        });
                    }
                }
            }
            model.manager_role_values = managerRoleValueList;
            if (managerRole.Add(model) > 0)
            {
                this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理角色:" + model.role_name);
                flag = true;
            }
            return(flag);
        }
示例#2
0
        private void RoleBind(DropDownList ddl, int role_type)
        {
            DataTable table = new Rain.BLL.manager_role().GetList("").Tables[0];

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow row in (InternalDataCollectionBase)table.Rows)
            {
                if (Convert.ToInt32(row[nameof(role_type)]) >= role_type)
                {
                    ddl.Items.Add(new ListItem(row["role_name"].ToString(), row["id"].ToString()));
                }
            }
        }
示例#3
0
 private void ShowInfo(int _id)
 {
     Rain.Model.manager_role model = new Rain.BLL.manager_role().GetModel(_id);
     this.txtRoleName.Text          = model.role_name;
     this.ddlRoleType.SelectedValue = model.role_type.ToString();
     if (model.manager_role_values == null)
     {
         return;
     }
     for (int index = 0; index < this.rptList.Items.Count; ++index)
     {
         string       navName       = ((HiddenField)this.rptList.Items[index].FindControl("hidName")).Value;
         CheckBoxList cblActionType = (CheckBoxList)this.rptList.Items[index].FindControl("cblActionType");
         for (int n = 0; n < cblActionType.Items.Count; ++n)
         {
             if (model.manager_role_values.Find((Predicate <manager_role_value>)(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value)) != null)
             {
                 cblActionType.Items[n].Selected = true;
             }
         }
     }
 }