Esempio n. 1
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());
        }
        protected void SaveSingleChild()
        {
            MembershipManager membershipManager = new MembershipManager();
            Child             savedChild;

            //checking if existing child prevents yellow death screens
            if (status == Constants.QueryStrings.Registration.ModeEdit || membershipManager.isExistingChild(singleChild.ChildId))
            {
                savedChild = membershipManager.UpdateChild(singleChild);
            }
            else
            {
                savedChild = membershipManager.AddChild(singleChild, this.CurrentMember.MemberId);
            }

            // Update personalization
            PersonalizationHelper.RefreshAndSavePersonalizedContent(singleChild.ChildId);
        }