/// <summary> /// Binds the data source to the selection control. /// </summary> private void BindControl() { rblAlertType.BindToEnum <AlertType>(); var rockContext = new RockContext(); var connectionTypeService = new ConnectionTypeService(rockContext); ddlConnectionType.Items.Clear(); ddlConnectionType.Items.Add(new ListItem()); ddlConnectionType.Items.AddRange(connectionTypeService.Queryable().Select(x => new ListItem { Text = x.Name, Value = x.Id.ToString() }).ToArray()); dvpPersonDataView.EntityTypeId = EntityTypeCache.Get(typeof(Rock.Model.Person)).Id; var systemCommunications = new SystemCommunicationService(rockContext).Queryable().OrderBy(e => e.Title); ddlDonorSystemCommunication.Items.Clear(); ddlDonorSystemCommunication.Items.Add(new ListItem()); ddlAccountParticipantSystemCommunication.Items.Clear(); ddlAccountParticipantSystemCommunication.Items.Add(new ListItem()); if (systemCommunications.Any()) { ddlDonorSystemCommunication.Items.AddRange(systemCommunications.Select(x => new ListItem { Text = x.Title, Value = x.Id.ToString() }).ToArray()); ddlAccountParticipantSystemCommunication.Items.AddRange(systemCommunications.Select(x => new ListItem { Text = x.Title, Value = x.Id.ToString() }).ToArray()); } }
/// <summary> /// Bind the email templates /// </summary> private void BindApprovalEmailTemplates() { var SystemCommunications = new SystemCommunicationService(new RockContext()).Queryable().OrderBy(e => e.Title); ddlApprovalEmailTemplate.Items.Clear(); if (SystemCommunications.Any()) { foreach (var SystemCommunication in SystemCommunications) { ddlApprovalEmailTemplate.Items.Add(new ListItem(SystemCommunication.Title, SystemCommunication.Guid.ToString())); } } ddlApprovalEmailTemplate.SetValue(Rock.Web.SystemSettings.GetValue(SystemSetting.COMMUNICATION_SETTING_APPROVAL_TEMPLATE).AsGuidOrNull()); }
/// <summary> /// Creates the control(s) necessary for prompting user for a new value /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id"></param> /// <returns> /// The control /// </returns> public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id) { var editControl = new RockDropDownList { ID = id }; var SystemCommunications = new SystemCommunicationService(new RockContext()).Queryable().OrderBy(e => e.Title); // add a blank for the first option editControl.Items.Add(new ListItem()); if (SystemCommunications.Any()) { foreach (var SystemCommunication in SystemCommunications) { editControl.Items.Add(new ListItem(SystemCommunication.Title, SystemCommunication.Guid.ToString())); } return(editControl); } return(null); }