/// <summary> /// jsiQuizModel to its data contract. /// </summary> /// <param name="response">The JSI Quiz Response model </param> /// <returns></returns> public static JSIQuizAnswerContract ToDataContract(this JSIQuizModel jsiQuizModel) { return(new JSIQuizAnswerContract() { MemberID = jsiQuizModel.MemberId > 0 ? jsiQuizModel.MemberId : 0, RefMajorID = Convert.ToInt32(jsiQuizModel.MajorId), RefSalaryEstimatorSchoolID = Convert.ToInt32(jsiQuizModel.SchoolId) }); }
/// <summary> /// Converts JSIResult contracts to the domain JSI ? object. /// </summary> /// <param name="jsiQuestionsContracts">The jsiQuestions contracts.</param> /// <returns>List of JSIQuizModel</returns> public static List <JSIQuizModel> ToDomainObject(this List <JSIQuizResultContract> jsiQuizResultContracts) { var toReturn = new List <JSIQuizModel>() { }; var model = new JSIQuizModel() { }; foreach (var item in jsiQuizResultContracts) { toReturn.Add(new JSIQuizModel() { OccupationName = item.OccupationName, EstimatedSalaryAmount = item.EstimatedSalaryAmount }); } return(toReturn); }
/// <summary> /// Converts JSISchoolMajor contracts to the domain JSI ? object. /// </summary> /// <param name="jsiQuestionsContracts">The jsiQuestions contracts.</param> /// <returns>List of JSIQuizModel</returns> public static List <JSIQuizModel> ToDomainObject(this List <JSISchoolMajorContract> jsiSchoolMajorContracts) { var toReturn = new List <JSIQuizModel>() { }; var model = new JSIQuizModel() { }; foreach (var item in jsiSchoolMajorContracts) { toReturn.Add(new JSIQuizModel() { School = item.SchoolName, SchoolId = item.SchoolID.ToString() }); } return(toReturn); }
/// <summary> /// Converts RefMajor contracts to the domain JSI ? object. /// </summary> /// <param name="jsiQuestionsContracts">The jsiQuestions contracts.</param> /// <returns>List of JSIQuizModel</returns> public static List <JSIQuizModel> ToDomainObject(this List <RefMajorContract> refMajorContracts) { var toReturn = new List <JSIQuizModel>() { }; var model = new JSIQuizModel() { }; foreach (var item in refMajorContracts) { toReturn.Add(new JSIQuizModel() { Major = item.MajorName, MajorId = item.RefMajorID.ToString() }); } return(toReturn); }
/// <summary> /// Converts RefState contracts to the domain JSI ? object. /// </summary> /// <param name="jsiQuestionsContracts">The jsiQuestions contracts.</param> /// <returns>List of JSIQuizModel</returns> public static List <JSIQuizModel> ToDomainObject(this List <RefStateContract> refStateContracts) { var toReturn = new List <JSIQuizModel>() { }; var model = new JSIQuizModel() { }; foreach (var item in refStateContracts) { toReturn.Add(new JSIQuizModel() { State = item.StateName, StateCd = item.StateCode, StateId = item.RefStateID.ToString() }); } return(toReturn); }
/// <summary> /// Post the results of the JSI quiz. /// </summary> /// <param name="jsiQuizModel">single JSIQuizModel object</param> /// <returns>?</returns> public JSIQuizListModel PostJSIResponse(JSIQuizModel jsiQuizModel) { const string logMethodName = ".PostJSIResponse(JSIQuizModel jsiQuizModel) - "; Log.Info(logMethodName + "Begin Method"); var jList = new JSIQuizListModel(); try { var jsiQuizResult = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").PostJSIResponse(jsiQuizModel.ToDataContract()).ToDomainObject(); jList = new JSIQuizListModel(jsiQuizResult); } catch (Exception ex) { Log.Error(logMethodName + "Exception =>" + ex.ToString()); throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetJSISchoolList()", ex); } Log.Info(logMethodName + "End Method"); return(jList); }
public JSIQuizListModel PostJSIResponse(JSIQuizModel jsiQuizModel) { const string logMethodName = ".PostJSIResponse(JSIQuizModel jsiQuizModel) - "; _log.Debug(logMethodName + "Begin Method"); JSIQuizListModel jList = null; try { if (_surveyAdapter == null) { _log.Error(logMethodName + _surveyAdapterExceptionMessage); throw new SurveyBadDataException("Null adapter in ASA.Web.Services.SurveyService.PostJSIResponse()"); } if (string.IsNullOrEmpty(jsiQuizModel.MajorId) || string.IsNullOrEmpty(jsiQuizModel.SchoolId)) { _log.Info(logMethodName + "MajorId or SchoolId was not provided to access PostJSIResponse"); jList = new JSIQuizListModel(); var error = new ErrorModel("MajorId or SchoolId was not provided to access PostJSIResponse", "Web Survey Service"); jList.ErrorList.Add(error); } else { jList = _surveyAdapter.PostJSIResponse(jsiQuizModel); } return(jList); } catch (Exception ex) { _log.Error(logMethodName + ": Exception => " + ex.ToString()); return(new JSIQuizListModel()); //return false; //throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.PostJellyVisionQuizResponse()", ex); } }