private void consulta(bool flag = false) { int contador = 0; if (!flag) { globals.lst_consulta = this.db.getBitacora(globals.rBitacoraQ); foreach (var rBitacora in globals.lst_consulta) { this.addToTable(rBitacora); ++contador; } } else { bitacoraQuery bTmp = new bitacoraQuery(null, null, null, null); globals.lst_consulta = this.db.getBitacora(bTmp); foreach (var rBitacora in this.db.getBitacora(bTmp)) { this.addToTable(rBitacora); ++contador; } } this.lblcount.Text = "Total de Registros Obtenidos: " + contador.ToString(); }
public List <bitacora> getBitacora(bitacoraQuery rbitacora) { bitacora tmp = default(bitacora); this.lstBitacora = new List <bitacora>(); if (this.connect()) { try { using (SqlCommand cmd = new SqlCommand(SQLQ.GetBitacora, this.xconn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@folio", rbitacora.folio).Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@nombre", rbitacora.nombre).Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@fecha", rbitacora.fecha).Direction = ParameterDirection.Input; cmd.Parameters.AddWithValue("@fecha2", rbitacora.fecha2).Direction = ParameterDirection.Input; using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { tmp = new bitacora(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString()); this.lstBitacora.Add(tmp); } } reader.Close(); } cmd.Dispose(); } } catch (Exception ex) { globals.show(globals.current_asp_page, ex.Message.ToString()); } finally { this.disconn(); } } return(this.lstBitacora); }