Exemplo n.º 1
0
        /// <summary>
        /// Populates the tag list.
        /// </summary>
        private void PopulateTagList()
        {
            int      entityTypePersonId = EntityTypeCache.GetId(typeof(Rock.Model.Person)) ?? 0;
            var      tagQry             = new TagService(new RockContext()).Queryable("OwnerPersonAlias").Where(a => a.EntityTypeId == entityTypePersonId);
            RockPage rockPage           = _rblTagType.Page as RockPage;

            if (_rblTagType.SelectedValueAsInt() == 1)
            {
                // Personal tags - tags where the ownerid is the current person id
                tagQry = tagQry.Where(a => a.OwnerPersonAlias.PersonId == rockPage.CurrentPersonId).OrderBy(a => a.Name);
            }
            else
            {
                // Organizational tags - tags where the ownerid is null
                tagQry = tagQry.Where(a => a.OwnerPersonAlias == null).OrderBy(a => a.Name);
            }

            _ddlTagList.Items.Clear();
            var tempTagList = tagQry.ToList();

            foreach (var tag in tagQry.Select(a => new { a.Guid, a.Name }))
            {
                _ddlTagList.Items.Add(new ListItem(tag.Name, tag.Guid.ToString()));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the response to the rQuestions repeater control.
 /// </summary>
 private void GetResponse()
 {
     foreach (var item in rQuestions.Items.OfType <RepeaterItem>())
     {
         HiddenField         hfQuestionCode = item.FindControl("hfQuestionCode") as HiddenField;
         RockRadioButtonList rblQuestion    = item.FindControl("rblQuestion") as RockRadioButtonList;
         var assessment = _assessmentResponses.SingleOrDefault(a => a.Code == hfQuestionCode.Value);
         if (assessment != null)
         {
             assessment.Response = rblQuestion.SelectedValueAsInt(false);
         }
     }
 }