public COLResponseModel GetCOLResults(string cityA, string cityB, string salary) { const string logMethodName = ".GetCOLResults(string cityA, string cityB, string salary) - "; _log.Info(logMethodName + "Begin Method"); COLResponseModel colResponseModel = null; //validate fields required for this request. COLRequestModel request = new COLRequestModel(); if (!String.IsNullOrEmpty(cityA)) { request.CityA = Convert.ToInt32(cityA); } if (!String.IsNullOrEmpty(cityB)) { request.CityB = Convert.ToInt32(cityB); } if (!String.IsNullOrEmpty(salary)) { request.Salary = Convert.ToDecimal(salary); } ASAModelValidator mv = new ASAModelValidator(); string[] fieldNames = { "CityA", "CityB", "Salary" }; bool validModel = mv.Validate(request, fieldNames); if (validModel) { try { if (_surveyAdapter == null) { _log.Error(logMethodName + _surveyAdapterExceptionMessage); throw new SurveyBadDataException("Null adapter in ASA.Web.Services.SurveyService.GetCOLUrbanAreaList()"); } else { COLResponseModel resultsModel = _surveyAdapter.GetCOLResults(request); colResponseModel = resultsModel; } } catch (Exception ex) { _log.Error(logMethodName + "Exception => " + ex.ToString()); throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.GetCOLUrbanAreaList()", ex); } } else { colResponseModel = new COLResponseModel(); colResponseModel.ErrorList = request.ErrorList.ToList(); } _log.Info(logMethodName + "End Method"); return(colResponseModel); }
/// <summary> /// Gets the CostOfLiving results. /// </summary> /// <param name="request">The COLRequestModel with the CityA, "CityB and Salary provided.</param> /// <returns>COLResponseModel with COLCostBreakDownModel and NeededSalary & percentageSalaryChange</returns> /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLStateList()</exception> public COLResponseModel GetCOLResults(COLRequestModel request) { const string logMethodName = ".GetCOLResults(COLRequestModel request) - "; Log.Info(logMethodName + "Begin Method"); var colResponseModel = new COLResponseModel(); try { colResponseModel = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetCOLResults((int)request.CityA, (int)request.CityB, (decimal)request.Salary).ToDomainObject(); } catch (Exception ex) { Log.Error(logMethodName + "Exception =>" + ex.ToString()); throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetCOLResults()", ex); } Log.Info(logMethodName + "End Method"); return(colResponseModel); }