/// <summary> /// Inserts a DataRequestLog object(row) for a given BBL and type of request when data (not stale) is found in WebData DB /// </summary> public static WebDataDB.DataRequestLog InsertForFailure(string propertyBBL, int requestTypeId, string externalReferenceId, string jobId, string requestParameters) { WebDataDB.DataRequestLog dataRequestLogObj = new WebDataDB.DataRequestLog(); using (WebDataEntities webDBEntities = new WebDataEntities()) { try { dataRequestLogObj.BBL = propertyBBL; dataRequestLogObj.RequestStatusTypeId = (int)RequestStatus.Error; dataRequestLogObj.RequestTypeId = requestTypeId; dataRequestLogObj.RequestDateTime = DateTime.UtcNow; dataRequestLogObj.ExternalReferenceId = externalReferenceId; dataRequestLogObj.JobId = jobId; dataRequestLogObj.ServedFromCache = false; dataRequestLogObj.WebDataRequestMade = false; dataRequestLogObj.RequestParameters = requestParameters; dataRequestLogObj = webDBEntities.DataRequestLogs.Add(dataRequestLogObj); webDBEntities.SaveChanges(); return(dataRequestLogObj); } catch (Exception e) { Common.Logs.log().Error(string.Format("Exception encountered request for BBL {0} for Request Type {1} with externalRefId {2}{3}", propertyBBL, ((RequestStatus)requestTypeId).ToString(), externalReferenceId, Common.Logs.FormatException(e))); return(null); } } }
public IHttpActionResult GetRequest(long requestId) { using (WebDataEntities webDataE = new WebDataEntities()) { WebDataDB.DataRequestLog requestLogObj = DAL.DataRequestLog.GetFirst(webDataE, requestId); if (requestLogObj == null) { return(NotFound()); } var result = new BAL.Results(); switch (requestLogObj.RequestTypeId) { case (int)RequestTypes.NYCTaxBill: result.taxBill = BAL.TaxBill.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.NYCWaterBill: result.waterBill = BAL.WaterBill.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.NYCMortgageServicer: result.mortgageServicer = BAL.MortgageServicer.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.NYCDOBPenaltiesAndViolations: result.dobPenaltiesAndViolationsSummary = BAL.DOBPenaltiesAndViolationsSummary.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.Zillow: result.zillowProperty = BAL.Zillow.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.NYCNoticeOfPropertyValue: result.noticeOfPropertyValueResult = BAL.NoticeOfPropertyValueDocument.ReRun(requestLogObj); return(Ok(result)); case (int)RequestTypes.NYCMortgageDocumentDetails: result.mortgageDocumentResult = BAL.MortgageDocument.ReRun(requestLogObj); return(Ok(result)); default: return(BadRequest("Bad Request - Incorrect Request Type")); } } }
/// <summary> /// Inserts a DataRequestLog object(row) for a given BBL and type of request when data (not stale) is found in WebData DB /// </summary> public static WebDataDB.DataRequestLog InsertForCacheAccess(WebDataEntities webDBEntities, string propertyBBL, int requestTypeId, string externalReferenceId, string jobId, string requestParameters) { WebDataDB.DataRequestLog dataRequestLogObj = new WebDataDB.DataRequestLog(); dataRequestLogObj.BBL = propertyBBL; dataRequestLogObj.RequestStatusTypeId = (int)RequestStatus.Success; dataRequestLogObj.RequestTypeId = requestTypeId; dataRequestLogObj.RequestDateTime = DateTime.UtcNow; dataRequestLogObj.ExternalReferenceId = externalReferenceId; dataRequestLogObj.JobId = jobId; dataRequestLogObj.ServedFromCache = true; dataRequestLogObj.WebDataRequestMade = false; dataRequestLogObj.RequestParameters = requestParameters; dataRequestLogObj = webDBEntities.DataRequestLogs.Add(dataRequestLogObj); webDBEntities.SaveChanges(); return(dataRequestLogObj); }