예제 #1
0
        //Decreasing stock
        private void btnRestockDecreaseStock_Click(object sender, EventArgs e)
        {
            try
            {
                RestockItem selectedRestockItem = lsbRequestsOutstanding.SelectedItem as RestockItem;

                int amount = Convert.ToInt32(txtBoxRestockAmountDecrease.Text);
                if (amount < 0)
                {
                    MessageBox.Show("Given amount must be above 0");
                    return;
                }
                amount = amount * -1;
                restockItemController.IncreaseRestockItem(selectedRestockItem, amount);

                updateRestockData();
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("format"))
                {
                    MessageBox.Show("Increase/Decrease with a valid numerical value");
                }
                MessageBox.Show("Select a product to initiate the restock");
            }
        }
예제 #2
0
        private void btnRejectRestock_Click(object sender, EventArgs e)
        {
            RestockItem restockItemToReject = lsbRequestsOutstanding.SelectedItem as RestockItem;

            try
            {
                restockItemController.RejectRequest(restockItemToReject, rejectMessage.Text);
                updateRestockData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong, please add a reason");
            }
        }
예제 #3
0
        public MediaBazaar()
        {
            InitializeComponent();

            //initialize the controller objects
            productcontroller     = new ProductController();
            calenderManager       = new CalenderManager();
            employeeController    = new EmployeeController();
            departmentcontroller  = new DepartmentController();
            restockItemController = new RestockItemController();
            restockItem           = new RestockItem();
            stats = new Stats();
            usr   = new User();
            lsbRequestsOutstanding.HorizontalScrollbar = true;
            lbCompletedRequests.HorizontalScrollbar    = true;

            LoadAtStart();
        }