public void DeleteMethodOK() { //create an instance of the class we want to create clsProductCollection AllProducts = new clsProductCollection(); //create the item of test data clsProduct TestItem = new clsProduct(); Int32 PrimaryKey = 0; //set its properties TestItem.ProductNo = 1; TestItem.ProductName = "Samsung"; TestItem.Description = "Black"; TestItem.Price = 1299; TestItem.Active = true; //set ThisProduct to test the data AllProducts.ThisProduct = TestItem; //add the record PrimaryKey = AllProducts.Add(); TestItem.ProductNo = PrimaryKey; //find the record AllProducts.ThisProduct.Find(PrimaryKey); //delete the record AllProducts.Delete(); //now find the record Boolean Found = AllProducts.ThisProduct.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void DeleteMethodOK() { clsProductCollection AllProducts = new clsProductCollection(); clsProduct TestItem = new clsProduct(); Int32 PrimaryKey = 0; TestItem.Product_ID = 1; TestItem.Name = "Dave"; TestItem.Type = "Dave"; TestItem.Colour = "Dave"; TestItem.Cost = 1; TestItem.Stock_Count = 1; TestItem.Is_Available = true; TestItem.Next_Delivery = DateTime.Now.Date; AllProducts.ThisProduct = TestItem; PrimaryKey = AllProducts.Add(); TestItem.Product_ID = PrimaryKey; AllProducts.ThisProduct.Find(PrimaryKey); AllProducts.Delete(); Boolean Found = AllProducts.ThisProduct.Find(PrimaryKey); Assert.IsFalse(Found); }
protected void BtnYes_Click(object sender, EventArgs e) { clsProductCollection ProductList = new clsProductCollection(); ProductList.ThisProduct.Find(ProductId); ProductList.Delete(); Response.Redirect("ProductList"); }
protected void btnConfirm_Click(object sender, EventArgs e) { clsProductCollection ProductBook = new clsProductCollection(); ProductBook.ThisProduct.Find(ProductNo); ProductBook.Delete(); Response.Redirect("ProductList.aspx"); }
void DeleteProduct() { clsProductCollection ProductCollect = new clsProductCollection(); //find the record to delete ProductCollect.ThisProduct.Find(ProductNo); //delete the record ProductCollect.Delete(); }
protected void btnYes_Click(object sender, EventArgs e) { //CREATE A NEW INSTANCE OF THE PRODUCT LIST clsProductCollection ProductList = new clsProductCollection(); //find the record to delete ProductList.ThisProduct.Find(Product_ID); //delete the record ProductList.Delete(); //redirect back to the main page Response.Redirect("ProductList.aspx"); }
public void DeleteMethodOK() { clsProductCollection Products = new clsProductCollection(); clsProduct TestProduct = new clsProduct(); Int32 PrimaryKey = 0; TestProduct.ProductName = "Metal Gear Ray Figure"; TestProduct.ProductDescription = "A die-cast figurine of Metal Gear Ray from Metal Gear Solid 2."; TestProduct.UnitPrice = 90.00; TestProduct.InStock = true; TestProduct.StockAmount = 1; TestProduct.DiscountPercentage = 0; TestProduct.DiscountActive = false; Products.ThisProduct = TestProduct; PrimaryKey = Products.Add(); TestProduct.ProductNo = PrimaryKey; Products.ThisProduct.Find(PrimaryKey); Products.Delete(); Boolean Found = Products.ThisProduct.Find(PrimaryKey); }
public void DeleteMethodOK() { clsProductCollection AllProducts = new clsProductCollection(); clsProduct TestProduct = new clsProduct(); Int32 PrimaryKey = 0; TestProduct.Product_ID = 000007; TestProduct.Title = "Test"; TestProduct.Description = "Testing"; TestProduct.Unit_Price = Convert.ToDouble("50.00"); TestProduct.Release_Date = Convert.ToDateTime("12/08/1991"); TestProduct.Genre = "Horror"; TestProduct.Platform = "Sega Megadrive"; AllProducts.ThisProduct = TestProduct; PrimaryKey = AllProducts.Add(); TestProduct.Product_ID = PrimaryKey; AllProducts.ThisProduct.Find(PrimaryKey); AllProducts.Delete(); Boolean Found = AllProducts.ThisProduct.Find(PrimaryKey); Assert.IsFalse(Found); }