private void buttonUpdateBook_Click(object sender, EventArgs e) { List <Inventory> listI = InventoryDA.ListInventory(); if (IsValidInventoryData()) { Inventory aProducts = new Inventory(); aProducts.ISBNProduct = Convert.ToInt32(textBoxISBN.Text); aProducts.ProductTitle = textBoxBookTitle.Text; aProducts.ProductDescription = comboboxProductDescription.Text; aProducts.AuthorID = Convert.ToInt32(comboBoxAuthorId.Text); aProducts.PublisherName = comboBoxPublisherName.Text; aProducts.ProductYearPublished = Convert.ToInt32(textBoxYearPushlished.Text); aProducts.ProductQuantity = Convert.ToInt32(textBoxQuantityOnHand.Text); aProducts.ProductPrice = Convert.ToDouble(textBoxBookPrice.Text); DialogResult ans = MessageBox.Show("Do you really want to update this Books?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (ans == DialogResult.Yes) { InventoryDA.Update(aProducts); MessageBox.Show("Product record has been updated successfully", "Confirmation"); ClearAll(); textBoxISBN.Enabled = true; } } }
private void buttonSaveBook_Click(object sender, EventArgs e) { List <Inventory> listI = InventoryDA.ListInventory(); if (IsValidInventoryData()) { if (!Validation.IsUniqueISBN(listI, Convert.ToInt32(textBoxISBN.Text))) { MessageBox.Show("Duplicate", "DUPLICATE Author ID"); textBoxISBN.Clear(); textBoxISBN.Focus(); return; } Inventory aProducts = new Inventory(); aProducts.ISBNProduct = Convert.ToInt32(textBoxISBN.Text); aProducts.ProductTitle = textBoxBookTitle.Text; aProducts.ProductDescription = comboboxProductDescription.Text; aProducts.LastName = comboBoxAuthorId.Text; aProducts.PublisherName = comboBoxPublisherName.Text; aProducts.ProductYearPublished = Convert.ToInt32(textBoxYearPushlished.Text); aProducts.ProductQuantity = Convert.ToInt32(textBoxQuantityOnHand.Text); aProducts.ProductPrice = Convert.ToDouble(textBoxBookPrice.Text); InventoryDA.Save(aProducts); listB.Add(aProducts); buttonListBook.Enabled = true; ClearAll(); } }
private void buttonListBook_Click(object sender, EventArgs e) { listViewInventory.Items.Clear(); InventoryDA.ListInventory(listViewInventory); }