/// <summary> /// This is the Click event for the CanGoods Category. This event will set the content panel /// to display the CanUserControl. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CanGoodsPictureBox_Click(object sender, EventArgs e) { CategoryUserControl cg = new CategoryUserControl(); CanUserControl cn = new CanUserControl(); MainControlClass.ShowControl(cn, contentPanel); cg.Dispose(); }
/// <summary> /// This is the Click event for the Meat And Fish Category. This event will set the content panel /// to display the MeatUserControl. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MeatAndFishPictureBox_Click(object sender, EventArgs e) { CategoryUserControl cg = new CategoryUserControl(); MeatUserControl me = new MeatUserControl(); MainControlClass.ShowControl(me, contentPanel); cg.Dispose(); }
/// <summary> /// This is the Click event for the Produce Category. This event will set the content panel /// to display the ProduceUserControl /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProducePictureBox_Click(object sender, EventArgs e) { CategoryUserControl cg = new CategoryUserControl(); ProduceUserControl pd = new ProduceUserControl(); MainControlClass.ShowControl(pd, contentPanel); cg.Dispose(); }
/// <summary> /// This is the Click event for the Frozen Category. This event will set the content panel /// to display the FrozenUserControl /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrozenPictureBox_Click(object sender, EventArgs e) { CategoryUserControl cg = new CategoryUserControl(); FrozenUserControl fz = new FrozenUserControl(); MainControlClass.ShowControl(fz, contentPanel); cg.Dispose(); }
/// <summary> /// LoginButton click event. Check if user enterd something in the username and password text boxes then /// loads the CategoryUserControl. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoginButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(loginEmailTextBox.Text) && string.IsNullOrWhiteSpace(loginPasswordTextBox.Text)) { MessageBox.Show("Enter You Username or password."); } else { //Loading the CategoryUserControl CategoryUserControl ca = new CategoryUserControl(); MainControlClass.ShowControl(ca, contentPanel); //make user enter info userName = loginEmailTextBox.Text; } }
//========================================= /// <summary> /// MainPanelForm Initialization that adds items to the list if they are empty. /// </summary> public MainPanelForm() { InitializeComponent(); MainControlClass mainControl = new MainControlClass(); // Load items if inventoryLoaded is false if (inventoryLoaded == false) { mainControl.AddToList(RedApplesList, 10, .25m); mainControl.AddToList(LettuceList, 10, 1.00m); mainControl.AddToList(BananaList, 10, 2.25m); mainControl.AddToList(ChuckRoastList, 10, 7.00m); mainControl.AddToList(ChickenBreastList, 10, 4.50m); mainControl.AddToList(SalmonList, 10, 5.99m); mainControl.AddToList(IceCreamList, 10, 10.00m); mainControl.AddToList(ChickenDinnerList, 10, 2.25m); mainControl.AddToList(FrozenPizzaList, 10, 1.99m); mainControl.AddToList(RavioliList, 10, .50m); mainControl.AddToList(FruitCocktailList, 10, .25m); mainControl.AddToList(BeansStockList, 10, .25m); inventoryLoaded = true; // Set inventoryLoaded to true } }
/// <summary> /// Click event for a cell in the cartdatagridview. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CartDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { // If the cart has 1 item in it // Then the next click event means the cart will be empty // So change the visiability on items it the checkOut split container if (MP.ItemList.Count == 1) { emptyCartLabel.Visible = true; emptyCartPictureBox.Visible = true; totalPrintLabel.Visible = false; totalTitleLabel.Visible = false; } // CoulumnIndex 0 is the delete button column // If the delete button is clicked then // Remove the slected row // Refresh the cart // Update the sum if (cartDataGridView.CurrentCell.ColumnIndex.Equals(0)) { //get name int namePriceIndex = cartDataGridView.CurrentCell.RowIndex; string nameAdd = cartDataGridView.Rows[namePriceIndex].Cells[1].Value.ToString(); decimal priceAdd = (decimal)cartDataGridView.Rows[namePriceIndex].Cells[2].Value; //add back to stock MainControlClass.AddToList(nameAdd, priceAdd); MP.ItemList.RemoveAt(cartDataGridView.CurrentCell.RowIndex); var Source = new BindingSource(); Source.DataSource = MP.ItemList; // Sets the dataGridViews datasource to the cartDataGridView.DataSource = Source; cartDataGridView.Refresh(); SettingTheSum(2); // The sum coulmn index is at 2. } }
/// <summary> /// ReturnButton click event that sets the content panel to show the CategoryUserControl /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReturnButton_Click(object sender, EventArgs e) { CategoryUserControl cg = new CategoryUserControl(); MainControlClass.ShowControl(cg, contentPanel); }
/// <summary> /// CheckOutButton click event. Will Set the content panel to show the CheckOutUserControl. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckOutButton_Click(object sender, EventArgs e) { CheckOutUserControl co = new CheckOutUserControl(); MainControlClass.ShowControl(co, contentPanel); }