public static List <PCGRAF_Product> getListFromDataTable(DataTable group)
        {
            List <PCGRAF_Product> productList = new List <PCGRAF_Product>();

            PropertyInfo[] properties = typeof(PCGRAF_Product).GetProperties();
            try
            {
                foreach (DataRow row in (InternalDataCollectionBase)group.Rows)
                {
                    PCGRAF_Product product = new PCGRAF_Product();
                    foreach (PropertyInfo propertyInfo in properties)
                    {
                        if (!string.IsNullOrEmpty(row[propertyInfo.Name.ToLower()].ToString()))
                        {
                            propertyInfo.SetValue((object)product, (object)row[propertyInfo.Name.ToLower()].ToString());
                        }
                    }
                    productList.Add(product);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(productList);
        }
        public static List <PCGRAF_Product> getProducts()
        {
            SqlConnection  connection  = new SqlConnection(SQL_CONNECTION_STRING);
            List <Product> productList = new List <Product>();
            SqlCommand     sqlCommand  = new SqlCommand(@"With prices as (select ii10.sCodigo_Articulo as scodigo_producto, i04.sDescripcion_Inventario as sdescripcion_inventario, i04.sgrupo, i04.cPrecio_Publico as P1,
                (select i10.cPrecio_Publico from IN10 as i10 where i10.sCodigo_Lista = '002' and i10.sCodigo_Articulo = ii10.sCodigo_Articulo) as P2,
                (select i10.cPrecio_Publico from IN10 as i10 where i10.sCodigo_Lista = '003' and i10.sCodigo_Articulo = ii10.sCodigo_Articulo) as P3, 
                (select i10.cPrecio_Publico from IN10 as i10 where i10.sCodigo_Lista = '004' and i10.sCodigo_Articulo = ii10.sCodigo_Articulo) as P4
                from IN10 as ii10 inner join IN04 as i04 on ii10.sCodigo_Articulo = i04.sCodigo_Producto)
                select* from prices as p group by p.scodigo_producto,p.sdescripcion_inventario,p.sGrupo, p.P1, p.P2, p.P3, p.P4", connection);

            connection.Open();
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
            DataTable     group         = new DataTable();

            group.Load((IDataReader)sqlDataReader);
            connection.Close();
            return(PCGRAF_Product.getListFromDataTable(group));
        }