private void EditStockInput()
        {
            try
            {
                stockToEdit = sc.GetStock(stockID);
                if (stockToEdit != null)
                {
                    lblProduct.Text = "Edit product";
                    btnConfirmAddProduct.ButtonText = "Edit";
                    panelAddProduct.Visible         = true;
                    btnReset.Visible           = true;
                    btnConfirmAdd.Visible      = true;
                    btnUpdate.Visible          = false;
                    btnClosePopUpPanel.Visible = true;

                    tbName.Text                = stockToEdit.Name;
                    tbDescription.Text         = stockToEdit.Description;
                    tbTotalPrice.Text          = stockToEdit.Price.ToString();
                    tbSupplyCost.Text          = stockToEdit.SupplyCost.ToString();
                    tbQuantity.Text            = stockToEdit.Quantity.ToString();
                    tbTotalSales.Text          = stockToEdit.TimesSold.ToString();
                    tbRestockQuantity.Text     = stockToEdit.RestockQuantity.ToString();
                    datePicker.Value           = stockToEdit.DateOfArrival;
                    swRequested.Value          = stockToEdit.Requested;
                    ddDepartment.selectedIndex = stockToEdit.Department.Id - 1;
                }
            }
            catch (Exception)
            {
            }
        }
 private void btnEditStock_Click(object sender, EventArgs e)
 {
     bunifuDropdownEditProductDepartment.Clear();
     if (stockID == 0)
     {
         CustomMessageBoxController.ShowMessage("Choose a stock to edit first!", MessageBoxButtons.OK);
     }
     else
     {
         tbEditProductName.Text = sc.GetStock(stockID).Name;
         foreach (var item in stController.GetAllDepartments())
         {
             bunifuDropdownEditProductDepartment.AddItem(item);
         }
         //bunifuDropdownEditProductDepartment.selectedIndex = Convert.ToInt32(sc.GetStock(stockID).Department.Id) - 1;
         bunifuDropdownEditProductDepartment.selectedIndex = sc.GetStock(stockID).Department.Id - 1;
         panelEditProduct.Visible = true;
     }
 }