Пример #1
0
        /// <summary>
        /// Creates the control(s) neccessary 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 service = new EmailTemplateService();

            foreach (var emailTemplate in service.Queryable().OrderBy(e => e.Title))
            {
                editControl.Items.Add(new ListItem(emailTemplate.Title, emailTemplate.Guid.ToString()));
            }

            return(editControl);
        }
Пример #2
0
        private void BindFilter()
        {
            ddlCategoryFilter.Items.Clear();
            ddlCategoryFilter.Items.Add("[All]");

            EmailTemplateService emailTemplateService = new EmailTemplateService();
            var items = emailTemplateService.Queryable().
                        Where(a => a.Category.Trim() != "" && a.Category != null).
                        OrderBy(a => a.Category).
                        Select(a => a.Category.Trim()).
                        Distinct().ToList();

            foreach (var item in items)
            {
                ddlCategoryFilter.Items.Add(item);
            }
        }
Пример #3
0
        /// <summary>
        /// Binds the filter.
        /// </summary>
        private void BindFilter()
        {
            ddlCategoryFilter.Items.Clear();
            ddlCategoryFilter.Items.Add(new ListItem(All.Text, All.Id.ToString()));

            EmailTemplateService emailTemplateService = new EmailTemplateService();
            var items = emailTemplateService.Queryable().
                        Where(a => a.Category.Trim() != "" && a.Category != null).
                        OrderBy(a => a.Category).
                        Select(a => a.Category.Trim()).
                        Distinct().ToList();

            foreach (var item in items)
            {
                ListItem li = new ListItem(item);
                li.Selected = (!Page.IsPostBack && rFilter.GetUserPreference("Category") == item);
                ddlCategoryFilter.Items.Add(li);
            }
        }
Пример #4
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            EmailTemplateService emailTemplateService = new EmailTemplateService();
            SortProperty         sortProperty         = gEmailTemplates.SortProperty;

            var emailTemplates = emailTemplateService.Queryable();

            if (ddlCategoryFilter.SelectedValue != All.Id.ToString())
            {
                emailTemplates = emailTemplates.Where(a => a.Category.Trim() == ddlCategoryFilter.SelectedValue);
            }

            if (sortProperty != null)
            {
                gEmailTemplates.DataSource = emailTemplates.Sort(sortProperty).ToList();
            }
            else
            {
                gEmailTemplates.DataSource = emailTemplates.OrderBy(a => a.Category).ThenBy(a => a.Title).ToList();
            }

            gEmailTemplates.DataBind();
        }