Exemple #1
0
        protected void rptChildRelatedArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;
                {
                    HyperLink hlArticleImage = e.FindControlAs <HyperLink>("hlArticleImage");
                    HyperLink hlArticleTitle = e.FindControlAs <HyperLink>("hlArticleTitle");

                    hlArticleImage.NavigateUrl = hlArticleTitle.NavigateUrl = item.InnerItem.GetUrl();

                    Image imgThumbnail = e.FindControlAs <Image>("imgThumbnail");
                    imgThumbnail.ImageUrl = item.GetArticleThumbnailUrl(150, 85);

                    // DEBUG - START
                    Literal litDebugTag = e.FindControlAs <Literal>("litDebugTag");

                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("");
                    sb.AppendLine("Sitecore web db tagging:");
                    sb.AppendLine("Grades:");

                    foreach (var grade in item.ChildGrades.ListItems)
                    {
                        GradeLevelItem gli = grade;
                        sb.AppendLine(HttpUtility.HtmlDecode(gli.Name.Raw));
                    }

                    sb.AppendLine("");

                    sb.AppendLine("Issues:");

                    foreach (var issue in item.ChildIssues.ListItems)
                    {
                        ChildIssueItem cii = issue;
                        sb.AppendLine(HttpUtility.HtmlDecode(cii.IssueName.Raw));
                    }

                    sb.AppendLine("");

                    sb.AppendLine("Child Diagnoses:");

                    foreach (var diagnosis in item.ChildDiagnoses.ListItems)
                    {
                        ChildDiagnosisItem cdi = diagnosis;
                        sb.AppendLine(HttpUtility.HtmlDecode(cdi.DiagnosisName.Raw));
                    }

                    sb.AppendLine("");

                    sb.AppendLine("Interests:");

                    foreach (var interest in item.ApplicableInterests.ListItems)
                    {
                        ParentInterestItem pii = interest;
                        sb.AppendLine(HttpUtility.HtmlDecode(pii.InterestName.Raw));
                    }

                    sb.AppendLine("");

                    sb.AppendLine("Evaluations:");

                    foreach (var itemEval in item.OtherApplicableEvaluations.ListItems)
                    {
                        sb.AppendLine(itemEval.Name);
                    }

                    sb.AppendLine("");

                    sb.AppendLine("Diagnosed:");

                    foreach (var diag in item.DiagnosedCondition.ListItems)
                    {
                        sb.AppendLine(diag.Name);
                    }

                    sb.AppendLine("");

                    bool excluded = item.OverrideType.ListItems
                                    .Where(x => x.ID == Sitecore.Data.ID.Parse(Constants.ArticleTags.ExcludeFromPersonalization))
                                    .FirstOrDefault() != null;

                    sb.AppendLine(String.Format("Exclude from Personalization: {0}", excluded.ToString().ToLower()));

                    bool mustRead = item.ImportanceLevel.ListItems
                                    .Where(x => x.ID == Sitecore.Data.ID.Parse(Constants.ArticleTags.MustRead))
                                    .FirstOrDefault() != null;

                    sb.AppendLine(String.Format("Must read: {0}", mustRead.ToString().ToLower()));

                    sb.AppendLine(String.Format("Timely: {0}", IsTimely(item.DateStart.DateTime, item.DateEnd.DateTime).ToString()));

                    sb.AppendLine("");



                    Article article = SearchHelper.GetArticle(item.ID);
                    if (article != null)
                    {
                        sb.AppendLine("Solr index:");
                        sb.AppendLine("Grades:");

                        foreach (var grade in article.ChildGrades)
                        {
                            GradeLevelItem gli = Sitecore.Context.Database.GetItem(grade.Guid);
                            if (gli != null)
                            {
                                sb.AppendLine(HttpUtility.HtmlDecode(gli.Name.Raw));
                            }
                        }

                        sb.AppendLine("");

                        sb.AppendLine("Issues:");

                        foreach (var issue in article.ChildIssues)
                        {
                            ChildIssueItem cii = Sitecore.Context.Database.GetItem(issue.Guid);
                            if (cii != null)
                            {
                                sb.AppendLine(HttpUtility.HtmlDecode(cii.IssueName.Raw));
                            }
                        }

                        sb.AppendLine("");

                        sb.AppendLine("Child Diagnoses:");

                        foreach (var diagnosis in article.ChildDiagnoses)
                        {
                            ChildDiagnosisItem cdi = Sitecore.Context.Database.GetItem(diagnosis.Guid);
                            if (cdi != null)
                            {
                                sb.AppendLine(HttpUtility.HtmlDecode(cdi.DiagnosisName.Raw));
                            }
                        }

                        sb.AppendLine("");

                        sb.AppendLine("Interests:");

                        foreach (var interest in article.ParentInterests)
                        {
                            ParentInterestItem pii = Sitecore.Context.Database.GetItem(interest.Guid);
                            if (pii != null)
                            {
                                sb.AppendLine(HttpUtility.HtmlDecode(pii.InterestName.Raw));
                            }
                        }

                        sb.AppendLine("");

                        sb.AppendLine("Evaluations:");

                        foreach (var itemEval in article.ApplicableEvaluations)
                        {
                            Item i = Sitecore.Context.Database.GetItem(itemEval);
                            if (i != null)
                            {
                                sb.AppendLine(i.Name);
                            }
                        }

                        sb.AppendLine("");

                        sb.AppendLine("Diagnosed:");

                        foreach (var diag in article.DiagnosedConditions)
                        {
                            Item i = Sitecore.Context.Database.GetItem(diag);
                            if (i != null)
                            {
                                sb.AppendLine(i.Name);
                            }
                        }

                        sb.AppendLine("");

                        bool excludedTag = article.OverrideTypes.Contains(Sitecore.Data.ID.Parse(Constants.ArticleTags.ExcludeFromPersonalization));

                        sb.AppendLine(String.Format("Exclude from Personalization: {0}", excludedTag.ToString().ToLower()));

                        bool mustReadTag = article.ImportanceLevels.Contains(Sitecore.Data.ID.Parse(Constants.ArticleTags.MustRead));
                        sb.AppendLine(String.Format("Must read: {0}", mustReadTag.ToString().ToLower()));

                        sb.AppendLine(String.Format("Timely: {0}", IsTimely(article.TimelyStart, article.TimelyEnd)));
                    }

                    litDebugTag.Text = String.Format("<!--{0}-->", sb.ToString());
                    // DEBUG - END
                }
            }
        }
Exemple #2
0
        protected void DoSetup()
        {
            string nickname = string.Empty;
            string gender   = string.Empty;


            if (singleChild != null)
            {
                nickname = singleChild.Nickname;
                gender   = singleChild.Gender;
            }

            //add possession!
            if (nickname.EndsWith("s"))
            {
                nickname += "'";
            }
            else
            {
                nickname += "'s";
            }

            var pronoun = gender == "boy" ? DictionaryConstants.HeFragment : DictionaryConstants.SheFragment;

            uxFormTitle.Text   = Model.FormTitle.Rendered.Replace("$nickname$", nickname);
            uxIEPquestion.Text = Model.IEPQuestionTitle.Rendered.Replace("$pronoun$", pronoun);
            ux504question.Text = Model.Section504PlanQuestionTitle.Rendered.Replace("$pronoun$", pronoun);

            //var diagnosis = Sitecore.Context.Database.GetItem(Constants.DiagnosisContainer.ToString()).Children.ToList();
            var diagnosis = ChildDiagnosisItem.GetDiagnoses();

            int split = (diagnosis.Count() / 2);

            // make sure we get more on the left column if it's not exactly balanced
            if (diagnosis.Count() % 2 == 1)
            {
                split++;
            }

            var leftList  = diagnosis.Take(split);
            var rightList = diagnosis.Skip(split);

            uxLeftList.DataSource = leftList;
            uxLeftList.DataBind();

            uxRightList.DataSource = rightList;
            uxRightList.DataBind();

            var IEPstatus = Sitecore.Context.Database.GetItem(Constants.IEPStatusContainer.ToString()).Children.ToList();

            uxIEPStatus.DataSource     = IEPstatus;
            uxIEPStatus.DataValueField = "Id";
            uxIEPStatus.DataTextField  = "Name";
            uxIEPStatus.DataBind();

            var section504status = Sitecore.Context.Database.GetItem(Constants.Section504StatusContainer.ToString()).Children.ToList();

            ux504Status.DataSource     = section504status;
            ux504Status.DataValueField = "Id";
            ux504Status.DataTextField  = "Name";
            ux504Status.DataBind();

            // TODO: change to pull from dictionary
            var def = new ListItem()
            {
                Selected = true, Text = "Select One", Value = ""
            };

            uxIEPStatus.Items.Insert(0, def);
            ux504Status.Items.Insert(0, def);

            if (status == Constants.QueryStrings.Registration.ModeEdit)
            {
                //trust me, I hate that I have to stringify this to make it work...
                try
                {
                    var IEP = uxIEPStatus.Items.FindByValue("{" + singleChild.IEPStatus.ToString().ToUpper() + "}");
                    if (IEP != null)
                    {
                        //only clear selection if we have a match
                        uxIEPStatus.ClearSelection();
                        IEP.Selected = true;
                    }
                }
                catch (Exception)
                { }

                try
                {
                    var s504 = ux504Status.Items.FindByValue("{" + singleChild.Section504Status.ToString().ToUpper() + "}");
                    if (s504 != null)
                    {
                        ux504Status.ClearSelection();
                        s504.Selected = true;
                    }
                }
                catch (Exception)
                { }
            }

            //set validation
            Page.ClientScript.RegisterExpandoAttribute(valDiagnosis.ClientID, "groupName", "diagnosis");
            valDiagnosis.ErrorMessage = DictionaryConstants.MyProfile_SelectDiagnosisText;

            valIEP.ErrorMessage = DictionaryConstants.MyProfile_SelectIEPText;
            val504.ErrorMessage = DictionaryConstants.MyProfile_Select504Text;
        }