public void InitRestrictions(CListeRestrictionsUtilisateurSurType listeRestrictions)
 {
     if (listeRestrictions != null)
     {
         m_listeRestrictions = listeRestrictions.Clone() as CListeRestrictionsUtilisateurSurType;
     }
     else
     {
         m_listeRestrictions = null;
     }
     if (m_grid != null)
     {
         foreach (DataGridViewColumn col in m_grid.Columns)
         {
             CDataGridViewCustomCellFor2iWnd tpl = col.CellTemplate as CDataGridViewCustomCellFor2iWnd;
             if (tpl != null)
             {
                 tpl.InitRestrictions(listeRestrictions);
             }
         }
     }
 }
        private void Filtrer()
        {
            List <object> lst = m_listeObjetsOriginale;

            if (lst == null)
            {
                return;
            }
            using (CWaitCursor waiter = new CWaitCursor())
            {
                bool bCancel = false;
                foreach (KeyValuePair <int, CGridFilterForWndDataGrid> kv in m_dicFiltre)
                {
                    if (kv.Value != null)
                    {
                        CGridFilterForWndDataGrid filter = kv.Value;
                        C2iWndDataGridColumn      col    = m_wndGrid.GetColumn(kv.Key);
                        IWndIncluableDansDataGrid ctrl   = col.Control as IWndIncluableDansDataGrid;
                        if (ctrl != null)
                        {
                            List <object> lst2 = new List <object>();
                            foreach (object obj in lst)
                            {
                                int nVal = (int)Keys.Escape;

                                nVal = GetKeyState((int)Keys.Escape);
                                if (nVal < 0)
                                {
                                    bCancel = true;
                                    break;
                                }
                                CCoupleValeurEtValeurDisplay dataVal = m_cache.GetValeur(obj, kv.Key, col.MultiThread);
                                if (dataVal != null && filter.IsValueIn(dataVal.ObjectValue))
                                {
                                    lst2.Add(obj);
                                }
                            }
                            lst = lst2;
                        }
                    }
                    if (bCancel)
                    {
                        break;
                    }
                }
                if (bCancel)
                {
                    lst = m_listeObjetsOriginale;
                    MessageBox.Show(I.T("Filter has been canceled|20019"));
                }
            }
            if (m_nColumnSort != null)
            {
                try
                {
                    lst.Sort(new CGridSorter(m_nColumnSort.Value, m_bSortAsc, m_cache));
                }
                catch { }
            }
            m_grid.DataSource = lst;
            foreach (DataGridViewColumn col in m_grid.Columns)
            {
                CDataGridViewCustomCellFor2iWnd cell = col.CellTemplate as CDataGridViewCustomCellFor2iWnd;
            }
        }