public ColeccionClases usuario_sel()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "usario_sel", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();

            using (IDataReader dr = cmd.ExecuteReader())
            {
                Usuario obUs = new Usuario();
                while (dr.Read())
                {
                    if (!dr[0].Equals(DBNull.Value))
                    {
                        obUs.IdUsuario = dr.GetInt32(0);
                    }
                    if (!dr[1].Equals(DBNull.Value))
                    {
                        obUs.Usuarios = dr.GetString(1);
                    }
                    if (!dr[2].Equals(DBNull.Value))
                    {
                        obUs.IdTipo = dr.GetInt32(2);
                    }
                    obCol.Add(obUs);
                }
            }
            return(obCol);
        }
コード例 #2
0
        public ColeccionClases proveedor_sel()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "proveedor_sel", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Proveedor obPro = new Proveedor();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obPro.Idempresa = dr.GetInt32(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obPro.Empresa = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            obPro.Tipreg = dr.GetString(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            obPro.Nreg = dr.GetInt32(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            obPro.Correo = dr.GetString(4);
                        }
                        if (!dr[5].Equals(DBNull.Value))
                        {
                            obPro.Direccion = dr.GetString(5);
                        }
                        if (!dr[6].Equals(DBNull.Value))
                        {
                            obPro.Tipoprod = dr.GetString(6);
                        }
                        obCol.Add(obPro);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
        public ColeccionClases insumos_by_id(int idInsu)
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "insumo_by_id", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Parameters.Add("@idinsu", SqlDbType.Int).Value = idInsu;
            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Insumos obInsu = new Insumos();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obInsu.Fecha_reg = dr.GetDateTime(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obInsu.Insumo = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            obInsu.Tipo_cant = dr.GetString(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            obInsu.Cantidad = dr.GetInt32(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            obInsu.Descripcion = dr.GetString(4);
                        }
                        if (!dr[5].Equals(DBNull.Value))
                        {
                            obInsu.Empresa = dr.GetString(5);
                        }
                        obCol.Add(obInsu);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #4
0
        public ColeccionClases filtrado_trabajador(string texto)
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "filtrado_trab", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Parameters.Add("@texto", SqlDbType.VarChar, 100).Value = texto;
            cmd.Connection.Open();

            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Trabajador obTra = new Trabajador();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obTra.IdTrab = dr.GetInt32(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obTra.Nombres = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            obTra.Apellidos = dr.GetString(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            obTra.Nidentidad = dr.GetInt32(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            obTra.Rutaimage = dr.GetString(4);
                        }

                        obCol.Add(obTra);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #5
0
        public ColeccionClases ventas_sel()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "ventas_sel", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Venta v = new Venta();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            v.Id_venta = dr.GetString(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            v.Cliente = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            v.Fecha_emision = dr.GetDateTime(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            v.Met_pago = dr.GetString(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            v.Total = dr.GetDecimal(4);
                        }
                        obCol.Add(v);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
        public ColeccionClases insumos_sel()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "insumos_sel", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Insumos obIns = new Insumos();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obIns.IdInsumo = dr.GetInt32(0);
                        }
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obIns.Fecha_reg = dr.GetDateTime(1);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obIns.Insumo = dr.GetString(2);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            obIns.Cantidad = dr.GetInt32(3);
                        }
                        obCol.Add(obIns);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #7
0
        public ColeccionClases productos_sel()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "productos_sel", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Productos p = new Productos();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            p.IdProd = dr.GetInt32(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            p.Descripcion = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            p.Precio = dr.GetDecimal(2);
                        }
                        obCol.Add(p);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #8
0
        public ColeccionClases trabajador_Get()
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "trab_get", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Connection.Open();

            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Trabajador obTra = new Trabajador();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obTra.Nidentidad = dr.GetInt32(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obTra.Nombres = dr.GetString(1);
                        }
                        obCol.Add(obTra);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #9
0
        public ColeccionClases trabajador_sel_by_idtra(int idTra)
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "trabajador_sel_by_id", CommandType = System.Data.CommandType.StoredProcedure, Connection = cn
            };

            cmd.Parameters.Add("@idtra", SqlDbType.Int).Value = idTra;
            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Trabajador obTra = new Trabajador();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            obTra.Nombres = dr.GetString(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            obTra.Apellidos = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            obTra.Correo = dr.GetString(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            obTra.Puesto = dr.GetString(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            obTra.Modalidad = dr.GetString(4);
                        }
                        if (!dr[5].Equals(DBNull.Value))
                        {
                            obTra.Tipodoc = dr.GetString(5);
                        }
                        if (!dr[6].Equals(DBNull.Value))
                        {
                            obTra.Nidentidad = dr.GetInt32(6);
                        }
                        if (!dr[7].Equals(DBNull.Value))
                        {
                            obTra.Edad = dr.GetInt32(7);
                        }
                        if (!dr[8].Equals(DBNull.Value))
                        {
                            obTra.Rutaimage = dr.GetString(8);
                        }
                        obCol.Add(obTra);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }
コード例 #10
0
        public ColeccionClases vent_sel_intervalo(DateTime fecha_ini, DateTime fecha_fin)
        {
            SqlConnection   cn    = new SqlConnection(new Conexion().cadenaConexion());
            ColeccionClases obCol = new ColeccionClases();
            SqlCommand      cmd   = new SqlCommand()
            {
                CommandText = "vent_sel_intervalo", CommandType = System.Data.CommandType.StoredProcedure
            };

            cmd.Parameters.Add("@fecha_ini", SqlDbType.Date).Value = fecha_ini;
            cmd.Parameters.Add("@fecha_fin", SqlDbType.Date).Value = fecha_fin;
            cmd.Connection.Open();
            try
            {
                using (IDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Venta v = new Venta();
                        if (!dr[0].Equals(DBNull.Value))
                        {
                            v.Id_venta = dr.GetString(0);
                        }
                        if (!dr[1].Equals(DBNull.Value))
                        {
                            v.Cliente = dr.GetString(1);
                        }
                        if (!dr[2].Equals(DBNull.Value))
                        {
                            v.Met_pago = dr.GetString(2);
                        }
                        if (!dr[3].Equals(DBNull.Value))
                        {
                            v.Vendedor = dr.GetString(3);
                        }
                        if (!dr[4].Equals(DBNull.Value))
                        {
                            v.Vale = dr.GetString(4);
                        }
                        if (!dr[5].Equals(DBNull.Value))
                        {
                            v.Total = dr.GetDecimal(5);
                        }
                        if (!dr[6].Equals(DBNull.Value))
                        {
                            v.Fecha_emision = dr.GetDateTime(6);
                        }
                        if (!dr[7].Equals(DBNull.Value))
                        {
                            v.Estado = dr.GetString(7);
                        }
                        obCol.Add(v);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cmd.Connection.Close();
                cmd.Dispose();
            }
            return(obCol);
        }