public List <CENVPrecio> Obtener_VPrecios()
        {
            //Listar Precios (Vista)
            List <CENVPrecio> l_VPrecios = new List <CENVPrecio>();
            CENVPrecio        cen_VPrecios;
            SqlDataReader     dr;                        //Data reader
            CADConexion       CadCx = new CADConexion(); // Conexión

            //SqlParameter parametro;

            try
            {
                string l_sql = "pa_listar_precios_x_productos";
                using (Connection = new SqlConnection(CadCx.CxSQL()))
                {
                    Connection.Open();
                    SqlCommand cmd = new SqlCommand(l_sql, Connection);
                    cmd.CommandTimeout = CENConstante.g_const_0;
                    cmd.CommandType    = System.Data.CommandType.StoredProcedure;

                    //parametro = new SqlParameter();
                    cmd.Parameters.AddWithValue("@codProveedor", 0);
                    cmd.Parameters.AddWithValue("@codFabricante", 0);
                    cmd.Parameters.AddWithValue("@codCategoria", 0);
                    cmd.Parameters.AddWithValue("@codSubcategoria", 0);
                    cmd.Parameters.AddWithValue("@descripcion", "");

                    dr = cmd.ExecuteReader();

                    while (dr.Read())
                    {
                        cen_VPrecios = new CENVPrecio();
                        cen_VPrecios.CodProveedor     = Int32.Parse((dr["codProveedor"]).ToString());
                        cen_VPrecios.DescProveedor    = dr["descProveedor"].ToString();
                        cen_VPrecios.CodFabricante    = Int32.Parse(dr["codFabricante"].ToString());
                        cen_VPrecios.DescFabricante   = dr["descFabricante"].ToString();
                        cen_VPrecios.CodCategoria     = Int32.Parse(dr["codCategoria"].ToString());
                        cen_VPrecios.DescCategoria    = dr["descCategoria"].ToString();
                        cen_VPrecios.CodSubcategoria  = Int32.Parse(dr["codSubcategoria"].ToString());
                        cen_VPrecios.DescSubcategoria = dr["descSubcategoria"].ToString();
                        cen_VPrecios.CodProducto      = dr["codProducto"].ToString();
                        cen_VPrecios.DescProducto     = dr["descProducto"].ToString();
                        cen_VPrecios.PrecioCosto      = Convert.ToDecimal(dr["precioCosto"].ToString());

                        l_VPrecios.Add(cen_VPrecios);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.StackTrace.ToString();
            }

            return(l_VPrecios);
        }
        public List <CENVPrecio> BuscarProducto(int codProveedor, int codFabricante, int codCategoria, int codSubcategoria, string producto)
        {
            //DESCRIPCION: Buscar Producto por Codgio y Descripcion
            List <CENVPrecio> l_VPrecios = new List <CENVPrecio>();
            CADConexion       CadCx      = new CADConexion(); // Conexión
            CENVPrecio        CENVPrecios;
            SqlDataReader     dr;                             //Data reader

            try
            {
                string l_sql = "pa_listar_precios_x_productos";
                using (Connection = new SqlConnection(CadCx.CxSQL()))
                {
                    Connection.Open();
                    SqlCommand cmd = new SqlCommand(l_sql, Connection);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@codProveedor", codProveedor);
                    cmd.Parameters.AddWithValue("@codFabricante", codFabricante);
                    cmd.Parameters.AddWithValue("@codCategoria", codCategoria);
                    cmd.Parameters.AddWithValue("@codSubcategoria", codSubcategoria);
                    cmd.Parameters.AddWithValue("@descripcion", producto);

                    dr = cmd.ExecuteReader();

                    while (dr.Read())
                    {
                        CENVPrecios = new CENVPrecio();
                        CENVPrecios.CodProveedor     = Int32.Parse((dr["codProveedor"]).ToString());
                        CENVPrecios.DescProveedor    = dr["descProveedor"].ToString();
                        CENVPrecios.CodFabricante    = Int32.Parse(dr["codFabricante"].ToString());
                        CENVPrecios.DescFabricante   = dr["descFabricante"].ToString();
                        CENVPrecios.CodCategoria     = Int32.Parse(dr["codCategoria"].ToString());
                        CENVPrecios.DescCategoria    = dr["descCategoria"].ToString();
                        CENVPrecios.CodSubcategoria  = Int32.Parse(dr["codSubcategoria"].ToString());
                        CENVPrecios.DescSubcategoria = dr["descSubcategoria"].ToString();
                        CENVPrecios.CodProducto      = dr["codProducto"].ToString();
                        CENVPrecios.DescProducto     = dr["descProducto"].ToString();
                        CENVPrecios.PrecioCosto      = Convert.ToDecimal(dr["precioCosto"].ToString());

                        l_VPrecios.Add(CENVPrecios);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.StackTrace.ToString();
            }

            return(l_VPrecios);
        }