예제 #1
0
        /// <summary>
        /// To the domain object.
        /// </summary>
        /// <param name="lesson1">The lesson1.</param>
        /// <returns></returns>
        public static Lesson1 ToDomainObject(this Lesson1Contract lesson1)
        {
            var expenses = new List <Expense>();
            var incomes  = new List <Income>();

            if (lesson1.Expenses != null)
            {
                expenses = lesson1.Expenses.Select(expense => expense.ToDomainObject()).ToList();
            }

            if (lesson1.Incomes != null)
            {
                incomes = lesson1.Incomes.Select(income => income.ToDomainObject()).ToList();
            }

            var membershipApi      = new AsaMemberAdapter();
            var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext();

            return(new Lesson1()
            {
                Expenses = expenses,
                Incomes = incomes,
                Goal = lesson1.Goal != null?lesson1.Goal.ToDomainObject() : new Goal(),
                           User = lesson1.User.ToDomainObject(),
                           IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(activeDirectoryKey)
                                        : Guid.Empty
            });
        }
예제 #2
0
        /// <summary>
        /// To the user.
        /// </summary>
        /// <param name="userLessonContracts">The user lesson contracts.</param>
        /// <returns></returns>
        public static User ToDomainObject(this MemberLessonContract[] userLessonContracts)
        {
            var toReturn           = new User();
            var memberAdapter      = new AsaMemberAdapter();
            var activeDirectoryKey = memberAdapter.GetActiveDirectoryKeyFromContext();
            var lesson1            = userLessonContracts.FirstOrDefault(l => l.LessonId == 1);
            var lesson2            = userLessonContracts.FirstOrDefault(l => l.LessonId == 2);
            var lesson3            = userLessonContracts.FirstOrDefault(l => l.LessonId == 3);

            toReturn.IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(memberAdapter.GetActiveDirectoryKeyFromContext())
                                        : Guid.Empty;
            toReturn.Lesson1Step = lesson1 != null && lesson1.CurrentStep.HasValue ? lesson1.CurrentStep.Value : 0;
            toReturn.Lesson2Step = lesson2 != null && lesson2.CurrentStep.HasValue ? lesson2.CurrentStep.Value : 0;
            toReturn.Lesson3Step = lesson3 != null && lesson3.CurrentStep.HasValue ? lesson3.CurrentStep.Value : 0;
            toReturn.MemberId    = memberAdapter.GetMemberIdFromContext();
            toReturn.UserId      = userLessonContracts.Any() ? userLessonContracts.First().LessonUserId : 0;

            return(toReturn);
        }
예제 #3
0
        /// <summary>
        /// Converts to the domain object.
        /// </summary>
        /// <param name="paymentReminder">The payment reminder.</param>
        /// <returns></returns>
        public static ReminderModel ToDomainObject(this PaymentReminderContract paymentReminder)
        {
            var userAdapter = new AsaMemberAdapter();

            return(new ReminderModel()
            {
                DayOfMonth = paymentReminder.DayOfMonth,
                ID = paymentReminder.PaymentReminderId.ToString(CultureInfo.InvariantCulture),
                IsActive = true,
                MemberId = userAdapter.GetMemberIdFromContext(),
                IndividualId = userAdapter.GetActiveDirectoryKeyFromContext(),
                NumberOfLoans = paymentReminder.NumberOfLoans.HasValue?paymentReminder.NumberOfLoans.Value:0,
                ServicerName = paymentReminder.ServicerName
            });
        }
예제 #4
0
        /// <summary>
        /// To the domain model.
        /// </summary>
        /// <param name="surveyDataContract">The survey data contract.</param>
        /// <returns></returns>
        public static SurveyModel ToDomainModel(this SurveyContract surveyDataContract)
        {
            var memberAdapter = new AsaMemberAdapter();

            return(surveyDataContract == null
                       ? null
                       : new SurveyModel()
            {
                ListOfAnswerOptions = surveyDataContract.ListOfValues,
                QuestionText = surveyDataContract.SurveyQuestion,
                SurveyId = surveyDataContract.SurveyId.ToString(CultureInfo.InvariantCulture),
                IndividualId = memberAdapter.GetActiveDirectoryKeyFromContext(),
                MemberId = memberAdapter.GetMemberIdFromContext(),
                SurveyQuestionId = surveyDataContract.SurveyId.ToString(CultureInfo.InvariantCulture)
            });
        }
예제 #5
0
        /// <summary>
        /// To the domain object.
        /// </summary>
        /// <param name="lesson2">The lesson2.</param>
        /// <returns></returns>
        public static Lesson2 ToDomainObject(this Lesson2Contract lesson2)
        {
            var membershipApi      = new AsaMemberAdapter();
            var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext();
            var lesson             = new Lesson2()
            {
                CurrentBalance       = lesson2.CurrentBalance.ToDomainObject(),
                DebtReductionOptions = lesson2.DebtReductionOptions.ToDomainObject(),
                IndividualId         = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(activeDirectoryKey)
                                        : Guid.Empty,
                ImportedExpenses  = lesson2.ImportedExpenses.ToDomainObject(),
                OneTimeExpenses   = lesson2.OneTimeExpenses.ToOneTimeExpenseDomainObject(),
                RecurringExpenses = lesson2.RecurringExpenses.ToRecurringExpenseDomainObject(),
                User = lesson2.User.ToDomainObject()
            };

            return(lesson);
        }
예제 #6
0
        /// <summary>
        /// To the domain object.
        /// </summary>
        /// <param name="lesson3">The lesson3.</param>
        /// <returns></returns>
        public static Lesson3 ToDomainObject(this Lesson3Contract lesson3)
        {
            var membershipApi      = new AsaMemberAdapter();
            var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext();
            var lesson             = new Lesson3()
            {
                FavoriteRepaymentPlans = lesson3.FavoriteRepaymentPlans.ToDomainObject(),
                IndividualId           = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(activeDirectoryKey)
                                        : Guid.Empty,
                LoanTypes              = lesson3.LoanTypes.ToDomainObject(),
                DefermentOptions       = lesson3.DefermentOptions.ToDomainListObject(),
                FasterRepaymentOptions = lesson3.FasterRepaymentOptions.ToDomainListObject(),
                LowerPaymentOptions    = lesson3.LowerPaymentOptions.ToDomainListObject(),
                UserId = lesson3.User.MemberLessonId,
                User   = lesson3.User.ToDomainObject()
            };

            return(lesson);
        }
예제 #7
0
        /// <summary>
        /// Gets the response and totals.
        /// </summary>memberAdapter
        /// <param name="surveyId">The survey id.</param>
        /// <returns></returns>
        /// <exception cref="SurveyOperationException">Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetResponseAndTotals()</exception>
        public SurveyListModel GetResponseAndTotals(int surveyId)
        {
            const string logMethodName = ".GetResponseAndTotals(string surveyId) - ";

            Log.Debug(logMethodName + "Begin Method");
            var sList = new SurveyListModel();

            try
            {
                var memberAdapter = new AsaMemberAdapter();
                var survey        = IntegrationLoader.LoadDependency <ISaltServiceAgent>("saltServiceAgent").GetSurveyById(surveyId);

                if (survey != null)
                {
                    foreach (var option in survey.SurveyOptions)
                    {
                        sList.Surveys.Add(new SurveyModel()
                        {
                            IndividualId     = memberAdapter.GetActiveDirectoryKeyFromContext(),
                            MemberId         = memberAdapter.GetMemberIdFromContext(),
                            SurveyId         = survey.SurveyId.ToString(CultureInfo.InvariantCulture),
                            SurveyQuestionId = survey.SurveyId.ToString(CultureInfo.InvariantCulture),
                            Response         = option.OptionValue,
                            ResponseCount    = option.TotalResponseCount,
                            QuestionText     = survey.SurveyQuestion,
                        });
                    }
                }
            }

            catch (Exception ex)
            {
                Log.Error("ASA.Web.Services.SurveyService.SurveyAdapter.GetSurveyQuestion(): Exception =>" + ex.ToString());
                throw new SurveyOperationException("Web Survey Service - ASA.Web.Services.SurveyService.SurveyAdapter.GetResponseAndTotals()", ex);
            }

            Log.Debug(logMethodName + "End Method");
            return(sList);
        }
예제 #8
0
        /// <summary>
        /// To the user.
        /// </summary>
        /// <param name="userLessonContract">The user lesson contract.</param>
        /// <returns></returns>
        public static User ToDomainObject(this MemberLessonContract userLessonContract)
        {
            var toReturn           = new User();
            var memberAdapter      = new AsaMemberAdapter();
            var activeDirectoryKey = memberAdapter.GetActiveDirectoryKeyFromContext();

            toReturn.IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(activeDirectoryKey)
                                        : Guid.Empty;
            toReturn.MemberId = memberAdapter.GetMemberIdFromContext();

            if (null == userLessonContract)
            {
                return(toReturn);
            }

            toReturn.UserId      = userLessonContract.LessonUserId;
            toReturn.Lesson1Step = userLessonContract.LessonId == 1 && userLessonContract.CurrentStep.HasValue? userLessonContract.CurrentStep.Value : 0;
            toReturn.Lesson2Step = userLessonContract.LessonId == 2 && userLessonContract.CurrentStep.HasValue ? userLessonContract.CurrentStep.Value : 0;
            toReturn.Lesson3Step = userLessonContract.LessonId == 3 && userLessonContract.CurrentStep.HasValue ? userLessonContract.CurrentStep.Value : 0;

            return(toReturn);
        }