示例#1
0
        private void gCadastro_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (gCadastro.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.NotSortable)
            {
                return;
            }
            if (BS_CMI.Count < 1)
            {
                return;
            }
            PropertyDescriptorCollection lP = TypeDescriptor.GetProperties(new TRegistro_CadCMI());
            TList_CadCMI lComparer;
            SortOrder    direcao = SortOrder.None;

            if ((gCadastro.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.None) ||
                (gCadastro.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.Descending))
            {
                lComparer = new TList_CadCMI(lP.Find(gCadastro.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Ascending);
                foreach (DataGridViewColumn c in gCadastro.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = SortOrder.None;
                }
                direcao = SortOrder.Ascending;
            }
            else
            {
                lComparer = new TList_CadCMI(lP.Find(gCadastro.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Descending);
                foreach (DataGridViewColumn c in gCadastro.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = SortOrder.None;
                }
                direcao = SortOrder.Descending;
            }
            (BS_CMI.List as TList_CadCMI).Sort(lComparer);
            BS_CMI.ResetBindings(false);
            gCadastro.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = direcao;
        }
示例#2
0
        public override int buscarRegistros()
        {
            TList_CadCMI lista = TCN_CadCMI.Busca(CD_CMI.Text.Trim(),
                                                  DS_CMI.Text.Trim(),
                                                  (tp_movimento.SelectedValue != null ? tp_movimento.SelectedValue.ToString() : string.Empty),
                                                  Tp_Docto.Text.Trim(),
                                                  TP_Duplicata.Text.Trim(),
                                                  CD_CondPGTO.Text.Trim(),
                                                  false,
                                                  false,
                                                  false,
                                                  false,
                                                  false,
                                                  false,
                                                  false,
                                                  null);

            if (lista != null)
            {
                if (lista.Count > 0)
                {
                    this.Lista        = lista;
                    BS_CMI.DataSource = lista;
                }
                else
                if ((vTP_Modo == TTpModo.tm_Standby) || (vTP_Modo == TTpModo.tm_busca))
                {
                    BS_CMI.Clear();
                }
                return(lista.Count);
            }
            else
            {
                return(0);
            }
        }