Example #1
0
        protected void rpRoleList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Add")
            {
                if (e.Item.ItemType == ListItemType.Header)
                {
                    TextBox txtRoleNameAdd = e.Item.FindControl("txtRoleNameAdd") as TextBox;

                    Role role = new Role()
                    {
                        Role_Name = txtRoleNameAdd.Text,
                        IsActive  = true
                    };

                    RoleDAL dal = new RoleDAL();
                    dal.AddRole(role);
                    dal.Save();
                }
            }
            else if (e.CommandName == "Delete")
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    HiddenField hfId = e.Item.FindControl("hfId") as HiddenField;
                    RoleDAL     dal  = new RoleDAL();
                    dal.DeleteRole(int.Parse(hfId.Value));
                }
            }
            Utility.BindDataToRepeater(rpRoleList, GetRoleList());
            SetFocus(source);
            Response.Redirect("AccessControlManagement.aspx?tabno=2");
        }
Example #2
0
    /// <summary>
    /// 添加角色信息
    /// </summary>
    /// <param name="oRModel"></param>
    /// <returns></returns>
    public string AddRole(RoleModel oRModel, out int RoleId)
    {
        string ret = Config.Fail;

        RoleId = 0;
        try
        {
            ret = rd.AddRole(oRModel);
            int  Id   = 0;
            bool flag = Int32.TryParse(ret, out Id);
            if (flag && Id > 0)
            {
                RoleId = Id;
                if (oRModel.Permissions != null)
                {
                    foreach (PermissionsModel o in oRModel.Permissions)
                    {
                        pd.AddPermissionRelation(RoleId, o.ModuleKey, o.PermissionsId, oRModel.CreatorId);
                    }
                }
                return(Config.Success);
            }
        }
        catch (Exception ex)
        {
            WriteLog.WriteExceptionLog("ZB.BLL.Authorization.AdminBLL.AddRole()", ex);
            return(Config.ExceptionMsg);
        }
        return(ret);
    }
Example #3
0
 /// <summary>
 /// 添加角色
 /// </summary>
 /// <param name="u"></param>
 /// <returns></returns>
 public int AddRole(DT_Role r)
 {
     try
     {
         return(rdal.AddRole(r));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
 public int AddRole(Role r)
 {
     if (Session["user"] == null)
     {
         return(-1000);
     }
     if (!PowerDAL.HasPower((Session["user"] as Users).RoleID.Value, 16))
     {
         return(-1001);
     }
     return(RoleDAL.AddRole(r));
 }
Example #5
0
        public bool AddRole(RoleBE role)
        {
            RoleDAL roleDAL = new RoleDAL();

            if (roleDAL.AddRole(role))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #6
0
        public IHttpActionResult AddRole(RoleEntity role)
        {
            bool         isAddSuccess = false;
            ResultEntity result       = new ResultEntity();

            try
            {
                isAddSuccess = dal.AddRole(role.ToROLE());
                result.Data  = role;
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                NtripProxyLogger.LogExceptionIntoFile("调用接口api/Role/AddRole异常,异常信息为:" + e.Message);
            }

            result.IsSuccess = isAddSuccess;
            return(Json <ResultEntity>(result));
        }
Example #7
0
        /// <summary>
        /// To Add Role
        /// </summary>
        /// <param name="objRole"></param>
        /// <returns></returns>
        public string AddRole(RoleBO objRole)
        {
            RoleDAL objRoleDAL = new RoleDAL();

            return(objRoleDAL.AddRole(objRole));
        }
Example #8
0
 public int AddRole(string RoleName, int[] ids)
 {
     return(rdal.AddRole(RoleName, ids));
 }