Пример #1
0
        private void ProcessPaymentState(PaymentModel model, IMember member, PaymentStates paymentState)
        {
            switch (paymentState)
            {
            case PaymentStates.SS05991:
            {
                member.SetValue(MemberProperty.swimSubs1, string.Format("Swim Subs Apr - Sept {0}", DateTime.Now.Year));
                model.ShowSwimSubsConfirmation = true;
                break;
            }

            case PaymentStates.SS05992:
            {
                var janToMarch = new List <int>()
                {
                    1, 2, 3
                };
                int year1 = janToMarch.Any(m => m == DateTime.Now.Month) ? DateTime.Now.Year - 1 : DateTime.Now.Year;
                member.SetValue(MemberProperty.swimSubs2, string.Format("Swim Subs Oct {0} - Mar {1}", year1, year1 + 1));
                model.ShowSwimSubsConfirmation = true;
                break;
            }

            case PaymentStates.MemberRenewal:
            case PaymentStates.MemberUpgrade:
            {
                _memberProvider.UpdateMemberOptions(member, _sessionProvider.RenewalOptions, isUpgrade: paymentState == PaymentStates.MemberUpgrade);
                model.ShowRenewed = true;
                break;
            }

            case PaymentStates.TrainingCredits:
            {
                var credits = member.GetValue <int>(MemberProperty.TrainingCredits);
                credits = credits + (_sessionProvider.TrainingCreditsInPence / 100);
                member.SetValue(MemberProperty.TrainingCredits, credits);
                model.ShowCreditsConfirmation = true;
                break;
            }

            case PaymentStates.OwsSignup:
            {
                _memberProvider.AcceptOpenWaterWaiver(member);
                model.ShowOwsSignupConfirmation = true;
                break;
            }
            }

            _memberService.Save(member);
        }