Beispiel #1
0
        /// <summary>
        /// Gfs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void gfFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            if (AvailableAttributes != null && SelectedChannelId.HasValue)
            {
                var attribute = AvailableAttributes.FirstOrDefault(a => MakeKeyUniqueToChannel(SelectedChannelId.Value, a.Key) == e.Key);
                if (attribute != null)
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject <List <string> >(e.Value);
                        e.Value = attribute.FieldType.Field.FormatFilterValues(attribute.QualifierValues, values);
                        return;
                    }
                    catch
                    {
                        // intentionally ignore
                    }
                }
            }

            if (e.Key == "Date Range")
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
            }
            else if (e.Key == "Status")
            {
                var status = e.Value.ConvertToEnumOrNull <ContentChannelItemStatus>();
                if (status.HasValue)
                {
                    {
                        e.Value = status.ConvertToString();
                    }
                }
            }
            else if (e.Key == "Title")
            {
                return;
            }
            else if (e.Key == "Created By")
            {
                string personName = string.Empty;

                int?personId = e.Value.AsIntegerOrNull();
                if (personId.HasValue)
                {
                    var personService = new PersonService(new RockContext());
                    var person        = personService.Get(personId.Value);
                    if (person != null)
                    {
                        personName = person.FullName;
                    }
                }

                e.Value = personName;
            }
            else
            {
                e.Value = string.Empty;
            }
        }
        /// <summary>
        /// Gfs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Status":
                var status = e.Value.ConvertToEnumOrNull <ContentChannelItemStatus>();
                if (status.HasValue)
                {
                    {
                        e.Value = status.ConvertToString();
                    }
                }

                break;

            case "Title":
                break;

            default:
                e.Value = string.Empty;
                break;
            }
        }
        /// <summary>
        /// Fs the payments_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void fPayments_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            case "Currency Type":
            {
                var ids = e.Value.SplitDelimitedValues().AsIntegerList();
                e.Value = DefinedTypeCache.Read(Rock.SystemGuid.DefinedType.FINANCIAL_CURRENCY_TYPE.AsGuid())
                          .DefinedValues
                          .Where(dv => ids.Contains(dv.Id))
                          .Select(dv => dv.Value)
                          .ToList()
                          .AsDelimited(", ");
                break;
            }

            default:
            {
                e.Value = string.Empty;
                break;
            }
            }
        }
 /// <summary>
 /// Gfs the metric values_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void gfMetricValues_DisplayFilterValue( object sender, GridFilter.DisplayFilterValueArgs e )
 {
     if ( e.Key == "Date Range" )
     {
         e.Value = DateRangePicker.FormatDelimitedValues( e.Value );
     }
     else if ( e.Key == "Goal/Measure" )
     {
         var metricValueType = e.Value.ConvertToEnumOrNull<MetricValueType>();
         if ( metricValueType.HasValue )
         {
             e.Value = metricValueType.Value.ConvertToString();
         }
         else
         {
             e.Value = null;
         }
     }
     else if ( e.Key == EntityPreferenceKey )
     {
         e.Name = hfEntityTypeName.Value;
         var parts = e.Value.Split( '|' );
         if ( parts.Length >= 2 )
         {
             e.Value = GetSeriesName( parts[1].AsIntegerOrNull() );
         }
     }
     else
     {
         e.Value = null;
     }
 }
Beispiel #5
0
        /// <summary>
        /// Gfs the batches to export filter display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfBatchesToExportFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            case "Status":
            {
                var status = e.Value.ConvertToEnumOrNull <BatchStatus>();
                if (status.HasValue)
                {
                    e.Value = status.ConvertToString();
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Gfs the settings_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfSettings_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Authentication Provider":
            {
                var entityType = EntityTypeCache.Read(compProviderFilter.SelectedValue.AsGuid());
                if (entityType != null)
                {
                    e.Value = entityType.FriendlyName;
                }

                break;
            }

            case "Created":
            case "Last Login":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            case "Is Confirmed":
            case "Is Locked Out":
            {
                bool value = false;
                if (bool.TryParse(e.Value, out value))
                {
                    e.Value = value ? "Yes" : "No";
                }

                break;
            }
            }
        }
Beispiel #7
0
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Subject":
            case "Content":
            {
                break;
            }

            case "Status":
            {
                if (!string.IsNullOrWhiteSpace(e.Value))
                {
                    e.Value = (( CommunicationStatus )System.Enum.Parse(typeof(CommunicationStatus), e.Value)).ConvertToString();
                }

                break;
            }

            case "Created By":
            {
                string personName = string.Empty;

                if (canApprove)
                {
                    int?personId = e.Value.AsIntegerOrNull();
                    if (personId.HasValue)
                    {
                        var personService = new PersonService(new RockContext());
                        var person        = personService.Get(personId.Value);
                        if (person != null)
                        {
                            personName = person.FullName;
                        }
                    }
                }

                e.Value = personName;

                break;
            }

            case "Created Date Range":
            case "Sent Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            default:
            {
                e.Value = string.Empty;
                break;
            }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Gfs the pledges_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void gfPledges_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Person":
                int?personId = e.Value.AsIntegerOrNull();
                if (personId != null)
                {
                    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 "Accounts":

                var accountIdList = e.Value.Split(',').AsIntegerList();
                if (accountIdList.Any())
                {
                    var service  = new FinancialAccountService(new RockContext());
                    var accounts = service.GetByIds(accountIdList);
                    if (accounts != null && accounts.Any())
                    {
                        e.Value = accounts.Select(a => a.Name).ToList().AsDelimited(",");
                    }
                    else
                    {
                        e.Value = string.Empty;
                    }
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;

            default:
                e.Value = string.Empty;
                break;
            }
        }
        /// <summary>
        /// Displays the text of the current filters
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            DateTime startDateTimeValue;
            DateTime endDateTimeValue;

            if (DateRangePicker.TryParse(e.Value, out startDateTimeValue, out endDateTimeValue))
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
            }
        }
Beispiel #10
0
 /// <summary>
 /// Displays the text of the current filters
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void fRequest_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
 {
     switch (e.Key)
     {
     case "Request Date Range":
     case "Response Date Range":
         e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
         break;
     }
 }
Beispiel #11
0
        /// <summary>
        /// Handles displaying the stored filter values.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
        protected void gfFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            if (AvailableAttributes != null)
            {
                var attribute = AvailableAttributes.FirstOrDefault(a => ("Attribute_" + a.Key) == e.Key);
                if (attribute != null)
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject <List <string> >(e.Value);
                        e.Value = attribute.FieldType.Field.FormatFilterValues(attribute.QualifierValues, values);
                        return;
                    }
                    catch
                    {
                        // intentionally ignore
                    }
                }
            }

            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            // don't display dead setting
            case "From Date":
                e.Value = string.Empty;
                break;

            // don't display dead setting
            case "To Date":
                e.Value = string.Empty;
                break;

            case "Prayer Category":

                int categoryId = e.Value.AsIntegerOrNull() ?? All.Id;
                if (categoryId == All.Id)
                {
                    e.Value = "All";
                }
                else
                {
                    var category = Rock.Web.Cache.CategoryCache.Read(categoryId);
                    if (category != null)
                    {
                        e.Value = category.Name;
                    }
                }

                break;
            }
        }
Beispiel #12
0
        /// <summary>
        /// Handles the DisplayFilterValue event of the gfSettings control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void gfSettings_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Category":
            {
                int?categoryId = e.Value.AsIntegerOrNull();
                if (categoryId.HasValue)
                {
                    var category = Rock.Web.Cache.CategoryCache.Read(categoryId.Value);
                    if (category != null)
                    {
                        e.Value = category.Name;
                    }
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }

            case "Summary Contains":
            {
                break;
            }

            case "Who":
            {
                int personId = int.MinValue;
                if (int.TryParse(e.Value, out personId))
                {
                    var person = new PersonService(new RockContext()).Get(personId);
                    if (person != null)
                    {
                        e.Value = person.FullName;
                    }
                }
                break;
            }

            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            default:
            {
                e.Value = string.Empty;
                break;
            }
            }
        }
Beispiel #13
0
        protected void gfWorkflows_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            if (AvailableAttributes != null)
            {
                var attribute = AvailableAttributes.FirstOrDefault(a => MakeKeyUniqueToType(a.Key) == e.Key);
                if (attribute != null)
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject <List <string> >(e.Value);
                        e.Value = attribute.FieldType.Field.FormatFilterValues(attribute.QualifierValues, values);
                        return;
                    }
                    catch { }
                }
            }

            if (e.Key == MakeKeyUniqueToType("Activated"))
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
            }
            else if (e.Key == MakeKeyUniqueToType("Completed"))
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
            }
            else if (e.Key == MakeKeyUniqueToType("Initiator"))
            {
                int?personId = e.Value.AsIntegerOrNull();
                if (personId.HasValue)
                {
                    var person = new PersonService(new RockContext()).Get(personId.Value);
                    if (person != null)
                    {
                        e.Value = person.FullName;
                    }
                }
            }
            else if (e.Key == MakeKeyUniqueToType("Name"))
            {
                return;
            }
            else if (e.Key == MakeKeyUniqueToType("Status"))
            {
                return;
            }
            else if (e.Key == MakeKeyUniqueToType("State"))
            {
                return;
            }
            else
            {
                e.Value = string.Empty;
            }
        }
Beispiel #14
0
 /// <summary>
 /// Gfs the metric values_ display filter value.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 protected void gfMetricValues_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
 {
     if (e.Key == "Date Range")
     {
         e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
     }
     else
     {
         e.Value = null;
     }
 }
Beispiel #15
0
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Medium":
            {
                var entity = EntityTypeCache.Read(e.Value.AsGuid());
                if (entity != null)
                {
                    e.Value = entity.FriendlyName;
                }

                break;
            }

            case "Status":
            {
                if (!string.IsNullOrWhiteSpace(e.Value))
                {
                    var status = e.Value.ConvertToEnumOrNull <CommunicationStatus>();
                    e.Value = status.ConvertToString();
                }

                break;
            }

            case "Created By":
            {
                string personName = string.Empty;

                int?personId = e.Value.AsIntegerOrNull();
                if (personId.HasValue)
                {
                    var personService = new PersonService(new RockContext());
                    var person        = personService.Get(personId.Value);
                    if (person != null)
                    {
                        personName = person.FullName;
                    }
                }

                e.Value = personName;

                break;
            }

            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }
            }
        }
        /// <summary>
        /// Gfs the settings_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfSettings_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Amount":
                e.Value = NumberRangeEditor.FormatDelimitedValues(e.Value, "N2");
                break;

            case "Frequency":
                int definedValueId = 0;
                if (int.TryParse(e.Value, out definedValueId))
                {
                    var definedValue = DefinedValueCache.Read(definedValueId);
                    if (definedValue != null)
                    {
                        e.Value = definedValue.Value;
                    }
                }

                break;

            case "Created":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Account":

                int accountId = 0;
                if (int.TryParse(e.Value, out accountId) && ddlAccount.Visible)
                {
                    var service = new FinancialAccountService(new RockContext());
                    var account = service.Get(accountId);
                    if (account != null)
                    {
                        e.Value = account.Name;
                    }
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;

            case "Include Inactive":
                break;

            default:
                e.Value = string.Empty;
                break;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Group":
                e.Value = ddlGroups.SelectedValue;
                break;
            }
        }
Beispiel #18
0
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void gfTransactions_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Row Limit":
                // row limit filter was removed, so hide it just in case
                e.Value = null;
                break;

            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Amount Range":
                e.Value = NumberRangeEditor.FormatDelimitedValues(e.Value, "N2");
                break;

            case "Account":

                var accountIds = e.Value.SplitDelimitedValues().AsIntegerList().Where(a => a > 0).ToList();
                if (accountIds.Any())
                {
                    var service      = new FinancialAccountService(new RockContext());
                    var accountNames = service.GetByIds(accountIds).OrderBy(a => a.Order).OrderBy(a => a.Name).Select(a => a.Name).ToList().AsDelimited(", ", " or ");
                    e.Value = accountNames;
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;

            case "Transaction Type":
            case "Currency Type":
            case "Credit Card Type":
            case "Source Type":

                int definedValueId = 0;
                if (int.TryParse(e.Value, out definedValueId))
                {
                    var definedValue = DefinedValueCache.Read(definedValueId);
                    if (definedValue != null)
                    {
                        e.Value = definedValue.Value;
                    }
                }

                break;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            var rockContext = new RockContext();

            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Person":
                var person = new PersonService(rockContext).Get(e.Value.AsIntegerOrNull() ?? 0);
                if (person != null)
                {
                    e.Value = person.ToString();
                }
                else
                {
                    e.Value = null;
                }

                break;

            case "Group":
                var group = new GroupService(rockContext).Get(e.Value.AsIntegerOrNull() ?? 0);
                if (group != null)
                {
                    e.Value = group.ToString();
                }
                else
                {
                    e.Value = null;
                }

                break;

            case "Schedule":
                var schedule = new ScheduleService(rockContext).Get(e.Value.AsIntegerOrNull() ?? 0);
                if (schedule != null)
                {
                    e.Value = schedule.Name;
                }
                else
                {
                    e.Value = null;
                }

                break;
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            if (AvailableAttributes != null)
            {
                var attribute = AvailableAttributes.FirstOrDefault(a => MakeKeyUniqueToEventCalendar(a.Key) == e.Key);
                if (attribute != null)
                {
                    try
                    {
                        var values = JsonConvert.DeserializeObject <List <string> >(e.Value);
                        e.Value = attribute.FieldType.Field.FormatFilterValues(attribute.QualifierValues, values);
                        return;
                    }
                    catch { }
                }
            }

            if (e.Key == MakeKeyUniqueToEventCalendar("Campus"))
            {
                e.Value = ResolveValues(e.Value, cblCampus);
            }
            else if (e.Key == MakeKeyUniqueToEventCalendar("DateRange"))
            {
                var drp = new DateRangePicker();
                drp.DelimitedValues = e.Value;
                if (drp.LowerValue.HasValue && !drp.UpperValue.HasValue)
                {
                    drp.UpperValue = drp.LowerValue.Value.AddYears(1).AddDays(-1);
                }
                else if (drp.UpperValue.HasValue && !drp.LowerValue.HasValue)
                {
                    drp.LowerValue = drp.UpperValue.Value.AddYears(-1).AddDays(1);
                }
                e.Value = DateRangePicker.FormatDelimitedValues(drp.DelimitedValues);
            }
            else if (e.Key == MakeKeyUniqueToEventCalendar("Audiences"))
            {
                e.Value = ResolveValues(e.Value, cblAudience);
            }
            else if (e.Key == MakeKeyUniqueToEventCalendar("Status") ||
                     e.Key == MakeKeyUniqueToEventCalendar("ApprovalStatus"))
            {
                e.Value = e.Value;
            }
            else
            {
                e.Value = string.Empty;
            }
        }
Beispiel #21
0
        /// <summary>
        /// Handles the DisplayFilterValue event of the gfBatchFilter 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 gfBatchFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Row Limit":
            {
                // row limit filter was removed, so hide it just in case
                e.Value = null;
                break;
            }

            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }

            case "Status":
            {
                var status = e.Value.ConvertToEnumOrNull <BatchStatus>();
                if (status.HasValue)
                {
                    e.Value = status.ConvertToString();
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }

            case "Campus":
            {
                var campus = CampusCache.Read(e.Value.AsInteger());
                if (campus != null)
                {
                    e.Value = campus.Name;
                }
                else
                {
                    e.Value = string.Empty;
                }

                break;
            }
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Campus":
            {
                var values = new List <string>();
                foreach (string value in e.Value.Split(';'))
                {
                    var item = cblCampus.Items.FindByValue(value);
                    if (item != null)
                    {
                        values.Add(item.Text);
                    }
                }
                e.Value = values.AsDelimited(", ");
                break;
            }

            case "DateRange":
            {
                var drp = new DateRangePicker();
                drp.DelimitedValues = e.Value;
                if (drp.LowerValue.HasValue && !drp.UpperValue.HasValue)
                {
                    drp.UpperValue = drp.LowerValue.Value.AddYears(1).AddDays(-1);
                }
                else if (drp.UpperValue.HasValue && !drp.LowerValue.HasValue)
                {
                    drp.LowerValue = drp.UpperValue.Value.AddYears(-1).AddDays(1);
                }
                e.Value = DateRangePicker.FormatDelimitedValues(drp.DelimitedValues);
                break;
            }

            case "Contact":
            {
                e.Value = e.Value;
                break;
            }

            default:
            {
                e.Value = string.Empty;
                break;
            }
            }
        }
Beispiel #23
0
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Medium":
            {
                var entity = EntityTypeCache.Read(e.Value.AsGuid());
                if (entity != null)
                {
                    e.Value = entity.FriendlyName;
                }

                break;
            }

            case "Status":
            {
                if (!string.IsNullOrWhiteSpace(e.Value))
                {
                    e.Value = ((CommunicationStatus)System.Enum.Parse(typeof(CommunicationStatus), e.Value)).ConvertToString();
                }

                break;
            }

            case "Created By":
            {
                int personId = 0;
                if (int.TryParse(e.Value, out personId) && personId != 0)
                {
                    var personService = new PersonService(new RockContext());
                    var person        = personService.Get(personId);
                    if (person != null)
                    {
                        e.Value = person.FullName;
                    }
                }

                break;
            }

            case "Date Range":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }
            }
        }
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case FilterKey.FirstName:
            case FilterKey.LastName:
                return;

            case FilterKey.EnrollmentDate:
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            default:
                e.Value = string.Empty;
                break;
            }
        }
Beispiel #25
0
        /// <summary>
        /// Rs the filter_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Active Status":
                e.Value = e.Value;
                break;

            default:
                e.Value = string.Empty;
                break;
            }
        }
Beispiel #26
0
        /// <summary>
        /// Gfs the settings_ display filter value.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected void gfFiler_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case UserPreferenceKey.EntityType:
            {
                var entityTypeId = e.Value.AsIntegerOrNull();
                if (entityTypeId.HasValue && entityTypeId.Value != default(int))
                {
                    e.Value = EntityTypeCache.Get(entityTypeId.Value).FriendlyName;
                }

                break;
            }

            case UserPreferenceKey.Date:
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);

                break;
            }

            case UserPreferenceKey.ChangedBy:
            {
                var rockContext = new RockContext();
                int?personId    = e.Value.AsIntegerOrNull();
                e.Value = null;
                if (personId.HasValue)
                {
                    var person = new PersonService(rockContext).Get(personId.Value);
                    if (person != null)
                    {
                        e.Value = person.ToString();
                    }
                }

                break;
            }

            case UserPreferenceKey.EntityId:
            {
                break;
            }
            }
        }
Beispiel #27
0
        protected void gFilter_OnDisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Status":
            {
                if (!string.IsNullOrWhiteSpace(e.Value))
                {
                    var connectionStatus = new ConnectionStatusService(new RockContext()).Get(e.Value.AsGuid());
                    if (connectionStatus != null)
                    {
                        e.Value = connectionStatus.Name;
                    }
                }

                break;
            }

            case "Consolidator":
            {
                string personName = string.Empty;

                int?personId = e.Value.AsIntegerOrNull();
                if (personId.HasValue)
                {
                    var personService = new PersonService(new RockContext());
                    var person        = personService.Get(personId.Value);
                    if (person != null)
                    {
                        personName = person.FullName;
                    }
                }

                e.Value = personName;

                break;
            }

            case "Submitted":
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;
            }
            }
        }
        /// <summary>
        /// Handles the filter display for each saved user value
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void rFilter_DisplayFilterValue(object sender, Rock.Web.UI.Controls.GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            case "Amount Range":
                e.Value = NumberRangeEditor.FormatDelimitedValues(e.Value, "N2");
                break;

            case "Account":

                int accountId = 0;
                if (int.TryParse(e.Value, out accountId))
                {
                    var service = new FinancialAccountService();
                    var account = service.Get(accountId);
                    if (account != null)
                    {
                        e.Value = account.Name;
                    }
                }

                break;

            case "Transaction Type":
            case "Currency Type":
            case "Credit Card Type":
            case "Source Type":

                int definedValueId = 0;
                if (int.TryParse(e.Value, out definedValueId))
                {
                    var definedValue = DefinedValueCache.Read(definedValueId);
                    if (definedValue != null)
                    {
                        e.Value = definedValue.Name;
                    }
                }

                break;
            }
        }
        /// <summary>
        /// Handles displaying the stored filter values.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e as DisplayFilterValueArgs (hint: e.Key and e.Value).</param>
        protected void gfFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            switch (e.Key)
            {
            case "Date Range":
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
                break;

            // don't display dead setting
            case "From Date":
                e.Value = string.Empty;
                break;

            // don't display dead setting
            case "To Date":
                e.Value = string.Empty;
                break;
            }
        }
Beispiel #30
0
        /// <summary>
        /// Format a filter value to friendly text for display.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rFilter_DisplayFilterValue(object sender, GridFilter.DisplayFilterValueArgs e)
        {
            if (e.Key == FilterKey.StepStatus)
            {
                e.Value = GetStepStatusNames(e.Value, cblStepStatus);
            }
            else if (e.Key == FilterKey.DateStarted || e.Key == FilterKey.DateCompleted)
            {
                e.Value = DateRangePicker.FormatDelimitedValues(e.Value);
            }
            else if (e.Key == FilterKey.FirstName || e.Key == FilterKey.LastName || e.Key == FilterKey.Note)
            {
                // No change
            }
            else
            {
                // Find a matching Attribute.
                if (this.AvailableAttributes != null)
                {
                    var attribute = AvailableAttributes.FirstOrDefault(a => a.Key == e.Key);

                    if (attribute != null)
                    {
                        try
                        {
                            var values = JsonConvert.DeserializeObject <List <string> >(e.Value);

                            e.Value = attribute.FieldType.Field.FormatFilterValues(attribute.QualifierValues, values);

                            return;
                        }
                        catch
                        {
                            // Ignore
                        }
                    }
                }

                // Invalid filter field, so ignore the filter value.
                e.Value = string.Empty;
            }
        }