Beispiel #1
0
        public ResultCodeModel SaveSelfReported(LoanCanonicalType SelfReported)
        {
            ResultCodeModel rcm = new ResultCodeModel();

            rcm.ResultCode = 1;// Success.
            return(rcm);
        }
Beispiel #2
0
        public ResultCodeModel DeleteAlert(string alertId)
        {
            const string logMethodName = ".DeleteAlert(string alertId) - ";

            _log.Debug(logMethodName + "Begin Method");

            var result = new ResultCodeModel();

            if (!AlertValidation.ValidateAlertId(alertId))
            {
                _log.Info(logMethodName + "Null or empty alertId in ASA.Web.Services.AlertService.DeleteAlert().");
                throw new AlertBadDataException("Null, empty, or invalid format alert ID in ASA.Web.Services.AlertService.AlertAdapter.DeleteAlert().");
            }

            else
            {
                try
                {
                    result = _alertAdapter.DeleteAlert(alertId);
                }
                catch (Exception ex)
                {
                    _log.Error(logMethodName + "ASA.Web.Services.AlertService.DeleteAlert(): Exception => " + ex.ToString());
                    throw new AlertOperationException("Web Alert Service - Exception in ASA.Web.Services.AlertService.DeleteAlert()", ex);
                }
            }

            _log.Debug(logMethodName + "End Method");
            return(result);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public ResultCodeModel SaveAppTool(AppToolCanonicalType appTool)
        {
            ResultCodeModel rcm = new ResultCodeModel();

            rcm.ResultCode = 1;// Success.
            return(rcm);
        }
Beispiel #5
0
        public void Test_SaveNew_SelfReportedLoanForPerson()
        {
            SelfReportedLoanModel srlModel = GetValidSelfReportedLoanData();

            ASA.Web.Services.SelfReportedService.SelfReported srlAbstraction = new ASA.Web.Services.SelfReportedService.SelfReported();
            ResultCodeModel result = new ResultCodeModel(1); //srlAbstraction.SaveSelfReportedLoan(srlModel);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.ErrorList.Count == 0, "ErrorList.Count != 0");
        }
Beispiel #6
0
        public ResultCodeModel SaveSelfReported(LoanCanonicalType SelfReported)
        {
            _log.Info("InvokeSelfReportedService.SaveSelfReported() starting ...");
            LoanManagementClient        client      = null;
            Dictionary <string, string> paramList   = null;
            ResponseMessageList         messageList = new ResponseMessageList();

            //try/catch here, and handle results/errors appropriately...
            ResultCodeModel result = new ResultCodeModel();


            try
            {
                client            = new LoanManagementClient();
                result.ResultCode = client.SaveLoanSelfReportedEntry(paramList, ref SelfReported, out messageList);
            }
            catch (TimeoutException timeout)
            {
                ErrorModel error = new ErrorModel("There was a timeout problem calling the SelfReported Management Service", "InvokeSelfReportedMangementService");
                result.ErrorList.Add(error);
                result.ResultCode = 2;//FAIL;
                ProxyHelper.HandleServiceException(client);
                _log.Error("InvokeSelfReportedService.SaveSelfReported() Timeout Exception:" + timeout.Message);
            }
            catch (CommunicationException comm)
            {
                ErrorModel error = new ErrorModel("There was a communication problem calling the SelfReported Management Service", "InvokeSelfReportedMangementService");
                result.ErrorList.Add(error);
                result.ResultCode = 2;//FAIL;
                ProxyHelper.HandleServiceException(client);
                _log.Error("InvokeSelfReportedService.SaveSelfReported() Communication Exception:" + comm.Message);
            }
            catch (Exception e)
            {
                ErrorModel error = new ErrorModel("There was an exception thrown calling the SelfReported Management Service", "InvokeSelfReportedMangementService");
                result.ErrorList.Add(error);
                result.ResultCode = 2;//FAIL;
                _log.Error("InvokeSelfReportedService.SaveSelfReported() Exception:" + e.Message);
            }
            finally
            {
                if (client != null && client.State != CommunicationState.Closed)
                {
                    ProxyHelper.CloseChannel(client);
                }
            }


            _log.Info("InvokeSelfReportedService.SaveSelfReported() ending ...");
            return(result);
        }
Beispiel #7
0
        public ResultCodeModel InsertSurvey(SurveyModel survey)
        {
            ResultCodeModel result;

            try
            {
                var memberAdapter = new AsaMemberAdapter();
                //add system data
                //response status will be hardcoded in deployment scripts so it will be the same for all environments
                survey.ResponseDate   = DateTime.Now;
                survey.ResponseStatus = "21B65800-5F9A-421F-9E82-DA13B111F790";
                survey.MemberId       = memberAdapter.GetMemberIdFromContext();

                if (SurveyValidation.ValidateSurvey(survey))
                {
                    _log.Info("ASA.Web.Services.SurveyService.InsertSurvey() starting ...");
                    result = _surveyAdapter.InsertSurvey(survey);
                    _log.Info("ASA.Web.Services.SurveyService.InsertSurvey() ending ...");
                }
                else
                {
                    result = new ResultCodeModel();
                    var error = new ErrorModel("Invalid information input for this survey", "Web Survey Service");
                    _log.Error("ASA.Web.Services.SurveyService.InsertSurvey(): Invalid information input for this survey");
                    result.ErrorList.Add(error);

                    if (Config.Testing)
                    {
                        //get validation errors out of list and retrun them
                        if (survey.ErrorList.Count > 0)
                        {
                            foreach (ErrorModel em in survey.ErrorList)
                            {
                                //if not empty copy message
                                if (!string.IsNullOrEmpty(em.Code))
                                {
                                    result.ErrorList.Add(em);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("ASA.Web.Services.SurveyService.InsertSurvey(): Exception => " + ex.ToString());
                throw new SurveyOperationException("Web Survey Service - Exception in ASA.Web.Services.SurveyService.InsertSurvey()", ex);
            }

            return(result);
        }
Beispiel #8
0
        public static ResultCodeModel MapXmlNodeToResultCodeModel(XmlNode node)
        {
            ResultCodeModel result = new ResultCodeModel();

            if (node != null && node.ChildNodes != null)
            {
                result.ResultCode = 1;
            }
            else
            {
                result.ResultCode = 0;
                ErrorModel e = new ErrorModel("There was a problem with a call to xWeb for Insert/Update of ASASelfReportedLoans.");
                result.ErrorList.Add(e);
            }
            return(result);
        }
Beispiel #9
0
        private ResultCodeModel getCombinedResults(ResultCodeModel insertResult, ResultCodeModel updateResult, int insertCount, int updateCount)
        {
            ResultCodeModel result         = new ResultCodeModel();
            bool            bInsertSuccess = true;
            bool            bUpdateSuccess = true;

            if (updateResult.ResultCode == 2)
            {
                result.ResultCode = 2;
            }
            else
            {
                if (insertResult.ResultCode == 0)
                {
                    bInsertSuccess = false;
                }
                if (updateResult.ResultCode == 0)
                {
                    bUpdateSuccess = false;
                }

                if (bInsertSuccess && bUpdateSuccess)
                {
                    result.ResultCode = 1;  //complete success
                }
                else if (bUpdateSuccess || bInsertSuccess)
                {
                    result.ResultCode = 2; //partial success
                }
                else
                {
                    result.ResultCode = 0;
                }
            }

            foreach (ErrorModel e in insertResult.ErrorList)
            {
                result.ErrorList.Add(e);
            }
            foreach (ErrorModel e in updateResult.ErrorList)
            {
                result.ErrorList.Add(e);
            }

            return(result);
        }
Beispiel #10
0
        /// <summary>
        /// Des the activate account.
        /// </summary>
        /// <param name="activeDirectoryKey">The active directory key.</param>
        /// <returns></returns>
        public ResultCodeModel DeActivateAccount(string activeDirectoryKey)
        {
            const string logMethodName = "DeActivateAccount(string activeDirectoryKey) - ";

            Log.Debug(logMethodName + "Begin Method");
            var toReturn = new ResultCodeModel(1);
            var member   = GetMember(new Guid(activeDirectoryKey));

            if (member != null)
            {
                IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").DeactivateUser(GetMemberIdFromContext(), member.PrimaryEmailKey.ToString());
            }

            Log.Debug(logMethodName + "End Method");

            return(toReturn);
        }
Beispiel #11
0
        public ResultCodeModel UpdateSelfReportedLoan(SelfReportedLoanModel srLoan)
        {
            ResultCodeModel result = new ResultCodeModel();

            if (srLoan == null)
            {
                _log.Info("Null SelfReportedLoan object in ASA.Web.Services.SelfReportedService.SelfReportedAdapter.UpdateSelfReportedLoan.");
            }
            else
            {
                // UPDATE
                //xWebWrapper xWeb = new xWebWrapper();
                //XmlNode node = TranslateSelfReportedModel.MapSelfReportedLoanToXmlNode(srLoan);
                //node = xWeb.UpdateFacadeObject("ASASelfReportedLoan", srLoan.LoanSelfReportedEntryId, node);
                //result = TranslateSelfReportedModel.MapXmlNodeToResultCodeModel(node);
            }

            return(result);
        }
Beispiel #12
0
        public ResultCodeModel UpdateSelfReportedLoans(SelfReportedLoanListModel srLoans)
        {
            ResultCodeModel resultModel        = new ResultCodeModel();
            bool            bHadSuccess        = false;
            bool            bHadPartialSuccess = false;
            bool            bHadFail           = false;

            if (srLoans != null && srLoans.Loans.Count > 0)
            {
                foreach (SelfReportedLoanModel srl in srLoans.Loans)
                {
                    resultModel = UpdateSelfReportedLoan(srl);
                    if (resultModel.ResultCode == 1)
                    {
                        bHadSuccess = true;
                    }
                    else if (resultModel.ResultCode == 2)
                    {
                        bHadPartialSuccess = true;
                    }
                    else
                    {
                        bHadFail = true;
                    }
                }

                if (bHadPartialSuccess || (bHadFail && bHadSuccess))
                {
                    resultModel.ResultCode = 2;
                }
                else if (bHadFail)
                {
                    resultModel.ResultCode = 0;
                }
                else
                {
                    resultModel.ResultCode = 1;
                }
            }

            return(resultModel);
        }
Beispiel #13
0
        /// <summary>
        /// Saves the reminders.
        /// </summary>
        /// <param name="rList">The r list.</param>
        /// <returns></returns>
        /// <exception cref="ReminderOperationException">Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders()</exception>
        public ResultCodeModel SaveReminders(ReminderListModel rList)
        {
            var toReturn = new ResultCodeModel(1);

            try
            {
                var memberAdapter = new AsaMemberAdapter();
                int memberId      = memberAdapter.GetMemberIdFromContext();
                foreach (var r in rList.Reminders)
                {
                    r.MemberId = memberId;
                }

                rList.Reminders = rList.Reminders.Where(r => r.IsActive).ToList();

                var result = SaltServiceAgent.SaveUserPaymentReminders(memberId, rList.ToDataContract());

                switch (result)
                {
                case RemindersUpdateStatus.Failure:
                    toReturn.ResultCode = 0;
                    break;

                case RemindersUpdateStatus.Success:
                    toReturn.ResultCode = 1;
                    break;

                case RemindersUpdateStatus.PartialSuccess:
                    toReturn.ResultCode = 2;
                    break;
                }
            }

            catch (Exception ex)
            {
                _log.Error("ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders(): Exception =>" + ex.ToString());
                throw new ReminderOperationException("Web Reminder Service - ASA.Web.Services.ReminderService.ReminderAdapter.SaveReminders()", ex);
            }

            return(toReturn);
        }
Beispiel #14
0
        public ResultCodeModel SaveSelfReportedLoans(SelfReportedLoanListModel srList)
        {
            ResultCodeModel           insertResult = new ResultCodeModel(); insertResult.ResultCode = 1;
            ResultCodeModel           updateResult = new ResultCodeModel(); updateResult.ResultCode = 1;
            SelfReportedLoanListModel srInsertList = new SelfReportedLoanListModel();
            SelfReportedLoanListModel srUpdateList = new SelfReportedLoanListModel();

            //QC 4712: do not save any SRLs that do not belong to the person logged-in.
            srList = RemoveInvalidLoansFromList(srList);

            LogSRLData("after RemoveInvalidLoansFromList(srLoans) call", srList);

            foreach (SelfReportedLoanModel srl in srList.Loans)
            {
                if (IsNewSRL(srl))
                {
                    srInsertList.Loans.Add(srl);
                }
                else
                {
                    srUpdateList.Loans.Add(srl);
                }
            }

            if (srInsertList.Loans.Count > 0)
            {
                insertResult = InsertSelfReportedLoans(srInsertList);
            }
            if (srUpdateList.Loans.Count > 0)
            {
                updateResult = UpdateSelfReportedLoans(srUpdateList);
            }

            ResultCodeModel result = getCombinedResults(insertResult, updateResult, srInsertList.Loans.Count, srUpdateList.Loans.Count);

            return(result);
        }
Beispiel #15
0
        public ResultCodeModel SaveReminders(ReminderListModel rList)
        {
            _log.Info("ASA.Web.Services.ReminderService.SaveReminders() starting ...");
            ResultCodeModel result = null;

            try
            {
                if (ReminderValidation.ValidateInputReminderList(rList))
                {
                    if (_reminderAdapter == null)
                    {
                        _log.Error("ASA.Web.Services.ReminderService.GetReminders(): " + _reminderAdapterExceptionMessage);
                        throw new ReminderBadDataException("Null adapter in ASA.Web.Services.ReminderService.GetReminders()");
                    }
                    else
                    {
                        result = _reminderAdapter.SaveReminders(rList);
                    }
                }
                else
                {
                    result = new ResultCodeModel();
                    ErrorModel error = new ErrorModel("Invalid information input for this reminder", "Web reminder Service");
                    _log.Error("ASA.Web.Services.ReminderService.SaveReminders(): Invalid information input for these reminders");
                    result.ErrorList.Add(error);
                }
            }

            catch (Exception ex)
            {
                _log.Error("ASA.Web.Services.ReminderService.SaveReminders(): Exception => " + ex.ToString());
                throw new ReminderOperationException("Web Reminder Service - Exception in ASA.Web.Services.ReminderService.SaveReminders()", ex);
            }

            _log.Info("ASA.Web.Services.ReminderService.SaveReminders() ending ...");
            return(result);
        }
Beispiel #16
0
        public ResultCodeModel SaveSelfReportedLoan(SelfReportedLoanModel srl)
        {
            ResultCodeModel result = new ResultCodeModel();

            if (srl != null)
            {
                if (!IsNewSRL(srl)) //QC 4712: check that SRL belongs to person logged in
                {
                    if (IsSRLForPersonLoggedIn(srl.LoanSelfReportedEntryId))
                    {
                        result = this.UpdateSelfReportedLoan(srl); //UpdateFacadeObject
                    }
                    else
                    {
                        result.ErrorList.Add(new ErrorModel("There was a problem saving Self Reported Loan information."));
                    }
                }
                else
                {
                    result = this.InsertSelfReportedLoan(srl); //InsertFacadeObject
                }
            }
            return(result);
        }