private void panel4_Click(object sender, EventArgs e) { Form temp_form = new ScmAdd(); temp_form.Show(); this.Hide(); }
public static bool validStock(ScmAdd gui) { if (gui.missingCode) { MessageBox.Show("Please enter a product code"); return(false); } ; if (gui.missingName) { MessageBox.Show("Please enter a product name"); return(false); } ; if (gui.invalidPrice) { MessageBox.Show("Please enter a valid price"); return(false); } ; if (gui.invalidQty) { MessageBox.Show("Please enter a valid quantity"); return(false); } ; if (gui.invalidMin) { MessageBox.Show("Please enter a valid minimum quantity"); return(false); } ; if (gui.invalidMax) { MessageBox.Show("Please enter a valid maximum quantity"); return(false); } ; return(true); }
private void button1_Click(object sender, EventArgs e) { //Get event sender as button via cast Button temp_button = (Button)sender; Form temp_form; //Behaviour is determined by button name switch (temp_button.Name) { case "AddButton": //Switch to Add Stock GUI by creating a new GUI and hiding this one temp_form = new ScmAdd(); temp_form.Show(); this.Hide(); break; case "ViewButton": temp_form = new ScmView(); temp_form.Show(); this.Hide(); break; case "ReportButton": temp_form = new ScmReport(); temp_form.Show(); this.Hide(); break; } }
//Declare each possible event the mediator will handle public static void OnStockAdded(object sender, EventArgs e) { ScmAdd gui = (ScmAdd)sender; if (ScmValidate.validStock(gui)) { ScmDataAccess.addStock(gui.submission); } }