Example #1
0
 public GetUserRequestsResponse SearchRequestsByNumber(string sessionId, string authenticationId, string requestNumber)
 {
     var response = new GetUserRequestsResponse { IsSuccess = true };
     try
     {
         IAuthenticationProvider authProvider = AuthenticationProviderFactory.GetAuthenticationProvider();
         if (authProvider.Validate(authenticationId))
         {
             string accountId = authProvider.GetAccountId(authenticationId);
             if (!string.IsNullOrEmpty(accountId))
             {
                 IRequestProvider requestProvider = RequestProviderFactory.GetRequestProvider();
                 var request = requestProvider.SearchRequestByNumber(requestNumber);
                 if (request != null)
                 {
                     response.Requests = new List<Request> {request.ToDataContract()};
                 }
                 else
                 {
                     response.IsSuccess = false;
                     response.ErrorMessage = "Request not found for request id";
                 }
             }
             else
             {
                 response.IsSuccess = false;
                 response.ErrorMessage = "Account not found! Please SignIn or SingUp";
             }
         }
     }
     catch (Exception ex)
     {
         Logger.LogException(ex, Source, "GetUserRequests", Severity.Major);
         response.IsSuccess = false;
         response.ErrorMessage = ex.ToString();
     }
     return response;
 }
Example #2
0
 public GetUserRequestsResponse GetUserRequests(string authenticationId, string sessionId)
 {
     var response = new GetUserRequestsResponse { IsSuccess = true };
     try
     {
         IAuthenticationProvider authProvider = AuthenticationProviderFactory.GetAuthenticationProvider();
         if (authProvider.Validate(authenticationId))
         {
             string accountId = authProvider.GetAccountId(authenticationId);
             if (!string.IsNullOrEmpty(accountId))
             {
                 IRequestProvider requestProvider = RequestProviderFactory.GetRequestProvider();
                 List<Core.Model.Request> requests = requestProvider.GetRequestsByAccountId(accountId);
                 response.Requests = new List<Request>();
                 if (requests != null && requests.Count > 0)
                 {
                     foreach (Core.Model.Request request in requests)
                     {
                         response.Requests.Add(request.ToDataContract());
                     }
                 }
             }
             else
             {
                 response.IsSuccess = false;
                 response.ErrorMessage = "Account not found! Please SignIn or SingUp";
             }
         }
     }
     catch (Exception ex)
     {
         Logger.LogException(ex, Source, "GetUserRequests", Severity.Major);
         response.IsSuccess = false;
         response.ErrorMessage = ex.ToString();
     }
     return response;
 }