Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public decimal getNumero()
        {
            decimal total = 0;

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = "select *from Numero";

                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        total = (dr.GetDecimal("numero"));
                    }
                }
            }
            return(total);
        }
Ejemplo n.º 3
0
        public decimal VerTotal()
        {
            decimal total = 0;

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = "select *from Caja WHERE id=1;";
                //SELECT *FROM productos WHERE codigo = '123456'

                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        total = (dr.GetDecimal("total"));
                    }
                }
            }
            return(total);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public bool Existencia(int id)
        {
            bool ex = false;

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = "select *from inventario WHERE id=" + id + "";
                //SELECT *FROM productos WHERE codigo = '123456'

                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        if ((dr.GetDecimal("existencias") >= 1))
                        {
                            ex = true;
                        }
                    }
                }
            }
            return(ex);
        }
        public bool GetDecimal(string query, string field, out decimal value)
        {
            bool found = false;

            value = 0;

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = query;

                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    if (dr.Read() == true)
                    {
                        value = dr.GetDecimal(field);
                        found = true;
                    }

                    dr.Close();
                }
            }

            return(found);
        }
Ejemplo n.º 7
0
        public Producto ObtenerProductoNombre(string Nombre)
        {
            Producto pro = new Producto();

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = " select *FROM productos WHERE descripcion='" + Nombre + "'";
                ///select *FROM ventas WHERE fecha_venta= '2015/12/12'

                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        pro = new Producto(dr.GetInt32("id"), dr.GetString("codigo"), dr.GetString("descripcion"), dr.GetDecimal("precio"));
                    }

                    dr.Close();
                }
                return(pro);
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        public Producto ObtenerProductoPorCodigo_barras(string CodigoDeBarra)
        {
            Producto pro = new Producto();

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = " SELECT * FROM productos WHERE codigo = '" + CodigoDeBarra + "'";
                //SELECT *FROM productos WHERE codigo = '123456'


                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        pro = (new Producto(dr.GetInt32("id"), dr.GetString("codigo"), dr.GetString("descripcion"), dr.GetDecimal("precio")));
                    }
                }
            }
            return(pro);
        }
Ejemplo n.º 10
0
        public List <Producto> ObtenerTodosLosProductos()
        {
            List <Producto> pro = new List <Producto>();

            using (PgSqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = " SELECT * FROM productos";
                //SELECT *FROM productos WHERE codigo = '123456'
                using (PgSqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read() == true)
                    {
                        pro.Add(new Producto(dr.GetInt32("id"), dr.GetString("codigo"), dr.GetString("descripcion"), dr.GetDecimal("precio")));
                    }
                }
            }

            return(pro);
        }