示例#1
0
 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.");
     }
 }
示例#2
0
 private void snackBtn_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Snack Food");
 }
示例#3
0
 private void meatBtn_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Meat Products");
 }
示例#4
0
 private void dairyBtn_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Dairies and Cereal");
 }
示例#5
0
 private void coffeeBtn_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Dried Fruits and Coffee");
 }
示例#6
0
 private void vegetableBtn_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Vegetables");
 }
示例#7
0
 private void button1_Click(object sender, EventArgs e)
 {
     ExcelCRUD.ReadDataFromExcel(dataGridViewProducts, "Fruits");
 }