public static void RunPersonalizationUpdate() { Sitecore.Diagnostics.Log.Debug("Scheduled Daily Personaliztion Update Starting." + DateTime.Now.ToString()); try { string sql = "SELECT DISTINCT [ChildId] FROM [dbo].[PersonalizedContent] ";//GET all of the children in the system who already have personalized content using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["membership"].ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand(sql, conn)) { SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { Guid childId = new Guid(); while (reader.Read()) { childId = reader.GetGuid(0); PersonalizationHelper.RefreshAndSavePersonalizedContent(childId); Sitecore.Diagnostics.Log.Debug("Finished Processing Personalization for Child: " + childId.ToString() + " [" + DateTime.Now.ToShortDateString() + "]"); } } } } } catch (Exception ex) { Sitecore.Diagnostics.Log.Debug("**** Error thrown while refreshing personalized content. **** " + Environment.NewLine + "Message: " + ex.Message + Environment.NewLine + "Stack Trace:" + ex.StackTrace); } Sitecore.Diagnostics.Log.Debug("Scheduled Daily Personaliztion Update Ending." + DateTime.Now.ToString()); }
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); }
private void runPersonalization() { PersonalizationHelper.RefreshAndSavePersonalizedContent(CurrentMember); }