Exemple #1
0
        protected void rptChildBasicInfo_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                Child child = (Child)e.Item.DataItem;

                HyperLink hlReplaceMatchingIssues = e.FindControlAs <HyperLink>("hlReplaceMatchingIssues");
                hlReplaceMatchingIssues.NavigateUrl = MyProfileStepTwoItem.GetChildEditLink(e.Item.ItemIndex);

                Literal litChildGrade = e.FindControlAs <Literal>("litChildGrade");
                if (child.Grades != null && child.Grades.Any())
                {
                    litChildGrade.Text = child.Grades.First().Value;
                }

                Literal litChildGender = e.FindControlAs <Literal>("litChildGender");
                if (child.Gender != null)
                {
                    litChildGender.Text = TextHelper.ToTitleCase(child.Gender);
                }

                Repeater rptChildRelatedArticles = e.FindControlAs <Repeater>("rptChildRelatedArticles");

                List <DefaultArticlePageItem> articles;
                if (this.useSearch)
                {
                    articles = SearchHelper.GetArticles(UnauthenticatedSessionMember, child, DateTime.Now)
                               .Where(a => a.GetItem() != null)
                               .Select(a => new DefaultArticlePageItem(a.GetItem()))
                               .ToList();
                }
                else
                {
                    articles = UnderstoodDotOrg.Domain.Personalization.PersonalizationHelper.GetChildPersonalizedContents(child);
                }

                if (articles.Any())
                {
                    rptChildRelatedArticles.DataSource = articles;
                    rptChildRelatedArticles.DataBind();
                }
            }
        }
Exemple #2
0
        protected void DoNextStep()
        {
            string redirect = "/";

            //if here via edit OR add
            if (status == Constants.QueryStrings.Registration.ModeAdd || status == Constants.QueryStrings.Registration.ModeEdit)
            {
                redirect = MyProfileItem.GetMyProfilePage().GetUrl();
            }
            else if (this.registeringUser.Children.Where(x => x.Issues.Count == 0).Count() > 0)
            {
                redirect = MyProfileStepTwoItem.GetCompleteMyProfileStepTwo().GetUrl();
            }
            else
            {
                redirect = MyProfileStepFourItem.GetCompleteMyProfileStepFour().GetUrl();
            }

            //move onto next step
            Response.Redirect(redirect);
        }
 protected string getChildEditLink(ListViewDataItem Container)
 {
     return(MyProfileStepTwoItem.GetChildEditLink(Container.DataItemIndex));
 }
        private void Page_Load(object sender, EventArgs e)
        {
            if (this.CurrentMember == null && this.CurrentUser == null)
            {
                if (!string.IsNullOrEmpty(CurrentPage.SignInPage.Url))
                {
                    Response.Redirect(CurrentPage.SignInPage.Url);
                }
                else
                {
                    Response.Redirect("/");
                }
            }

            if (!IsPostBack)
            {
                //update member
                MembershipManager membershipManager = new MembershipManager();
                this.CurrentMember = membershipManager.GetMember(this.CurrentMember.MemberId);
                this.CurrentUser   = membershipManager.GetUser(this.CurrentMember.MemberId, true);

                MyProfileItem context = (MyProfileItem)Sitecore.Context.Item;
                HyperLink     myHL    = (HyperLink)this.FindControl("uxAddChild");
                myHL.Text = context.AddChildText;

                SetLabels();
                SetRole();

                uxChildList.DataSource = this.CurrentMember.Children;
                uxChildList.DataBind();

                //disable new children if you already have 6 or more
                if (this.CurrentMember.Children.Count >= 6)
                {
                    uxAddChild.Visible = false;
                }

                SetInterests();

                uxEmailAddress.Text = txtEmail.Text = this.CurrentUser.UserName;


                SetJourney();

                uxPassword.Text = replacePassword("digitalpulp!");

                string phoneNumber = string.Empty;

                if (!string.IsNullOrEmpty(this.CurrentMember.MobilePhoneNumber))
                {
                    phoneNumber = this.CurrentMember.MobilePhoneNumber.Replace("-", string.Empty).Trim();

                    //if (phoneNumber.Length == 10 && !phoneNumber.Contains("-"))
                    //{
                    phoneNumber = phoneNumber.Insert(3, "-");
                    phoneNumber = phoneNumber.Insert(7, "-");
                    //}
                }
                else
                {
                    //10 points to Gryffindor if you know where this phone number comes from
                    txtPhoneNumber.Attributes["placeholder"] = "212-555-2368";
                }

                uxPhoneNumber.Text  = phoneNumber;
                txtPhoneNumber.Text = phoneNumber;

                uxPrivacyLevel.Text = this.CurrentMember.allowConnections ? DictionaryConstants.OpenToConnect : DictionaryConstants.NotOpenToConnect;

                uxScreenname.Text = this.CurrentMember.ScreenName;

                uxZipcode.Text = this.CurrentMember.ZipCode.Trim();

                uxAddChild.Text        = string.Format(uxAddChild.Text, ((ChildCount)this.CurrentMember.Children.Count).ToString());
                uxAddChild.NavigateUrl = MyProfileStepTwoItem.GetCompleteMyProfileStepTwo().GetUrl() + "?" + Constants.QueryStrings.Registration.Mode + "=" + Constants.QueryStrings.Registration.ModeAdd;

                if (Session["PostReloadScript"] != null)
                {
                    string reloadScript = Session["PostReloadScript"].ToString();

                    if (reloadScript != "")
                    {
                        ltlJS.Text = string.Format("<script type=\"text/javascript\">{0}</script>", reloadScript);
                        Session["PostReloadScript"] = null;
                    }
                }

                //top of edit interests
                hypEditCommunityAboutMe.NavigateUrl = String.Format(MyProfileStepFourItem.GetCompleteMyProfileStepFour().GetUrl() + "?{0}={1}", Constants.QueryStrings.Registration.Mode, Constants.QueryStrings.Registration.ModeEdit);

                //jump to edit community
                hypEditCommunity.NavigateUrl = hypCompleteYourProfile.NavigateUrl = String.Format(MyProfileStepFourItem.GetCompleteMyProfileStepFour().GetUrl() + "?{0}={1}#community", Constants.QueryStrings.Registration.Mode, Constants.QueryStrings.Registration.ModeEdit);

                if (!string.IsNullOrEmpty(this.CurrentMember.ScreenName))
                {
                    hypViewAsVisitors.NavigateUrl = MembershipHelper.GetPublicProfileAsVisitorUrl(CurrentMember.ScreenName);
                    hypViewAsMembers.NavigateUrl  = MembershipHelper.GetPublicProfileAsMemberUrl(CurrentMember.ScreenName);
                    hypViewAsFriends.NavigateUrl  = MembershipHelper.GetPublicProfileUrl(CurrentMember.ScreenName);
                }
                else
                {
                    uxNoProfile.Visible  = true;
                    uxPublicView.Visible = false;
                }
            }
        }