public override int buscarRegistros() { CamadaDados.Fiscal.TList_TpContribuicaoPisCofins lista = CamadaNegocio.Fiscal.TCN_TpContribuicaoPisCofins.Buscar(id_tpcontribuicao.Text, ds_tpcontribuicao.Text, null); if (lista != null) { if (lista.Count > 0) { this.Lista = lista; bsTpContribuicao.DataSource = lista; } else if ((vTP_Modo == Utils.TTpModo.tm_Standby) || (vTP_Modo == Utils.TTpModo.tm_busca)) { bsTpContribuicao.Clear(); } return(lista.Count); } else { return(0); } }
private void gTpContribuicao_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (gTpContribuicao.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.NotSortable) { return; } if (bsTpContribuicao.Count < 1) { return; } PropertyDescriptorCollection lP = TypeDescriptor.GetProperties(new CamadaDados.Fiscal.TRegistro_TpContribuicaoPisCofins()); CamadaDados.Fiscal.TList_TpContribuicaoPisCofins lComparer; SortOrder direcao = SortOrder.None; if ((gTpContribuicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.None) || (gTpContribuicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.Descending)) { lComparer = new CamadaDados.Fiscal.TList_TpContribuicaoPisCofins(lP.Find(gTpContribuicao.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Ascending); foreach (DataGridViewColumn c in gTpContribuicao.Columns) { c.HeaderCell.SortGlyphDirection = SortOrder.None; } direcao = SortOrder.Ascending; } else { lComparer = new CamadaDados.Fiscal.TList_TpContribuicaoPisCofins(lP.Find(gTpContribuicao.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Descending); foreach (DataGridViewColumn c in gTpContribuicao.Columns) { c.HeaderCell.SortGlyphDirection = SortOrder.None; } direcao = SortOrder.Descending; } (bsTpContribuicao.List as CamadaDados.Fiscal.TList_TpContribuicaoPisCofins).Sort(lComparer); bsTpContribuicao.ResetBindings(false); gTpContribuicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = direcao; }