protected override void carregaConsulta() { cliente_ParcelaBLL = new Cliente_ParcelaBLL(); base.carregaConsulta(); dgvDados.DataSource = null; dgvDados.DataSource = cliente_ParcelaBLL.ToList_Cliente_ParcelaView(cliente_ParcelaBLL.getCliente_Parcela(p => p.Id.ToString(), false, deslocamento, tamanhoPagina, out totalReg)); colOrdem = 0; }
protected override void executeCellEndEditChild(object sender, DataGridViewCellEventArgs e) { base.executeCellEndEditChild(sender, e); cliente_ParcelaBLL = new Cliente_ParcelaBLL(); int id = 0; string nome = string.Empty; string descricao = string.Empty; if (!string.IsNullOrEmpty((string)dgvFiltro[col_Id, e.RowIndex].Value.ToString())) { id = Convert.ToInt32(dgvFiltro[col_Id, e.RowIndex].Value); } if (!string.IsNullOrEmpty((string)dgvFiltro[col_cliente, e.RowIndex].Value)) { nome = dgvFiltro[col_cliente, e.RowIndex].Value.ToString(); } if (!string.IsNullOrEmpty((string)dgvFiltro[col_condPagto, e.RowIndex].Value)) { descricao = dgvFiltro[col_condPagto, e.RowIndex].Value.ToString(); } Expression <Func <Cliente_Parcela, bool> > predicate = p => true; if (id > 0) { predicate = predicate = p => p.Id == id; } if (!string.IsNullOrEmpty(nome)) { predicate = predicate.And(p => p.cliente.razao_social.Contains(nome)); } if (!string.IsNullOrEmpty(descricao)) { predicate = predicate.And(p => p.descricao.Contains(descricao)); } List <Cliente_Parcela> Cliente_ParcelaList = cliente_ParcelaBLL.getCliente_Parcela(predicate.Expand(), t => t.Id.ToString(), false, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = cliente_ParcelaBLL.ToList_Cliente_ParcelaView(Cliente_ParcelaList); }
protected override void ordenaCelula(object sender, DataGridViewCellMouseEventArgs e) { base.ordenaCelula(sender, e); cliente_ParcelaBLL = new Cliente_ParcelaBLL(); DataGridViewColumn col = dgvFiltro.Columns[e.ColumnIndex]; DataGridViewColumn colAnt = dgvFiltro.Columns[colOrdem]; ListSortDirection direction; switch (col.HeaderCell.SortGlyphDirection) { case SortOrder.None: direction = ListSortDirection.Ascending; break; case SortOrder.Ascending: direction = ListSortDirection.Ascending; break; case SortOrder.Descending: direction = ListSortDirection.Descending; break; default: direction = ListSortDirection.Ascending; break; } if (colOrdem == e.ColumnIndex) { if (direction == ListSortDirection.Ascending) { direction = ListSortDirection.Descending; } else { direction = ListSortDirection.Ascending; col.HeaderCell.SortGlyphDirection = SortOrder.None; } } else { direction = ListSortDirection.Ascending; colAnt.HeaderCell.SortGlyphDirection = SortOrder.None; } switch (e.ColumnIndex) { case col_cliente: { List <Cliente_Parcela> Cliente_ParcelaList = cliente_ParcelaBLL.getCliente_Parcela(p => p.cliente.razao_social, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = cliente_ParcelaBLL.ToList_Cliente_ParcelaView(Cliente_ParcelaList); } break; case col_condPagto: { List <Cliente_Parcela> Cliente_ParcelaList = cliente_ParcelaBLL.getCliente_Parcela(p => p.descricao, direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = cliente_ParcelaBLL.ToList_Cliente_ParcelaView(Cliente_ParcelaList); } break; //O default será executado quando o index for 0 default: { List <Cliente_Parcela> Cliente_ParcelaList = cliente_ParcelaBLL.getCliente_Parcela(p => p.Id.ToString(), direction != ListSortDirection.Ascending, deslocamento, tamanhoPagina, out totalReg); dgvDados.DataSource = cliente_ParcelaBLL.ToList_Cliente_ParcelaView(Cliente_ParcelaList); } break; } colOrdem = e.ColumnIndex; col.HeaderCell.SortGlyphDirection = direction == ListSortDirection.Ascending ? SortOrder.Ascending : SortOrder.Descending; }