private void ProductChange(object obj)
        {
            Product product = (Product)obj;

            int index = ListProduct.IndexOf(product);

            if (index != -1)
            {
                ListProduct.RemoveAt(index);
                ListProduct.Insert(index, product);
            }
            else
            {
                ListProduct.Add(product);
            }
        }
Пример #2
0
        public BindableCollection <Product> Get_AllProduct()
        {
            ListProduct.Clear();
            sql = $"SELECT CATE.CATEGORYNAME,P.* FROM PRODUCT AS P JOIN CATEGORY AS CATE ON P.IDCATEGORY=CATE.IDCATEGORY WHERE P.STATUS=0";
            DataTable dt = Connection.GetALL_Data(sql);

            foreach (DataRow row in dt.Rows)
            {
                Product product = new Product();
                product.CategoryName = row["CATEGORYNAME"].ToString();
                product.IdProduct    = row["IDPRODUCT"].ToString();
                product.ProductName  = row["PRODUCTNAME"].ToString();
                product.Price        = row["PRICE"].ToString();
                product.Description  = row["DESCRIPTION"].ToString();
                product.Image        = row["IMAGE"].ToString();
                ListProduct.Add(product);
            }
            return(ListProduct);
        }
Пример #3
0
        private BindableCollection <Product> Get_ProductInCategory(string id, int curr, int record1page)
        {
            ListProduct.Clear();
            sql = $"SELECT CATE.CATEGORYNAME,P.* FROM PRODUCT AS P JOIN CATEGORY AS CATE ON P.IDCATEGORY=CATE.IDCATEGORY WHERE CATE.IDCATEGORY={id} AND P.STATUS=0 ORDER BY IDPRODUCT OFFSET  { curr}  ROWS FETCH NEXT  { record1page} ROWS ONLY";
            DataTable dt = Connection.GetALL_Data(sql);

            foreach (DataRow row in dt.Rows)
            {
                Product product = new Product();
                product.CategoryName = row["CATEGORYNAME"].ToString();
                product.IdProduct    = row["IDPRODUCT"].ToString();
                product.ProductName  = row["PRODUCTNAME"].ToString();
                product.Price        = row["PRICE"].ToString();
                product.Description  = row["DESCRIPTION"].ToString();
                product.Image        = row["IMAGE"].ToString();
                ListProduct.Add(product);
            }
            return(ListProduct);
        }