public TList_CadMotivoInativo Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo) { TList_CadMotivoInativo lista = new TList_CadMotivoInativo(); SqlDataReader reader; bool podeFecharBco = false; if (Banco_Dados == null) { this.CriarBanco_Dados(false); podeFecharBco = true; } reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo)); try { while (reader.Read()) { TRegistro_CadMotivoInativo reg = new TRegistro_CadMotivoInativo(); if (!(reader.IsDBNull(reader.GetOrdinal("ID_Motivo")))) { reg.ID_Motivo = reader.GetDecimal(reader.GetOrdinal("ID_Motivo")); } if (!(reader.IsDBNull(reader.GetOrdinal("DS_Motivo")))) { reg.DS_Motivo = reader.GetString(reader.GetOrdinal("DS_Motivo")); } lista.Add(reg); } } finally { reader.Close(); reader.Dispose(); if (podeFecharBco) { this.deletarBanco_Dados(); } } return(lista); }
public override int buscarRegistros() { TList_CadMotivoInativo lista = TCN_CadMotivoInativo.Buscar(ID_Motivo.Text, DS_Motivo.Text, 0, ""); if (lista != null) { if (lista.Count > 0) { this.Lista = lista; bsMotivoInativo.DataSource = lista; } else if ((vTP_Modo == TTpModo.tm_Standby) || ((vTP_Modo == TTpModo.tm_busca))) { bsMotivoInativo.Clear(); } return(lista.Count); } else { return(0); } }