Пример #1
0
        public ArrayList getAllProducts()
        {
            ArrayList arrProducts = null;
            ProductData oProductData = null;
            try
            {
                arrProducts = new ArrayList();
                oProductData = new ProductData();

                DataSet dsProducts = oProductData.getAllProducts();
                if (dsProducts.Tables.Count > 0 && dsProducts.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in dsProducts.Tables[0].Rows)
                    {
                        ProductBiz oProductBiz = new ProductBiz();

                        oProductBiz.ProductName = dr["productname"].ToString();
                        oProductBiz.ProductId = Convert.ToInt32(dr["productid"].ToString());
                        oProductBiz.ProductCode = dr["pcode"].ToString();

                        oProductBiz.Price = Convert.ToDecimal(dr["price"].ToString());
                        oProductBiz.StatusName = dr["isactive"].ToString();
                        arrProducts.Add(oProductBiz);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return arrProducts;
        }