/// <summary> /// event handler to load the product info form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SavedOrderButton_Click(object sender, EventArgs e) { this.Hide(); ProductInfoForm ProductInfoForm = new ProductInfoForm(); ProductInfoForm.previousForm = new SelectForm(); ProductInfoForm.Show(); }
/// <summary> /// event handler that sets program wide variable to the selected product when moving to other forms /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NextButton_Click(object sender, EventArgs e) { Program.selectedProduct = new product(); foreach (var property in Program.selectedProduct.GetType().GetProperties()) { if (property.Name.Equals("productID")) { property.SetValue(Program.selectedProduct, Int32.Parse(SelectDataGridView.CurrentRow.Cells[property.Name + "Column"].Value.ToString())); } else if (property.Name.Equals("cost")) { property.SetValue(Program.selectedProduct, Decimal.Parse(SelectDataGridView.CurrentRow.Cells[property.Name + "Column"].Value.ToString())); } else { property.SetValue(Program.selectedProduct, SelectDataGridView.CurrentRow.Cells[property.Name + "Column"].Value.ToString()); } } this.Hide(); ProductInfoForm ProductInfoForm = new ProductInfoForm(); ProductInfoForm.previousForm = this; ProductInfoForm.Show(); }