public ResponseDto GetAllMailroomRequests(GetMailroomRequestDto dto) { try { Logger.Info("Just entered GetAllMailroomRequests function"); var ResponseDto = new ResponseDto(); Logger.Info("About to call GetMailroomRequestList function"); var resp = GetMailroomRequestList(dto); if (resp == null) { ResponseDto.StatusCode = 1001; ResponseDto.Message = ""; ResponseDto.Error = "Unable to process request, please try again later."; return(ResponseDto); } Logger.Info("Response from GetMailroomRequestList function is: " + JsonConvert.SerializeObject(resp)); ResponseDto.StatusCode = 1000; ResponseDto.Message = JsonConvert.SerializeObject(resp); ResponseDto.Error = ""; return(ResponseDto); } catch (Exception ex) { Logger.Error("GetMailroomRequestList function entered an exception"); Logger.Error(ex); return(null); } }
public IEnumerable <GetAllRequestForUserDto> GetMailroomRequestList(GetMailroomRequestDto dto) { try { Logger.Info("Just entered GetMailroomRequestList function"); using (var db = new EOneContext()) { var list = db.ExecuteQuery <GetAllRequestForUserDto>("select * from Courier_Tracker where Dispatch_Rider_Name is not Null and Dispatch_Rider_Pickup_DateTime is not Null and Central_Mailroom_Officer is Null and Central_Mailroom_Date is Null", new Object[] { }).ToList(); return(list); } } catch (Exception ex) { Logger.Error("GetMailroomRequestList function entered an exception"); Logger.Error(ex); return(null); } }
public HttpResponseMessage GetRequest(GetMailroomRequestDto dto) { if (!ModelState.IsValid) { var errorList = (from item in ModelState.Values from error in item.Errors select error.ErrorMessage).ToArray(); return(new HttpResponseMessage(HttpStatusCode.BadRequest) { RequestMessage = Request, ReasonPhrase = JsonConvert.SerializeObject(errorList) }); } var resp = courierService.GetAllMailroomRequests(dto); if (resp == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest) { RequestMessage = Request, ReasonPhrase = "" }); } return(Request.CreateResponse(HttpStatusCode.OK, resp, "application/json")); }