Exemplo n.º 1
0
        /// <summary>
        /// Binds the dropdown menus
        /// </summary>
        private void BindData()
        {
            using (var rockContext = new RockContext())
            {
                RegistrationInstanceService registrationInstanceService = new RegistrationInstanceService(rockContext);

                var registrationInstances = registrationInstanceService.Queryable().Where(ri => ri.IsActive == true).AsNoTracking().ToList();
                ddlRegistrationInstances.DataSource = registrationInstances;
                RegistrationInstance emptyRegistrationInstance = new RegistrationInstance {
                    Id = -1, Name = ""
                };
                registrationInstances.Insert(0, emptyRegistrationInstance);
                ddlRegistrationInstances.DataBind();

                var entityTypes = new EntityTypeService(new RockContext()).GetEntities()
                                  .Where(t => t.Guid.ToString() == Rock.SystemGuid.EntityType.GROUP.ToLower() ||
                                         t.Guid.ToString() == "5cd9c0c8-c047-61a0-4e36-0fdb8496f066" ||
                                         t.Guid.ToString() == Rock.SystemGuid.EntityType.DATAVIEW.ToLower())
                                  .OrderBy(t => t.FriendlyName)
                                  .ToList();
                entityTypes.Insert(0, new EntityType()
                {
                    Id = -1, FriendlyName = "Select One"
                });
                ddlEntityType.DataSource = entityTypes;
                ddlEntityType.DataBind();
            }
        }