Beispiel #1
0
 /// <inheritdoc/>
 public override string GetTextValue(string value, Dictionary <string, string> configurationValues)
 {
     return(NumberRangeEditor.FormatDelimitedValues(value, "G") ?? value);
 }
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue(System.Web.UI.Control parentControl, string value, System.Collections.Generic.Dictionary <string, ConfigurationValue> configurationValues, bool condensed)
        {
            string formattedValue = NumberRangeEditor.FormatDelimitedValues(value) ?? value;

            return(base.FormatValue(parentControl, formattedValue, configurationValues, condensed));
        }
        /// <summary>
        /// Handles the DisplayFilterValue event of the gfAlertFilter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs"/> instance containing the event data.</param>
        protected void gfAlertFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case FilterKey.DateRange:
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            case FilterKey.Person:
            {
                int?personId = e.Value.AsIntegerOrNull();
                if (personId != null && ppPerson.Visible)
                {
                    var person = new PersonService(new RockContext()).Get(personId.Value);
                    if (person != null)
                    {
                        e.Value = person.ToString();
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }

            case FilterKey.AlertCategory:
            {
                e.Value = GetSelectedValues(e.Value, cblAlertCategory);
                break;
            }

            case FilterKey.AlertTypes:
            {
                e.Value = GetSelectedValues(e.Value, cblAlertTypes);
                break;
            }

            case FilterKey.Campus:
            {
                var campusId = e.Value.AsIntegerOrNull();
                if (campusId.HasValue && cpCampus.Visible)
                {
                    var campusCache = CampusCache.Get(campusId.Value);
                    if (campusCache != null)
                    {
                        e.Value = campusCache.Name;
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }

            case FilterKey.TransactionAmount:
            {
                e.Value = NumberRangeEditor.FormatDelimitedValues(e.Value, "N2");
                break;
            }
            }
        }