CheckAuthorizationToAddUser() public static method

public static CheckAuthorizationToAddUser ( ) : void
return void
Example #1
0
        public Result <UserDto> New(object criteria)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToAddUser();

                var dto = NewImpl(criteria);
                retResult = Result <UserDto> .Success(dto);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.CreateFailedException(ex);
                retResult = Result <UserDto> .FailureWithInfo(null, wrappedEx);
            }
            return(retResult);
        }
Example #2
0
        public Result <UserDto> Insert(UserDto dto)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToAddUser();

                var insertedDto = InsertImpl(dto);
                retResult = Result <UserDto> .Success(insertedDto);
            }
            catch (Exception ex)
            {
                var wrappedEx = new Exceptions.InsertFailedException(ex);
                retResult = Result <UserDto> .FailureWithInfo(null, wrappedEx);
            }
            return(retResult);
        }
Example #3
0
        public Result <UserDto> AddUser(Csla.Security.UsernameCriteria criteria)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToAddUser();

                var userDto = AddUserImpl(criteria);
                if (userDto == null)
                {
                    throw new Exception();
                }
                retResult = Result <UserDto> .Success(userDto);
            }
            catch (Exception ex)
            {
                var wrapperEx = new Exceptions.AddUserFailedException(ex, criteria.Username);
                retResult = Result <UserDto> .FailureWithInfo(null, wrapperEx);
            }

            return(retResult);
        }