Example #1
0
        /// <summary>
        ///     Method returns address corrections and details based on street number, street address and borough for NYC properties
        /// </summary>
        public static void PostCallBack(Common.Context appContext, BAL.Results result)
        {
            string username = appContext.getUserName().ToLower();

            ApiDetails apiDetails = GetApiDetails(username);

            if (apiDetails == null)
            {
                return;
            }

            PostCallBack(apiDetails.baseURL, apiDetails.callbackapi, apiDetails.apiKey, username, result);
        }
Example #2
0
        public IHttpActionResult GetRequestByExternalReferenceId(string externalReferenceId)
        {
            using (WebDataEntities webDataE = new WebDataEntities())
            {
                List <DataRequestLog> requestLogList = DAL.DataRequestLog.GetAll(webDataE, externalReferenceId);
                if (requestLogList == null)
                {
                    return(NotFound());
                }

                var result = new BAL.Results();
                foreach (var requestLogObj in requestLogList)
                {
                    switch (requestLogObj.RequestTypeId)
                    {
                    case (int)RequestTypes.NYCTaxBill:
                        result.taxBill = BAL.TaxBill.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.NYCWaterBill:
                        result.waterBill = BAL.WaterBill.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.NYCMortgageServicer:
                        result.mortgageServicer = BAL.MortgageServicer.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.NYCDOBPenaltiesAndViolations:
                        result.dobPenaltiesAndViolationsSummary = BAL.DOBPenaltiesAndViolationsSummary.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.Zillow:
                        result.zillowProperty = BAL.Zillow.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.NYCNoticeOfPropertyValue:
                        result.noticeOfPropertyValueResult = BAL.NoticeOfPropertyValueDocument.ReRun(requestLogObj);
                        break;

                    case (int)RequestTypes.NYCMortgageDocumentDetails:
                        result.mortgageDocumentResult = BAL.MortgageDocument.ReRun(requestLogObj);
                        break;

                    default:
                        break;
                    }
                }
                return(Ok(result));
            }
        }
Example #3
0
        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"));
                }
            }
        }
Example #4
0
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, bool?isFreddieMacMortgage)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.freddieMacResult = new FreddieMortgageDetails();
            resultObj.freddieMacResult.isFreddieMortgage = isFreddieMacMortgage;

            foreach (var rec in logs)
            {
                resultObj.mortgageServicer.BBL                 = rec.BBL;
                resultObj.mortgageServicer.requestId           = rec.RequestId;
                resultObj.mortgageServicer.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.mortgageServicer.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
Example #5
0
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, Decimal?billAmount)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.waterBill            = new WaterBillDetails();
            resultObj.waterBill.billAmount = billAmount;

            foreach (var rec in logs)
            {
                resultObj.waterBill.BBL                 = rec.BBL;
                resultObj.waterBill.requestId           = rec.RequestId;
                resultObj.waterBill.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.waterBill.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, WebDataDB.Mortgage mortgageDocumentResultObj)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.mortgageDocumentResult = new MortgageDocumentResult();
            resultObj.mortgageDocumentResult.mortgageDetails = mortgageDocumentResultObj;

            foreach (var rec in logs)
            {
                resultObj.mortgageDocumentResult.BBL                 = rec.BBL;
                resultObj.mortgageDocumentResult.requestId           = rec.RequestId;
                resultObj.mortgageDocumentResult.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.mortgageDocumentResult.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
Example #7
0
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        /// <param name="appContext"></param>
        /// <param name="zEstimate"></param>
        /// <param name="logs">List or Request Log Records</param>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, Decimal?zEstimate)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.zillowProperty           = new ZillowPropertyDetails();
            resultObj.zillowProperty.zEstimate = zEstimate;

            foreach (var rec in logs)
            {
                resultObj.zillowProperty.BBL                 = rec.BBL;
                resultObj.zillowProperty.requestId           = rec.RequestId;
                resultObj.zillowProperty.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.zillowProperty.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
Example #8
0
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, NoticeOfProperyValue noticeOfPropertyValueObj)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.noticeOfPropertyValueResult = new NoticeOfPropertyValueResult();
            resultObj.noticeOfPropertyValueResult.noticeOfPropertyValue = noticeOfPropertyValueObj;

            foreach (var rec in logs)
            {
                resultObj.noticeOfPropertyValueResult.BBL                 = rec.BBL;
                resultObj.noticeOfPropertyValueResult.requestId           = rec.RequestId;
                resultObj.noticeOfPropertyValueResult.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.noticeOfPropertyValueResult.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
Example #9
0
        /// <summary>
        ///     This method calls back portal for every log record in the list
        /// </summary>
        private static void MakeCallBacks(Common.Context appContext, List <DataRequestLog> logs, decimal?penaltyAmount, decimal?violationAmount)
        {
            if (!CallingSystem.isAnyCallBack(appContext))
            {
                return;
            }

            var resultObj = new BAL.Results();

            resultObj.dobPenaltiesAndViolationsSummary = new DOBPenaltiesAndViolationsSummaryData();
            resultObj.dobPenaltiesAndViolationsSummary.civilPenaltyAmount = penaltyAmount;
            resultObj.dobPenaltiesAndViolationsSummary.violationAmount    = violationAmount;

            foreach (var rec in logs)
            {
                resultObj.dobPenaltiesAndViolationsSummary.BBL                 = rec.BBL;
                resultObj.dobPenaltiesAndViolationsSummary.requestId           = rec.RequestId;
                resultObj.dobPenaltiesAndViolationsSummary.status              = ((RequestStatus)rec.RequestStatusTypeId).ToString();
                resultObj.dobPenaltiesAndViolationsSummary.externalReferenceId = rec.ExternalReferenceId;
                CallingSystem.PostCallBack(appContext, resultObj);
            }
        }
Example #10
0
        /// <summary>
        ///     Method returns address corrections and details based on street number, street address and borough for NYC properties
        /// </summary>
        public static void PostCallBack(string baseURL, string api, string apiKey, string username, BAL.Results result)
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri(baseURL);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Add("apiKey", apiKey);

            try
            {
                HttpResponseMessage response = client.PostAsJsonAsync(api, result).Result;
                if (!response.IsSuccessStatusCode)
                {
                    Common.Logs.log().Error(string.Format("{0} API callback failed with status code {1}", username, response.StatusCode));
                }
            }
            catch (Exception e)
            {
                Common.Logs.log().Error(string.Format("{0} API callback failed{1}", username, Common.Logs.FormatException(e)));
            }
        }