private void ObtenerInformacionActividad() { if (Pro_Conexion.State != ConnectionState.Open) { Pro_Conexion.Open(); } string sentencia = @"SELECT * FROM arca_tesoros.ft_view_datos_actividades ( :p_id_actividad )"; PgSqlCommand pgComando = new PgSqlCommand(sentencia, Pro_Conexion); pgComando.Parameters.Add("p_id_actividad", PgSqlType.Int).Value = Pro_ID_Actividad; try { PgSqlDataReader pgDr = pgComando.ExecuteReader(); if (pgDr.Read()) { lblEncabezado.Text = "Lista de Asistencia para el día " + pgDr.GetDateTime("fecha").Date.ToShortDateString(); } pgDr.Close(); } catch (Exception Exc) { Log_Excepciones.CapturadorExcepciones(Exc, this.Name, "ObtenerInformacionActividad"); } }
public static DateTime ObtenerHoraServidor(PgSqlConnection pConexion) { DateTime v_resultado = Convert.ToDateTime(null); if (pConexion.State != System.Data.ConnectionState.Open) { pConexion.Open(); } string sentencia = "SELECT * FROM arca_tesoros_conf.ft_view_variables_tiempo();"; PgSqlCommand pgComando = new PgSqlCommand(sentencia, pConexion); try { PgSqlDataReader pgDr = pgComando.ExecuteReader(); if (pgDr.Read()) { v_resultado = pgDr.GetDateTime("fecha_hora_servidor"); } pgDr.Close(); sentencia = null; pgComando.Dispose(); pgComando = null; return(v_resultado); } catch (Exception Exc) { Log_Excepciones.CapturadorExcepciones(Exc, "Utilidades.cs", "ObtenerHoraServidor"); return(Convert.ToDateTime(null)); } }
public List <Estatus> Estatus(DateTime fecha1, DateTime fecha2) { fecha1 = Convert.ToDateTime(fecha1.ToShortDateString()); fecha2 = Convert.ToDateTime(fecha2.ToShortDateString()); fecha1 = Convert.ToDateTime(fecha1); fecha2 = Convert.ToDateTime(fecha2); List <Estatus> lista = new List <Estatus>(); using (PgSqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = " select*from Modifica"; using (PgSqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read() == true) { DateTime fechaRegistro = dr.GetDateTime("fecha"); if ((fechaRegistro >= fecha1) && (fechaRegistro <= fecha2)) { lista.Add(new Estatus(dr.GetDecimal("modificaciones"), dr.GetString("tipo"), dr.GetDateTime("fecha"))); } } dr.Close(); } } return(lista); }
public List <Ventas> ObtenerListaVENTASDelDía() { List <Ventas> listpro = new List <Ventas>(); DateTime fechaActual = DateTime.Today; using (PgSqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = " SELECT * FROM ventas ORDER BY id"; ///select *FROM ventas WHERE fecha_venta= '2015/12/12' using (PgSqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read() == true) { DateTime fechaDeVenta = dr.GetDateTime("fecha_venta"); if (fechaDeVenta == fechaActual) { listpro.Add(new Ventas(dr.GetInt32("id_productos"), dr.GetInt32("cantidad"), dr.GetDecimal("precio_de_venta"), dr.GetDateTime("fecha_venta"))); } } dr.Close(); } } return(listpro); }
public List <Estatus> Estatus() { List <Estatus> lista = new List <Estatus>(); using (PgSqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = " select*from Modifica"; using (PgSqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read() == true) { lista.Add(new Estatus(dr.GetDecimal("modificaciones"), dr.GetString("tipo"), dr.GetDateTime("fecha"))); } dr.Close(); } } return(lista); }