public override void BtnDelete_Click(object sender, EventArgs e) { if (edit == 1) { DialogResult dr = MessageBox.Show("Are you sure, You want to Delete record?", "Question...", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Deletion d = new Deletion(); d.delete(proID, "st_deleteProduct", "@proID"); r.showProducts(dataGridView1, proIDGV, proNameGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV); } } MainClass.enable_reset(LeftPanel); }
public override void addBTN_Click(object sender, EventArgs e) { MainClass.enable_reset(leftPanel); edit = 0; }
public override void BtnAdd_Click(object sender, EventArgs e) { MainClass.enable_reset(LeftPanel); nameTxt.Focus(); edit = 0; }
public override void BtnSave_Click(object sender, EventArgs e) { //validation for Users form if (proNameTxt.Text == string.Empty) { proNameErrorLabel.Visible = true; } else { proNameErrorLabel.Visible = false; } if (barCodeTxt.Text == string.Empty) { BarcodeErrorLabel.Visible = true; } else { BarcodeErrorLabel.Visible = false; } if (ExpiryPicker.Value < DateTime.Now) { ExpiryErrorLabel.Visible = true; ExpiryErrorLabel.Text = "Invalid Date"; } else { ExpiryErrorLabel.Visible = false; } if (ExpiryPicker.Value.Date == DateTime.Now.Date) { ExpiryErrorLabel.Visible = false; } if (PriceTxt.Text == string.Empty) { PriceErrorLabel.Visible = true; } else { PriceErrorLabel.Visible = false; } if (CatDD.SelectedIndex == -1 || CatDD.SelectedIndex == 0) { catErrorLabel.Visible = true; } else { catErrorLabel.Visible = false; } if (proNameErrorLabel.Visible || BarcodeErrorLabel.Visible || ExpiryErrorLabel.Visible || PriceErrorLabel.Visible || catErrorLabel.Visible) { MainClass.showMSG("Fields with * are mandatory", "Stop", "Error"); //Error is the type of message } else { if (edit == 0) // Code for SAVE Operation { Insertion i = new Insertion(); if (ExpiryPicker.Value.Date == DateTime.Now.Date) { i.insertProduct(proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue)); } else { i.insertProduct(proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue), ExpiryPicker.Value); } r.showProducts(dataGridView1, proIDGV, proNameGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV); MainClass.disable_reset(LeftPanel); } else if (edit == 1) // Code for EDIT Operation { DialogResult dr = MessageBox.Show("Are you sure, You want to Update record?", "Question...", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { Updation u = new Updation(); if (ExpiryPicker.Value.Date == DateTime.Now.Date) { u.updateProduct(proID, proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue)); } else { u.updateProduct(proID, proNameTxt.Text, barCodeTxt.Text, Convert.ToSingle(PriceTxt.Text), Convert.ToInt32(CatDD.SelectedValue), ExpiryPicker.Value); } r.showProducts(dataGridView1, proIDGV, proNameGV, barcodeGV, expiryGV, priceGV, catGV, catIDGV); MainClass.disable_reset(LeftPanel); } } } MainClass.enable_reset(LeftPanel); }
public override void addBTN_Click(object sender, EventArgs e) { MainClass.enable_reset(leftPanel); edit = 0; r.getCategoriesList("st_getCategoriesList", categoryCB, "Category", "ID"); }