Example #1
0
        //видалити значення фільтра з GridView - звільнені
        private void NotWorkingCheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            Telerik.Windows.Controls.GridViewColumn isworkColumn = this.RadGridView.Columns["IsWork"];
            IColumnFilterDescriptor workerFilter = isworkColumn.ColumnFilterDescriptor;

            // Призупинити фільтр GridView
            workerFilter.SuspendNotifications();

            // видалити з GridView фільтр
            workerFilter.DistinctFilter.RemoveDistinctValue("Звільнений");
            workerFilter.FieldFilter.Filter1.IsCaseSensitive = true;
            //оновити фільтр GridView
            workerFilter.ResumeNotifications();
        }
        public void Prepare(Telerik.Windows.Controls.GridViewColumn column)
        {
            this.column = column as GridViewBoundColumnBase;
            if (this.column == null)
            {
                return;
            }

            if (this.compositeFilter == null)
            {
                this.CreateFilters();
            }

            this.fromFilter.Value = this.FromDate;
            this.toFilter.Value   = this.ToDate;
        }
Example #3
0
        //вивести всіх працюючих на даний час працівників в GridView
        private void WorkingCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (WorkingCheckBox.IsChecked == true)
            {
                Telerik.Windows.Controls.GridViewColumn isworkColumn = this.RadGridView.Columns["IsWork"];
                IColumnFilterDescriptor workerFilter = isworkColumn.ColumnFilterDescriptor;

                // Призупинити фільтр GridView
                workerFilter.SuspendNotifications();

                // додати значенння фільтру в GridView
                workerFilter.DistinctFilter.AddDistinctValue("Працює");
                workerFilter.FieldFilter.Filter1.IsCaseSensitive = true;
                //оновити фільтр GridView
                workerFilter.ResumeNotifications();
            }
        }
Example #4
0
        public ProductWin(int CustomerId)
        {
            InitializeComponent();
            DataContext = new vmProductLight();

            this.RadGridView1.MouseDoubleClick += this.OnGridMouseDoubleClick;
            textBoxFilterValue.Focus();
            this.Left = SystemParameters.PrimaryScreenWidth - this.Width;

            Telerik.Windows.Controls.GridViewColumn productColumn = this.RadGridView1.Columns["ProductId"];
            Telerik.Windows.Controls.GridView.IColumnFilterDescriptor productFilter = productColumn.ColumnFilterDescriptor;

            //productColumn = this.RadGridView1.Columns["Description"];
            //Telerik.Windows.Controls.GridView.IColumnFilterDescriptor productFilter2 = productColumn.ColumnFilterDescriptor;

            SunSeven.DataSource.JSDataContext lDataContext = new CommonFunction().JSDataContext();
            foreach (var l in lDataContext.ProductFiltering(CustomerId))
            {
                productFilter.DistinctFilter.AddDistinctValue(l.productId);
                //  productFilter2.DistinctFilter.AddDistinctValue(l.Description);
            }
        }
Example #5
0
        public void RestoreValue(CustomPropertyInfo customPropertyInfo, object context, object value)
        {
            RadGridView gridView = context as RadGridView;

            switch (customPropertyInfo.Name)
            {
            case "Columns":
            {
                List <ColumnProxy> columnProxies = value as List <ColumnProxy>;

                foreach (ColumnProxy proxy in columnProxies)
                {
                    GridViewColumn column = gridView.Columns[proxy.UniqueName];
                    column.DisplayIndex = proxy.DisplayOrder;
                    column.Header       = proxy.Header;
                    column.Width        = proxy.Width;
                }
            }
            break;

            case "SortDescriptors":
            {
                gridView.SortDescriptors.SuspendNotifications();

                gridView.SortDescriptors.Clear();

                List <SortDescriptorProxy> sortDescriptoProxies = value as List <SortDescriptorProxy>;

                foreach (SortDescriptorProxy proxy in sortDescriptoProxies)
                {
                    GridViewColumn column = gridView.Columns[proxy.ColumnUniqueName];
                    gridView.SortDescriptors.Add(new ColumnSortDescriptor()
                        {
                            Column = column, SortDirection = proxy.SortDirection
                        });
                }

                gridView.SortDescriptors.ResumeNotifications();
            }
            break;

            case "GroupDescriptors":
            {
                gridView.GroupDescriptors.SuspendNotifications();

                gridView.GroupDescriptors.Clear();

                List <GroupDescriptorProxy> groupDescriptorProxies = value as List <GroupDescriptorProxy>;

                foreach (GroupDescriptorProxy proxy in groupDescriptorProxies)
                {
                    GridViewColumn column = gridView.Columns[proxy.ColumnUniqueName];
                    gridView.GroupDescriptors.Add(new ColumnGroupDescriptor()
                        {
                            Column = column, SortDirection = proxy.SortDirection
                        });
                }

                gridView.GroupDescriptors.ResumeNotifications();
            }
            break;

            case "FilterDescriptors":
            {
                gridView.FilterDescriptors.SuspendNotifications();

                foreach (var c in gridView.Columns)
                {
                    if (c.ColumnFilterDescriptor.IsActive)
                    {
                        c.ClearFilters();
                    }
                }

                List <FilterSetting> filterSettings = value as List <FilterSetting>;

                foreach (FilterSetting setting in filterSettings)
                {
                    Telerik.Windows.Controls.GridViewColumn column = gridView.Columns[setting.ColumnUniqueName];

                    Telerik.Windows.Controls.GridView.IColumnFilterDescriptor columnFilter = column.ColumnFilterDescriptor;

                    foreach (object distinctValue in setting.SelectedDistinctValues)
                    {
                        columnFilter.DistinctFilter.AddDistinctValue(distinctValue);
                    }

                    if (setting.Filter1 != null)
                    {
                        columnFilter.FieldFilter.Filter1.Operator        = setting.Filter1.Operator;
                        columnFilter.FieldFilter.Filter1.Value           = setting.Filter1.Value;
                        columnFilter.FieldFilter.Filter1.IsCaseSensitive = setting.Filter1.IsCaseSensitive;
                    }

                    columnFilter.FieldFilter.LogicalOperator = setting.FieldFilterLogicalOperator;

                    if (setting.Filter2 != null)
                    {
                        columnFilter.FieldFilter.Filter2.Operator        = setting.Filter2.Operator;
                        columnFilter.FieldFilter.Filter2.Value           = setting.Filter2.Value;
                        columnFilter.FieldFilter.Filter2.IsCaseSensitive = setting.Filter2.IsCaseSensitive;
                    }
                }

                gridView.FilterDescriptors.ResumeNotifications();
            }
            break;
            }
        }
Example #6
0
 public MyFilteringControl(Telerik.Windows.Controls.GridViewColumn column)
     : base(column)
 {
     this.Loaded += MyFilteringControl_Loaded;
 }
Example #7
0
 public CustomFilter(Telerik.Windows.Controls.GridViewColumn column, Popup popup) : base(column)
 {
     // Apply the line below only when using NoXaml binaries
     // this.DefaultStyleKey=typeof(MyFilteringControl);
     FilterPopup = popup;
 }
Example #8
0
 public static Telerik.Windows.Controls.GridView.GridViewCellBase GetCell(this Telerik.Windows.Controls.GridView.GridViewRow row, Telerik.Windows.Controls.GridViewColumn column)
 {
     if (row != null)
     {
         foreach (var cell in row.Cells)
         {
             if (cell.Column == column)
             {
                 return(cell);
             }
         }
     }
     return(null);
 }