Пример #1
0
        public ActionResult MemberOptions()
        {
            var memberEditPage = CurrentPage as MemberEdit;

            IMember member = _memberProvider.GetLoggedInMember();
            var     model  = new MemberOptionsModel();

            if (member != null)
            {
                var memberType       = member.GetValue <MembershipTypeEnum>(MemberProperty.membershipType);
                var isGuest          = memberType == MembershipTypeEnum.Guest;
                var membershipExpiry = member.GetValue <DateTime>(MemberProperty.MembershipExpiry);

                model.MembershipExpired = membershipExpiry < DateTime.Now;
                model.MembershipExpiry  = membershipExpiry;
                model.MembershipType    = memberType.ToString();
                model.IsBankLinked      = !string.IsNullOrEmpty(member.GetValue <string>(MemberProperty.directDebitMandateId));

                string swimSubs1 = member.GetValue <string>(MemberProperty.swimSubs1);
                model.ShowBuySwimSubs1 = !model.EnableMemberRenewal && !isGuest && _membershipCostCalculator.SwimSubs1Enabled &&
                                         string.IsNullOrEmpty(swimSubs1) && DateTime.Now.Month < 10 && DateTime.Now.Month > 2;
                string swimSubs2 = member.GetValue <string>(MemberProperty.swimSubs2);
                model.ShowBuySwimSubs2 = !model.EnableMemberRenewal && !isGuest && _membershipCostCalculator.SwimSubs2Enabled && string.IsNullOrEmpty(swimSubs2);
                model.OptionalExtras   = GetOptionalExtras(member);
                decimal swimSubsCost = _membershipCostCalculator.SwimsSubsCostInPence(memberType) / 100;
                model.BuySwimSubs1Text = string.Format("Buy {0} @ £{1:N2}", MemberProvider.GetSwimSub1Description(DateTime.Now), swimSubsCost);
                model.BuySwimSubs2Text = string.Format("Buy {0} @ £{1:N2}", MemberProvider.GetSwimSub2Description(DateTime.Now), swimSubsCost);

                model.EnableMemberRenewal = memberEditPage.RenewalsEnabled && DateTime.Now.Month > 2 && !isGuest && membershipExpiry.Year <= DateTime.Now.Year;

                model.ShowIceLink         = Roles.IsUserInRole(MSTCRoles.Coach) || Roles.IsUserInRole(MSTCRoles.MemberAdmin);
                model.ShowMemberAdminLink = Roles.IsUserInRole(MSTCRoles.MemberAdmin);
                model.ShowEventAdminLink  = Roles.IsUserInRole(MSTCRoles.EventAdminViewer);

                model.EnableOpenWater      = memberEditPage.OWsenabled && !isGuest && !model.MembershipExpired;
                model.OWSNumber            = member.GetValue <string>(MemberProperty.SwimAuthNumber);
                model.OwsIndemnityAccepted = member.GetValue <bool>(MemberProperty.OpenWaterIndemnityAcceptance);
                model.OwsIndemnityDocLink  = memberEditPage.IndemnityWaiverDoc?.Url;
                model.OwsSignupFee         = (decimal)_membershipCostCalculator.OwsSignupCostPence / 100;

                model.RenewalPageUrl      = memberEditPage.RenewalPage?.Url;
                model.MemberAdminPageUrl  = memberEditPage.MemberAdminPage?.Url;
                model.EventBookingPageUrl = memberEditPage.EventBookingPage?.Url;
                model.EventAdminPageUrl   = memberEditPage.EventAdminPage?.Url;
                model.UnlinkBankPageUrl   = memberEditPage.UnlinkBankPage?.Url;
            }

            return(PartialView("Member/EditMemberOptions", model));
        }
Пример #2
0
        private string GetRegEmailContent(RegistrationDetails registrationDetails, bool isRegistered)
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("<p>A new member has {0} been registered with the club</p><p>Member details:</p>", isRegistered ? "" : "NOT");

            var personalDets  = registrationDetails.PersonalDetails;
            var memberOptions = registrationDetails.MemberOptions;

            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Name", $"{personalDets.FirstName} {personalDets.LastName}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Email", $"{personalDets.Email}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Phone number", $"{personalDets.PhoneNumber}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Gender", $"{personalDets.Gender.ToString()}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Date of Birth", $"{personalDets.DateOfBirth.Value.ToString("dd MMM yyyy")}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Membership Type", $"{memberOptions.MembershipType.ToString()}");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "England Athletics Membership", memberOptions.EnglandAthleticsMembership ? "Yes" : "No");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", MemberProvider.GetSwimSub1Description(DateTime.Now), memberOptions.SwimSubs1 ? "Yes" : "No");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", MemberProvider.GetSwimSub2Description(DateTime.Now), memberOptions.SwimSubs2 ? "Yes" : "No");
            stringBuilder.AppendFormat("{0}: <strong>{1}</strong><br/>", "Open water swimming?", memberOptions.OpenWaterIndemnityAcceptance.Value ? "Yes" : "No");

            return(stringBuilder.ToString());
        }