示例#1
0
        protected void BindWorshipServicePicker()
        {
            var worshipServiceValues = new DefinedTypeService(ctx).Queryable().Where(t => t.Name == "Campus Worship Service").Select(d => d.DefinedValues);

            campusWorshipAttendance = new List <CampusWorshipAttendance>();
            foreach (var value in worshipServiceValues.FirstOrDefault())
            {
                value.LoadAttributes();
                var worshipService = value.AttributeValues.Where(a => a.Key == "WorshipService").Select(v => v.Value).FirstOrDefault();
                var campus         = value.AttributeValues.Where(a => a.Key == "Campus").Select(v => v.Value).FirstOrDefault();
                var prayerCat      = value.AttributeValues.Where(a => a.Key == "PrayerCategory").Select(v => v.Value).FirstOrDefault();
                campusWorshipAttendance.Add(new CampusWorshipAttendance
                {
                    Text           = value.Value,
                    WorshipService = worshipService.Value,
                    Campus         = campus.Value,
                    PrayerCategory = prayerCat.Value
                });
            }
            ddlWorshipService.DataSource         = campusWorshipAttendance;
            Session["campus-worship-attendance"] = campusWorshipAttendance;
            ddlWorshipService.DataBind();
        }