コード例 #1
0
        private static void UpdateMemberSubscriptionProperties(IMember member, MemberModel model, MemberTypes type, TimeSpan length, double amount = 0)
        {
            DateTime subscriptionEndDate = DateTime.Today.Add(length);

            if (model.SubscriptionEndDate != null)
            {
                subscriptionEndDate = model.SubscriptionEndDate.Value.Add(length);
            }

            if (amount > 0)
            {
                member.SetValue(MemberPropertyNames.LastPaymentAmount, amount);
                member.SetValue(MemberPropertyNames.LastPaymentDate, DateTime.Today.ToString("yyyy-MM-dd"));
            }

            member.SetValue(MemberPropertyNames.SubscriptionEndDate, subscriptionEndDate);
            member.SetValue(MemberPropertyNames.Type, (int)type);
        }
コード例 #2
0
        private static void UpdateMemberProperties(IMember member, MemberModel model, UmbracoHelper helper, IMedia picture)
        {
            IEnumerable <KeyValuePair <int, string> > knittingExperienceOptions = helper.GetKnittingExperienceOptions();

            member.SetValue(MemberPropertyNames.EmailOptIn, model.EmailOptIn);
            member.SetValue(MemberPropertyNames.FacebookProfile, model.FacebookProfile);
            member.SetValue(MemberPropertyNames.FavouriteBeverage, model.FavouriteBeverage);
            member.SetValue(MemberPropertyNames.FirstName, model.FirstName);
            member.SetValue(MemberPropertyNames.Hometown, model.Hometown);
            member.SetValue(MemberPropertyNames.KnittingExperience, knittingExperienceOptions.First(x => x.Value == model.KnittingExperience).Key);
            member.SetValue(MemberPropertyNames.KnittingExperienceOther, model.KnittingExperienceOther);
            member.SetValue(MemberPropertyNames.LastName, model.LastName);
            member.SetValue(MemberPropertyNames.Neighbourhood, model.Neighbourhood);
            member.SetValue(MemberPropertyNames.Reason, model.Reason);

            if (picture != null)
            {
                member.SetValue(MemberPropertyNames.Picture, picture.ToPropertyValue());
            }
        }
コード例 #3
0
        public void CreatePasswordRequest(SiteSettings siteSettings, string email, string url, UmbracoHelper helper)
        {
            IPublishedContent memberContent = helper.MembershipHelper.GetByEmail(email);

            if (memberContent == null)
            {
                return;
            }

            MemberModel model = new MemberModel(memberContent);

            Guid token = CreateCryptographicallySecureGuid();

            _membersDataService.AddPasswordResetRequest(model.Id, DateTime.Now, DateTime.Now.AddMinutes(30), token.ToString());

            url = url.Replace("{token}", token.ToString());
            string body = model.Chapter.GetPropertyValue <string>("resetPasswordEmailBody");

            body = body.Replace("{{resetPasswordUrl}}", url);
            SendMemberEmail(siteSettings, model, "Password reset", body, true, null);
        }
コード例 #4
0
 public UpdateMemberModel(MemberModel other)
     : base(other.Content)
 {
     CopyFrom(other);
 }