Ejemplo n.º 1
0
        /*Retrieve CD Details from CD File*/


        /*Retrieve Order details from Order File and OrderItems File*/


        private void btnSelSupplier_Click(object sender, EventArgs e)
        {
            CD cdQty = new CD();


            /*Retrieve Supplier Details from Supplier File, Cd Details from the CD File
             * Order details from the Order File and Orderitems File*/


            DialogResult dr = MessageBox.Show("Are you sure you want to proceed with this order for " + cboSuppliersPreOrder.GetItemText(cboSuppliersPreOrder.SelectedItem) + " ?",
                                              "Confirm Delivery", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            /*Confirm CDs that Supplier chose are the ones going to be delivered.*/


            if (dr == DialogResult.Yes)
            {
                Order.receiveOrder(Convert.ToInt32(cboSuppliersPreOrder.GetItemText(cboSuppliersPreOrder.SelectedItem)));



                cdQty.increaseQty();


                MessageBox.Show("The chosen CDs will be delivered to the chosen Supplier in a few days", "CD Delivery", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cboSuppliersPreOrder.SelectedIndex = -1;
                cboCDChoice.SelectedIndex          = -1;
                txtSuppID.Clear();
                loadSuppItems();

                this.grdSuppOrderItems.DataSource = null;
                this.grdSuppOrderItems.Rows.Clear();
                this.grdSuppOrderItems.Refresh();

                return;
            }
            else if (dr == DialogResult.No)
            {
                MessageBox.Show("The chosen CDs will not be delivered to the chosen Supplier", "CD not Delivered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cboSuppliersPreOrder.SelectedIndex = -1;
                cboCDChoice.SelectedIndex          = -1;
                txtSuppID.Clear();
                loadSuppItems();

                this.grdSuppOrderItems.DataSource = null;
                this.grdSuppOrderItems.Rows.Clear();
                this.grdSuppOrderItems.Refresh();

                return;
            }
        }