private void saveBtn_Click(object sender, EventArgs e) { if (currentProduct != null) { currentProduct.Name = nameBox.Text; currentProduct.Brand = brandBox.Text; if (packagedBtn.Checked) { currentProduct.StokType = "Packaged"; } else { currentProduct.StokType = "Unpackaged"; } currentProduct.Item_Price = Convert.ToDouble(priceBox.Text); currentProduct.Stock_Amount = Convert.ToDouble(stockAmountBox.Text); ExcelCRUD.UpdateData(comboBox1.Text, currentProduct); MessageBox.Show(currentProduct.Name + " succesfully updated."); } else { Products pro = new Products(); pro.Name = nameBox.Text; pro.Brand = brandBox.Text; if (packagedBtn.Checked) { pro.StokType = "Packaged"; } else { pro.StokType = "Unpackaged"; } pro.Item_Price = Convert.ToDouble(priceBox.Text); pro.Stock_Amount = Convert.ToDouble(stockAmountBox.Text); pro.ID = 6; //TODO: combo box dairies not working ExcelCRUD.InsertDataToExcel(comboBox1.Text, pro); MessageBox.Show(pro.Name + " succesfully added."); } }
private void snackBtn_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Snack Food"); }
private void meatBtn_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Meat Products"); }
private void dairyBtn_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Dairies and Cereal"); }
private void coffeeBtn_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Dried Fruits and Coffee"); }
private void vegetableBtn_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Vegetables"); }
private void button1_Click(object sender, EventArgs e) { ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Fruits"); }