Пример #1
0
        public Result <UserDto> Fetch(string username)
        {
            Result <UserDto> retResult = Result <UserDto> .Undefined(null);

            try
            {
                DalHelper.CheckAuthorizationMustRunOnServer();

                //Common.CommonHelper.CheckAuthentication();

                var userDto = FetchImpl(username);
                if (userDto == null)
                {
                    throw new Exceptions.UsernameNotFoundException(username);
                }
                retResult = Result <UserDto> .Success(userDto);
            }
            catch (Exception ex)
            {
                var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
                retResult = Result <UserDto> .FailureWithInfo(null, wrapperEx);
            }

            return(retResult);
        }
        public Result<UserDto> GetUser(string username)
        {
            Result<UserDto> retResult = Result<UserDto>.Undefined(null);
              try
              {
            var userDto = GetUserImpl(username);
            if (userDto == null)
              throw new Exceptions.UsernameNotFoundException(username);
            retResult = Result<UserDto>.Success(userDto);
              }
              catch (Exception ex)
              {
            var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
            retResult = Result<UserDto>.FailureWithInfo(null, wrapperEx);
              }

              return retResult;
        }
        public Result<bool?> DeleteUser(string username)
        {
            Result<bool?> retResult = Result<bool?>.Undefined(null);
              try
              {
            var deleteResult = DeleteUserImpl(username);
            if (deleteResult == null)
              throw new Exception();
            retResult = Result<bool?>.Success(deleteResult);
              }
              catch (Exception ex)
              {
            var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
            retResult = Result<bool?>.FailureWithInfo(null, wrapperEx);
              }

              return retResult;
        }
Пример #4
0
        public Result <bool?> Delete(string username)
        {
            Result <bool?> retResult = Result <bool?> .Undefined(null);

            try
            {
                Common.CommonHelper.CheckAuthentication();
                DalHelper.CheckAuthorizationToDeleteUser();
                var deleteResult = DeleteImpl(username);
                if (deleteResult == null)
                {
                    throw new Exception();
                }
                retResult = Result <bool?> .Success(deleteResult);
            }
            catch (Exception ex)
            {
                var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
                retResult = Result <bool?> .FailureWithInfo(null, wrapperEx);
            }

            return(retResult);
        }
Пример #5
0
    public Result<UserDto> Fetch(string username)
    {
      Result<UserDto> retResult = Result<UserDto>.Undefined(null);
      try
      {
        DalHelper.CheckAuthorizationMustRunOnServer();

        //Common.CommonHelper.CheckAuthentication();

        var userDto = FetchImpl(username);
        if (userDto == null)
          throw new Exceptions.UsernameNotFoundException(username);
        retResult = Result<UserDto>.Success(userDto);
      }
      catch (Exception ex)
      {
        var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
        retResult = Result<UserDto>.FailureWithInfo(null, wrapperEx);
      }

      return retResult;
    }
Пример #6
0
    public Result<bool?> Delete(string username)
    {
      Result<bool?> retResult = Result<bool?>.Undefined(null);
      try
      {
        Common.CommonHelper.CheckAuthentication();
        DalHelper.CheckAuthorizationToDeleteUser();
        var deleteResult = DeleteImpl(username);
        if (deleteResult == null)
          throw new Exception();
        retResult = Result<bool?>.Success(deleteResult);
      }
      catch (Exception ex)
      {
        var wrapperEx = new Exceptions.GetUserFailedException(ex, username);
        retResult = Result<bool?>.FailureWithInfo(null, wrapperEx);
      }

      return retResult;
    }