private void addToPurchaseButton_Click(object sender, EventArgs e) { //If nothing selected then refresh ListView and return if (stockListView.SelectedItems.Count == 0) { RefreshListViewData(); return; } int dummyVariable = 0; //If the currently selected row doesnt have a quantity string then add to the order (via ProcessORderController) with the value in the weight textbox if (!SelectedRowHasValidQuantity(ref dummyVariable)) { //Checking that the value in the weight textbox represents a positive floating point value, before adding to the order. if ((float.TryParse(weightEntryTextbox.Text, out float weight)) && (weight > 0)) { ProcessOrderController.AddToOrder(_listSelectedIndex, weight); } else { MessageBox.Show("Please enter a valid weight value"); } }
/// <summary> /// Gets ProcessOrderController to cancel the current order before clearing the listview data and resetting it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cancelButton_Click(object sender, EventArgs e) { ProcessOrderController.CancelOrder(); RefreshListViewData(); }
private void ProcessOrderScreen_Load(object sender, EventArgs e) { ProcessOrderController.NewOrder(); RefreshListViewData(); }