Ejemplo n.º 1
0
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Model":
                var modelFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                modelFilter.ShowSearchBox = true;
                modelFilter.SelectAll();
                break;

            case "Brand":
                var brandFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                brandFilter.SelectAll();
                break;

            case "Liter":
                var literFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                literFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Liter"));
                literFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Liter"));
                literFilter.Increment = 0.01;
                break;

            case "TransmissSpeedCount":
                var tskFilter = new C1.Win.DataFilter.ChecklistFilter("TransmissSpeedCount");
                tskFilter.HeaderText    = "Transmiss speed count";
                tskFilter.ShowSelectAll = false;
                tskFilter.SelectAll();
                e.Filter = tskFilter;
                break;

            case "Category":
                var categoryFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                categoryFilter.ShowSelectAll = false;
                categoryFilter.SelectAll();
                break;

            case "Price":
                var priceFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                priceFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Price"));
                priceFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Price"));
                priceFilter.Increment = 1000;
                priceFilter.Digits    = 0;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "PostId":
                var postFilter = new C1.Win.DataFilter.ChecklistFilter("PostId")
                {
                    DisplayMemberPath = "Title",
                    ValueMemberPath   = "Id",
                    SelectionMode     = C1.DataFilter.SelectionMode.Single,
                    ShowSearchBox     = false,
                    LayoutType        = C1.DataFilter.LayoutType.List,
                    MaxHeight         = 200,
                    HeaderText        = e.Filter.HeaderText,
                    ItemsSource       = Employee.Posts
                };
                postFilter.Items[0].Selected = true;
                e.Filter = postFilter;
                break;

            case "EmploymentDate":
                var eDate = (C1.Win.DataFilter.DateRangeFilter)e.Filter;
                var data  = (List <Employee>)c1DataFilter1.DataSource;
                eDate.Minimum = data.Min(x => x.EmploymentDate);
                eDate.Maximum = data.Max(x => x.EmploymentDate);
                break;

            case "CountryId":
                var cntFilter = new C1.Win.DataFilter.ChecklistFilter("CountryId")
                {
                    DisplayMemberPath = "Name",
                    ValueMemberPath   = "Id",
                    SelectionMode     = C1.DataFilter.SelectionMode.Multiple,
                    ShowSearchBox     = false,
                    ShowSelectAll     = true,
                    HeaderText        = e.Filter.HeaderText,
                    ItemsSource       = Employee.Countries
                };
                cntFilter.SelectAll();
                e.Filter = cntFilter;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "OrderDate":
                var orderDateFilter = (C1.Win.DataFilter.DateRangeFilter)e.Filter;
                orderDateFilter.Maximum    = _ordersTable.AsEnumerable().Max(x => x.Field <DateTime>("OrderDate"));
                orderDateFilter.Minimum    = _ordersTable.AsEnumerable().Min(x => x.Field <DateTime>("OrderDate"));
                orderDateFilter.HeaderText = "Order date";
                break;

            case "RequiredDate":
                var reqDateFilter = (C1.Win.DataFilter.DateRangeFilter)e.Filter;
                reqDateFilter.Maximum    = _ordersTable.AsEnumerable().Max(x => x.Field <DateTime>("RequiredDate"));
                reqDateFilter.Minimum    = _ordersTable.AsEnumerable().Min(x => x.Field <DateTime>("RequiredDate"));
                reqDateFilter.HeaderText = "Required date";
                break;

            case "Freight":
                var freightFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                freightFilter.Maximum    = (double)_ordersTable.AsEnumerable().Max(x => x.Field <decimal>("Freight"));
                freightFilter.Minimum    = (double)_ordersTable.AsEnumerable().Min(x => x.Field <decimal>("Freight"));
                freightFilter.Increment  = 10;
                freightFilter.HeaderText = "Freight";
                break;

            case "ShipCountry":
                var countryFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                countryFilter.HeaderText    = "Ship country";
                countryFilter.ShowSelectAll = true;
                countryFilter.ShowSearchBox = true;
                countryFilter.SelectAll();
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void C1DataFilter_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Model":
                var modelFilter = (ChecklistFilter)e.Filter;
                modelFilter.SelectAll();
                break;

            case "Brand":
                var brandFilter = (ChecklistFilter)e.Filter;
                brandFilter.SelectAll();
                break;

            case "Liter":
                var literFilter = (RangeFilter)e.Filter;
                literFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Liter"));
                literFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Liter"));
                literFilter.Increment = 0.01;
                break;

            case "TransmissSpeedCount":
                var transmissFilter = (ChecklistFilter)e.Filter;
                transmissFilter.HeaderText    = "Transmiss Speed Count";
                transmissFilter.ShowSelectAll = false;
                transmissFilter.SelectAll();
                break;

            case "Category":
                var categoryFilter = (ChecklistFilter)e.Filter;
                categoryFilter.ShowSelectAll = false;
                categoryFilter.SelectAll();
                break;

            case "TransmissAutomatic":
                var taFilter = (ChecklistFilter)e.Filter;
                taFilter.HeaderText  = "Transmiss Automatic";
                taFilter.ItemsSource = new List <TransmissAutomatic>()
                {
                    new TransmissAutomatic()
                    {
                        DisplayValue = "Yes", Value = "Yes"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "No", Value = "No"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "Empty", Value = string.Empty
                    }
                };
                taFilter.DisplayMemberPath = "DisplayValue";
                taFilter.ValueMemberPath   = "Value";
                taFilter.ShowSelectAll     = false;
                taFilter.SelectAll();
                break;

            case "Price":
                var priceFilter = (RangeFilter)e.Filter;
                priceFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Price"));
                priceFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Price"));
                priceFilter.Increment = 1000;
                priceFilter.Format    = "F0";
                break;

            default:
                e.Cancel = true;
                break;
            }
        }
        private void c1DataFilter1_FilterAutoGenerating(object sender, C1.DataFilter.FilterAutoGeneratingEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Model":
                var modelFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                modelFilter.ShowSearchBox = true;
                modelFilter.SelectAll();
                break;

            case "Brand":
                var brandFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                brandFilter.SelectAll();
                break;

            case "Liter":
                var literFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                literFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Liter"));
                literFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Liter"));
                literFilter.Increment = 0.01;
                break;

            case "TransmissSpeedCount":
                var tskFilter = new C1.Win.DataFilter.ChecklistFilter("TransmissSpeedCount");
                tskFilter.HeaderText    = "Transmiss speed count";
                tskFilter.ShowSelectAll = false;
                tskFilter.SelectAll();
                e.Filter = tskFilter;
                break;

            case "Category":
                var categoryFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                categoryFilter.ShowSelectAll = false;
                categoryFilter.SelectAll();
                break;

            case "TransmissAutomatic":
                var taFilter = (C1.Win.DataFilter.ChecklistFilter)e.Filter;
                taFilter.ItemsSource = new List <TransmissAutomatic>()
                {
                    new TransmissAutomatic()
                    {
                        DisplayValue = "Yes", Value = "Yes"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "No", Value = "No"
                    },
                    new TransmissAutomatic()
                    {
                        DisplayValue = "No information", Value = DBNull.Value
                    }
                };
                taFilter.DisplayMemberPath = "DisplayValue";
                taFilter.ValueMemberPath   = "Value";
                taFilter.ShowSelectAll     = false;
                taFilter.LayoutType        = C1.DataFilter.LayoutType.List;
                taFilter.SelectAll();
                break;

            case "Price":
                var priceFilter = (C1.Win.DataFilter.RangeFilter)e.Filter;
                priceFilter.Maximum   = _carsTable.AsEnumerable().Max(x => x.Field <double>("Price"));
                priceFilter.Minimum   = _carsTable.AsEnumerable().Min(x => x.Field <double>("Price"));
                priceFilter.Increment = 1000;
                priceFilter.Digits    = 0;
                break;

            default:
                e.Cancel = true;
                break;
            }
        }