예제 #1
0
        public ResultCodeModel InsertAppTool(AppToolModel appTool)
        {
            _log.Info("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool() starting ...");
            ResultCodeModel result = null;

            if (AppToolValidation.ValidateInputAppTool(appTool))
            {
                if (_appToolAdapter == null)
                {
                    _log.Error(_appToolAdapterExceptionMessage);
                    result = new ResultCodeModel();
                    ErrorModel error = new ErrorModel(_appToolAdapterExceptionMessage, "Web AppTool Service");
                    _log.Error("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool(): " + _appToolAdapterExceptionMessage);
                    result.ErrorList.Add(error);
                }
                else
                {
                    result = _appToolAdapter.SaveAppTool(appTool);
                }
            }
            else
            {
                result = new ResultCodeModel();
                ErrorModel error = new ErrorModel("Invalid information input for this appTool", "Web AppTool Service");
                _log.Error("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool(): Invalid information input for this appTool");
                result.ErrorList.Add(error);
            }


            _log.Info("ASA.Web.Services.AppToolService.ServiceImplementation.InsertAppTool() ending ...");
            return(result);
        }
예제 #2
0
        public static AppToolCanonicalType MapModelToCanonical(AppToolModel appTool)
        {
            //TRANSLATION (AppToolModel --> Canonical)

            AppToolCanonicalType appToolCanonicalType = new AppToolCanonicalType();

            appToolCanonicalType.AppToolTier1                 = new AppToolTier1Type();
            appToolCanonicalType.AppToolTier1.CustomerId      = 2;
            appToolCanonicalType.AppToolTier1.PersonId        = appTool.PersonId;
            appToolCanonicalType.AppToolTier2                 = new AppToolTier2Type();
            appToolCanonicalType.AppToolTier2.AppToolInfoType = new AppToolTier2Type.AppToolInfoTypeType();
            appToolCanonicalType.AppToolTier2.AppToolInfoType.AppToolPersonId             = appTool.AppToolPersonId;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.AppToolType                 = (ApplicationToolType)Enum.ToObject(typeof(ApplicationToolType), appTool.AppToolType);
            appToolCanonicalType.AppToolTier2.AppToolInfoType.BalanceAtStartDeferment     = appTool.BalanceAtStartDeferment;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.ForbearancePaymentAmount    = appTool.ForbearancePaymentAmount;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.InterestRate                = appTool.InterestRate;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.MonthlyIncome               = appTool.MonthlyIncome;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.NumberOfForbearancePayments = appTool.NumberOfForbearancePayments;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.NumberOfMonthsInDeferment   = appTool.NumberOfMonthsInDeferment;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.NumberOfMonthsInForbearance = appTool.NumberOfMonthsInForbearance;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.NumberOfPayments            = appTool.NumberOfPayments;
            appToolCanonicalType.AppToolTier2.AppToolInfoType.PrincipalAmount             = appTool.PrincipalAmount;
            //appToolCanonicalType.AppToolTier2.AppToolInfoType.RecordVersion = appTool.RecordVersion;

            return(appToolCanonicalType);
        }
예제 #3
0
        public AppToolModel GetAppTool(string toolType)//(string personId, string toolType)
        {
            AppToolModel AppTool = null;

            string personId = ""; // TODO: get "individualId" from security context here, and use that value.

            if (AppToolValidation.ValidateSearchId(personId) && AppToolValidation.ValidateSearchId(toolType))
            {
                int searchId; int toolTypeId;
                if (Int32.TryParse(personId, out searchId) && Int32.TryParse(toolType, out toolTypeId))
                {
                    if (_appToolAdapter == null)
                    {
                        _log.Error(_appToolAdapterExceptionMessage);
                        AppTool = new AppToolModel();
                        ErrorModel error = new ErrorModel(_appToolAdapterExceptionMessage, "Web AppTool Service");
                        AppTool.ErrorList.Add(error);
                    }
                    else
                    {
                        AppTool = _appToolAdapter.GetAppTool(searchId, toolTypeId);
                    }
                }
            }
            else
            {
                AppTool = new AppToolModel();
                ErrorModel error = new ErrorModel("Invalid search criteria", "Web AppTool Service");
                AppTool.ErrorList.Add(error);
            }

            return(AppTool);
        }
예제 #4
0
 public static bool ValidateInputAppTool(AppToolModel atModel)
 {
     if (atModel == null)
     {
         return(false);
     }
     return(atModel.IsValid());
 }
예제 #5
0
        // TRANSLATION (SOAP --> AppToolModel)
        public static AppToolModel MapGetResponseToModel(GetAppToolResponse response)
        {
            AppToolModel appTool = new AppToolModel();

            if (response != null)
            {
                if (response.AppToolCanonicalList != null &&
                    response.AppToolCanonicalList.Length > 0
                    )
                {
                    if (response.AppToolCanonicalList[0].AppToolTier1 != null)
                    {
                        appTool.PersonId = response.AppToolCanonicalList[0].AppToolTier1.PersonId;
                    }

                    if (response.AppToolCanonicalList[0].AppToolTier2 != null &&
                        response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType != null)
                    {
                        appTool.AppToolPersonId             = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.AppToolPersonId;
                        appTool.AppToolType                 = (int)response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.AppToolType;
                        appTool.BalanceAtStartDeferment     = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.BalanceAtStartDeferment;
                        appTool.ForbearancePaymentAmount    = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.ForbearancePaymentAmount;
                        appTool.InterestRate                = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.InterestRate;
                        appTool.MonthlyIncome               = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.MonthlyIncome;
                        appTool.NumberOfForbearancePayments = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.NumberOfForbearancePayments;
                        appTool.NumberOfMonthsInDeferment   = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.NumberOfMonthsInDeferment;
                        appTool.NumberOfMonthsInForbearance = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.NumberOfMonthsInForbearance;
                        appTool.NumberOfPayments            = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.NumberOfPayments;
                        appTool.PrincipalAmount             = response.AppToolCanonicalList[0].AppToolTier2.AppToolInfoType.PrincipalAmount;
                    }
                }
                else if (response.ResponseMessageList != null && response.ResponseMessageList.Count > 0)
                {
                    for (int i = 0; i < response.ResponseMessageList.Count; i++)
                    {
                        ErrorModel error = new ErrorModel(response.ResponseMessageList[i].MessageDetails, "Web AppTool Service", response.ResponseMessageList[i].ResponseCode);
                        appTool.ErrorList.Add(error);
                    }
                }
                else
                {
                    ErrorModel error = new ErrorModel("An error occured when trying to retrieve AppTool information", "Web AppTool Service");
                    appTool.ErrorList.Add(error);
                }
            }
            else
            {
                ErrorModel error = new ErrorModel("No valid response was received from the service", "Web AppTool Service");
                appTool.ErrorList.Add(error);
            }
            // then map from response to AppToolModel...
            return(appTool);
        }
예제 #6
0
 public ResultCodeModel SaveAppTool(AppToolModel appTool)
 {
     return(MockJsonLoader.GetJsonObjectFromFile <ResultCodeModel>("AppToolService", "AppToolObject"));
 }
예제 #7
0
        public ResultCodeModel SaveAppTool(AppToolModel appTool)
        {
            AppToolCanonicalType canonicalAppTool = TranslateAppToolModel.MapModelToCanonical(appTool);

            return(_proxy.SaveAppTool(canonicalAppTool));
        }