Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;

            litSeeAllNotificationsLabel.Text = DictionaryConstants.SeeAllNotificationsLabel;
            hrefNotificationsLink.HRef       = MainsectionItem.GetHomePageItem().GetMyAccountFolder().GetMyNotificationsPage().GetUrl();
            hrefNotificationsLink.InnerText  = context.SeeAllNotificationsText;
            if (Notifications != null)
            {
                litNotifCount.Text   = Notifications.Count().ToString();
                pnlEmptyText.Visible = false;
            }
            else
            {
                pnlEmptyText.Visible = true;
            }

            var filterNotifs = Notifications;

            if (Notifications != null)
            {
                filterNotifs = Notifications.OrderByDescending(x => x.NotificationDate).Take(3).ToList();
            }

            lvNotifications.DataSource = filterNotifs;
            lvNotifications.DataBind();
        }
        protected void btnAgree_Click(object sender, EventArgs e)
        {
            CurrentMember.AgreedToSignUpTerms = true;

            var membershipManager = new MembershipManager();

            membershipManager.UpdateMember(CurrentMember);

            BaseReply reply = ExactTargetService.InvokeWelcomeToUnderstood(new InvokeWelcomeToUnderstoodRequest {
                PreferredLanguage = CurrentMember.PreferredLanguage, ToEmail = CurrentUser.Email, FirstName = CurrentMember.FirstName, RequestUrl = Request.Url
            });

            //string url = MembershipHelper.GetNextStepURL(1);
            // send them to My Account, not into CMP
            string url = MyAccountItem.GetMyAccountPage().GetUrl();

            // NOTE: temorarily commented out to prevent 404 redirect

            //if (Session[Constants.SessionPreviousUrl] != null)
            //{
            //    url = Session[Constants.SessionPreviousUrl].ToString();
            //}

            //redirect based on interrupt
            this.ReturnRedirect();

            //if no sign-up interrupt was set, redirect as normal
            Response.Redirect(url);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(CurrentMember.ScreenName))
            {
                pnlNoProfile.Visible = true;
                //TODO: add navigate URL for hypCompleteYourProfile
            }
            else
            {
                MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;
                var           item    = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountComments);
                hypCommentsTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item);
                hypCommentsTab.Text        = context.SeeAllCommentsText;

                int totalComments;

                List <Services.Models.Telligent.Comment> comments = TelligentService.GetUserCommentsByScreenName(CurrentMember.ScreenName, 1, 2, out totalComments);

                litCount.Text = totalComments.ToString();

                if (comments.Any())
                {
                    pnlComments.Visible    = true;
                    rptComments.DataSource = comments;
                    rptComments.DataBind();
                }
                else
                {
                    pnlNoComments.Visible = true;
                }
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var item = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountEvents);

            MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;

            hypEventsTab.NavigateUrl = Sitecore.Context.Database.GetItem(Constants.Pages.WhatsHappening).GetUrl();
            hypEventsTab.Text        = context.UpcomingEventsLinkText;

            var events = SearchHelper.GetUpcomingEvents(2).ToList();
            List <EventModel> eventsDataSource = new List <EventModel>();

            foreach (BaseEventDetailPageItem eventItem in events.OrderByDescending(i => i.EventStartDate.DateTime.Date).ThenBy(i => i.EventStartDate.DateTime.TimeOfDay))
            {
                EventModel stubEvent = new EventModel();
                stubEvent.Title    = eventItem.EventHeading.Rendered;
                stubEvent.TitleUrl = eventItem.InnerItem.GetUrl();
                stubEvent.Type     = eventItem.GetEventType();
                stubEvent.TypeUrl  = hypEventsTab.NavigateUrl;
                stubEvent.Date     = eventItem.EventStartDate.DateTime.ToShortDateString();
                stubEvent.Time     = eventItem.EventStartDate.DateTime.ToShortTimeString();
                eventsDataSource.Add(stubEvent);
            }

            rptEvents.DataSource = eventsDataSource;
            rptEvents.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List <GroupCardModel> groupsList = TelligentService.GetUserGroups(CurrentMember.ScreenName);

            litCount.Text = groupsList != null?groupsList.Count.ToString() : "0";

            if (litCount.Text == "0")
            {
                litCount.Visible = false;
            }

            if (string.IsNullOrEmpty(CurrentMember.ScreenName))
            {
                pnlNoProfile.Visible = true;
            }
            else
            {
                var           item    = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountGroups);
                MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;
                hypGroupsTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item);
                hypGroupsTab.Text        = context.SeeAllGroupsLinkText;

                if ((groupsList != null) && (groupsList.Count != 0))
                {
                    pnlGroups.Visible    = true;
                    rptGroups.DataSource = groupsList.Count < 3 ? groupsList.GetRange(0, groupsList.Count) : groupsList.GetRange(0, 3);;
                    rptGroups.DataBind();
                }
                else
                {
                    pnlNoGroups.Visible = true;
                }
            }
        }
Esempio n. 6
0
        protected void NextStep()
        {
            //throw back to interrupt
            this.ReturnRedirect();

            //oh, you're still here? well...lets just go to your account page...
            Response.Redirect(MyAccountItem.GetMyAccountPage().GetUrl());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.CurrentMember != null && this.CurrentUser != null)
            {
                Response.Redirect(MyAccountItem.GetMyAccountPage().GetUrl());
            }

            //assign placeholders
            uxEmailAddress.Attributes["placeholder"]    = DictionaryConstants.EnterEmailAddressWatermark;
            uxFirstName.Attributes["placeholder"]       = DictionaryConstants.FirstNameWatermark;
            uxPassword.Attributes["placeholder"]        = DictionaryConstants.EnterPasswordWatermark;
            uxPasswordConfirm.Attributes["placeholder"] = DictionaryConstants.ReEnterNewPasswordWatermark;
            uxZipCode.Attributes["placeholder"]         = DictionaryConstants.ZipCodeWatermark;

            //assign button text and mark as default button for form
            uxSubmit.Text = DictionaryConstants.SubmitButtonText;
            this.Page.Form.DefaultButton = this.uxSubmit.UniqueID;

            //setup signup text and navigation
            uxSignIn.Text        = DictionaryConstants.SignInButtonText;
            uxSignIn.NavigateUrl = SignInPageItem.GetSignInPage().GetUrl();

            //set validation
            valFirstName.ErrorMessage           = DictionaryConstants.FirstNameErrorMessage;
            valEmail.ErrorMessage               = valRegEmail.ErrorMessage = DictionaryConstants.EmailAddressErrorMessage;
            valRegEmail.ValidationExpression    = Constants.Validators.Email;
            valPassword.ErrorMessage            = valPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordErrorMessage;
            valRegPassword.ValidationExpression = valRegPasswordConfirm.ValidationExpression = Constants.Validators.Password;
            //TODO: move to dictionary
            valRegPassword.ErrorMessage = valRegPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordErrorMessage;
            //TODO: move to dictionary
            valCompPassword.ErrorMessage    = valCompPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordMatchError;
            valZipCode.ErrorMessage         = DictionaryConstants.ZipCodeErrorMessage;
            valZipCode.ValidationExpression = Constants.Validators.ZipCode;

            if (!string.IsNullOrEmpty(AccessToken))
            {
                var     client = new Facebook.FacebookClient(AccessToken);
                dynamic me     = client.Get("me", new { fields = "name,email" });

                uxEmailAddress.Text = me.email;
                uxFirstName.Text    = me.name;

                var pass = Guid.NewGuid().ToString().Substring(0, 12);

                uxPassword.Attributes["value"]        = pass;
                uxPasswordConfirm.Attributes["value"] = pass;

                uxPassword.Enabled        = false;
                uxPasswordConfirm.Enabled = false;
            }
        }
Esempio n. 8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //do stuff
            if (this.CurrentMember != null)
            {
                var child = new UnderstoodDotOrg.Domain.Membership.Child();

                //required values that we can default
                child.EvaluationStatus = new Guid(Constants.ChildEvaluation.StatusEvaluationNo);

                child.Nickname = TextHelper.RemoveHTML(txtChildNickname.Text);
                child.Gender   = uxBoy.Checked ? "boy" : "girl";
                child.Grades.Add(new Grade()
                {
                    Key = Guid.Parse(ddlGrades.SelectedValue)
                });

                foreach (var item in rptIssues.Items)
                {
                    var checkbox = item.FindControl("uxIssueCheckbox") as CheckBox;
                    var hidden   = item.FindControl("uxIssueHidden") as HiddenField;

                    if (checkbox.Checked)
                    {
                        //singleChild.Issues.Add(new Issue() { Key = Guid.Parse(checkbox.Attributes["value"]) });
                        child.Issues.Add(new Issue()
                        {
                            Key = Guid.Parse(hidden.Value)
                        });
                    }
                }

                MembershipManager membershipManager = new MembershipManager();

                child = membershipManager.AddChild(child, this.CurrentMember.MemberId);

                PersonalizationHelper.RefreshAndSavePersonalizedContent(child.ChildId);

                //should we update the current member?
            }

            this.ReturnRedirect();

            //oh, you're still here...
            Response.Redirect(MyAccountItem.GetMyAccountPage().GetUrl());
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HeaderFolder = HeaderFolderItem.GetHeader();

            if (IsUserLoggedIn)
            {
                phLoggedIn.Visible = true;
                MyAccountPageItem  = MyAccountItem.GetMyAccountPage();

                UserDisplayName = !string.IsNullOrWhiteSpace(CurrentMember.FirstName) ?
                                  CurrentMember.FirstName.Trim() :
                                  "Guest";


                //sets up the global hero image along with the notifications
                var user = TelligentService.GetUser(CurrentMember.ScreenName);
                if (user != null)
                {
                    imgUserAvatar.ImageUrl = user.AvatarUrl;
                }
                else
                {
                    imgUserAvatar.ImageUrl = Constants.Settings.AnonymousAvatar;
                }

                // TODO: review this code if necessary

                int totalNotifications = (Notifications != null) ? Notifications.Count() : 0;
                int totalConversations = (Conversations != null) ? Conversations.Count() : 0;
                lblNotificationNumber.Text = (totalConversations + totalConversations).ToString();
            }
            else
            {
                phNotLoggedIn.Visible = true;
            }

            GetCompanyLogoDetail();
            SetLanguageItemsRepeater();
            GetUtilityNavigationItems();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MyAccountItem context = (MyAccountItem)Sitecore.Context.Item;
            var           item    = Sitecore.Context.Database.GetItem(Constants.Pages.MyAccountFavorites);

            hypFavoritesTab.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(item);
            hypFavoritesTab.Text        = context.SeeAllFavoritesText;

            var favoritesList = CommunityHelper.GetFavorites(CurrentMember.MemberId);

            litCount.Text = favoritesList != null?favoritesList.Count.ToString() : "0";

            if ((favoritesList != null) && (favoritesList.Count != 0))
            {
                pnlFavorites.Visible    = true;
                rptFavorites.DataSource = favoritesList.Count < 3 ? favoritesList.GetRange(0, favoritesList.Count) : favoritesList.GetRange(0, 3);
                rptFavorites.DataBind();
            }
            else
            {
                pnlNoFavorites.Visible = true;
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            litNotificationsLabel.Text = DictionaryConstants.NotificationsButtonLabel;
            if (IsUserLoggedIn)
            {
                MyProfilePage = MyProfileItem.GetMyProfilePage();
                MyAccountPage = MyAccountItem.GetMyAccountPage();

                btnUpload.Text = MyAccountPage.AvatarUploadButtonText.Rendered;

                var accountPages = MyAccountPage.GetAccountPages();
                rptrAccountNav.DataSource = accountPages;
                rptrAccountNav.DataBind();

                hlSectionTitle.NavigateUrl = MainsectionItem.GetHomePageItem().GetUrl();
                frSectionTitle.Item        = MainsectionItem.GetHomePageItem();

                if (CurrentMember.ZipCode != null)
                {
                    if (!string.IsNullOrEmpty(CurrentMember.ScreenName))
                    {
                        litLocation.Text = Services.CommunityServices.GeoTargeting.GetStateByZip(CurrentMember.ZipCode);
                    }
                }

                if (!String.IsNullOrEmpty(CurrentMember.ScreenName))
                {
                    List <INotification> notifs      = new  List <INotification>();
                    List <Conversation>  checkConvos = new List <Conversation>();
                    if (Notifications == null)
                    {
                        notifs = TelligentService.GetNotifications(CurrentMember.ScreenName);
                        if (notifs != null && notifs.Count() > 0)
                        {
                            //spnCount.Visible = true;
                            //litNotifCount.Text = notifs.Count().ToString();
                            Notifications = notifs;
                        }
                        else
                        {
                            notifs        = new List <INotification>();
                            Notifications = notifs;
                        }
                    }
                    else
                    {
                        notifs = Notifications;
                    }

                    if (Conversations == null)
                    {
                        checkConvos = TelligentService.GetConversations(CurrentMember.ScreenName, Constants.TelligentConversationStatus.Unread);
                        if (checkConvos != null && checkConvos.Count() > 0)
                        {
                            Conversations = checkConvos;
                        }
                        else
                        {
                            checkConvos   = new List <Conversation>();
                            Conversations = checkConvos;
                        }
                    }
                    else
                    {
                        checkConvos = Conversations;
                    }
                    int totalNotifs = notifs.Count() + checkConvos.Count();
                    if (totalNotifs > 0)
                    {
                        spnCount.Visible   = true;
                        litNotifCount.Text = totalNotifs.ToString();
                    }
                    else
                    {
                        spnCount.Visible = false;
                    }
                }
            }
            else
            {
                Response.Redirect(MainsectionItem.GetHomePageItem().GetUrl());
            }

            if (CurrentMember != null && !string.IsNullOrEmpty(CurrentMember.ScreenName))
            {
                try
                {
                    User user = TelligentService.GetUser(this.CurrentMember.ScreenName);
                    if (user != null)
                    {
                        userAvatar.Src = user.AvatarUrl;
                    }
                }
                catch { }
            }

            //if (!IsPostBack)
            //{
            //    try
            //    {
            //        if (CurrentMember.ScreenName != null)
            //        {
            //            userAvatar.Src = TelligentService.GetUser(this.CurrentMember.ScreenName).AvatarUrl;
            //        }
            //    }
            //    catch { }
            //}
        }