コード例 #1
0
 public async void TriggerFilterStringChanged()
 {
     //call event handler if one is attached
     if (_filterString == "")
     {
         dgGrpAgent.DataSource = GetDataSource(listAgentPaged);
     }
     else
     {
         FilterEventArgs filterEventArgs = new FilterEventArgs
         {
             FilterString = _filterString,
             Cancel       = false
         };
         if (FilterStringChanged != null)
         {
             FilterStringChanged.Invoke(this, filterEventArgs);
         }
         //sort datasource
         if (filterEventArgs.Cancel == false)
         {
             List <Education_Agent> listAgent = new List <Education_Agent>();
             //listUserPaged = await LoadTaskDatagridAgent(1, listUserPaged.TotalItemCount);
             List <MyColumnCollectionDGAgent> listgrpAgent = ((List <MyColumnCollectionDGAgent>)dgGrpAgent.DataSource).Cast <MyColumnCollectionDGAgent>().ToList();
             foreach (var item in listgrpAgent)
             {
                 listAgent.Add(item.GetModel());
             }
             listAgentFiltered     = AgentDataAccess.LoadAgentsFiltered(_filterString, listAgent);
             dgGrpAgent.DataSource = GetDataSource(listAgentFiltered);
         }
     }
 }
コード例 #2
0
        public async void TriggerFilterStringChanged(Zuby.ADGV.AdvancedDataGridView.FilterEventArgs e)
        {
            //call event handler if one is attached
            FilterEventArgs filterEventArgs = new FilterEventArgs
            {
                FilterString = _filterString,
                Cancel       = false
            };


            if (FilterStringChanged != null)
            {
                FilterStringChanged.Invoke(this, filterEventArgs);
            }
            //sort datasource
            if (filterEventArgs.Cancel == false)
            {
                if (listAgentFiltered == null)
                {
                    listAgentFiltered = MainWindow.globalListCertificateAgents;
                }
                else
                {
                }
                if (dtAgentsCertificate == null)
                {
                    dtAgentsCertificate = ToDataTable <Education_Agent>(listAgentFiltered);
                }

                if (_filterString == "")
                {
                    LoadDatagridAgentAsync();
                }
                else
                {
                    BindingSource bindingSource = new BindingSource()
                    {
                        //DataMember = dtAgentsCertificate.TableName,
                        DataSource = dtAgentsCertificate
                    };
                    bindingSource.Filter            = _filterString;
                    AdvDg_Certifications.DataSource = bindingSource;

                    //AdvDg_Certifications.DataSource = GetDataSource((IPagedList<Education_Agent>) bindingSource.List);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Trigger the filter string changed method
        /// </summary>
        public void TriggerFilterStringChanged()
        {
            //call event handler if one is attached
            FilterEventArgs filterEventArgs = new FilterEventArgs
            {
                FilterString = _filterString,
                Cancel       = false
            };

            //invoke FilterStringChanged
            if (_filterStringChangedInvokeBeforeDatasourceUpdate)
            {
                if (FilterStringChanged != null)
                {
                    FilterStringChanged.Invoke(this, filterEventArgs);
                }
            }
            //filter datasource
            if (filterEventArgs.Cancel == false)
            {
                if (this.DataSource is BindingSource bindingsource)
                {
                    bindingsource.Filter = filterEventArgs.FilterString;
                }
                else if (this.DataSource is DataView dataview)
                {
                    dataview.RowFilter = filterEventArgs.FilterString;
                }
                else if (this.DataSource is DataTable datatable)
                {
                    if (datatable.DefaultView != null)
                    {
                        datatable.DefaultView.RowFilter = filterEventArgs.FilterString;
                    }
                }
            }
            //invoke FilterStringChanged
            if (!_filterStringChangedInvokeBeforeDatasourceUpdate)
            {
                if (FilterStringChanged != null)
                {
                    FilterStringChanged.Invoke(this, filterEventArgs);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Trigger the filter string changed method
        /// </summary>
        public void TriggerFilterStringChanged()
        {
            //call event handler if one is attached
            FilterEventArgs filterEventArgs = new FilterEventArgs
            {
                FilterString = _filterString,
                Cancel       = false
            };

            FilterStringChanged?.Invoke(this, filterEventArgs);
            //sort datasource
            if (filterEventArgs.Cancel == false)
            {
                if (this.DataSource is BindingSource datasource)
                {
                    datasource.Filter = filterEventArgs.FilterString;
                }
            }
        }