Пример #1
0
 public bool DeleteProduct(string id)
 {
     try
     {
         return(_dalProduct.DeleteProduct(id) == 1 ? true : false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #2
0
        public void AddProduct1()
        {
            DTO.Warehouse.DtoProduct dto = new DTO.Warehouse.DtoProduct("SP127", "USB Tosiba", "Phụ kiện", 60, 100000.0000, 150000.0000, 20, "cái", "Hàng Trung Qu?c");
            int expected = 1;
            int actual   = product.AddProduct(dto);

            Assert.AreEqual(expected, actual);

            //delete
            product.DeleteProduct(dto.MaSanPham);
        }
        public long DeleteData()
        {
            _UserAction = 3;
            DalProduct dalProduct = new DalProduct();
            long       status;

            status = 0;
            try
            {
                status     = dalProduct.DeleteProduct(this);
                dalProduct = null;
            }
            catch (Exception ex)
            {
            }
            return(status);
        }
Пример #4
0
        private void Button7_Click(object sender, EventArgs e)
        {
            try
            {
                var productID = Convert.ToInt32(listView2.SelectedItems[0].SubItems[1].Text);

                var sorgu = DalProduct.DeleteProduct(productID);

                if (sorgu)
                {
                    GuncelleUrunler();
                    MessageBox.Show("Ürün silindi.", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Ürün seçilmedi.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public void AddProduct1()
        {
            int expected1 = product.GetListProducts().Rows.Count + 1;
            int actual1   = 0;

            DTO.Warehouse.DtoProduct dto = new DTO.Warehouse.DtoProduct("SP127", "USB Tosiba", "Phụ kiện", 60, 100000.0000, 150000.0000, 20, "cái", "Hàng Trung Qu?c");
            int expected = 1;
            int actual   = product.AddProduct(dto);

            Assert.AreEqual(expected, actual);

            actual1 = product.GetListProducts().Rows.Count;

            Assert.AreEqual(actual, expected);
            Assert.AreEqual(actual1, expected1);
            product.DeleteProduct(dto.MaSanPham);
        }