Пример #1
0
        private void btnConfirmCD_Click(object sender, EventArgs e)
        {
            String  a, b, c;
            decimal sum = 0;
            // add item to shopping cart


            Font font1 = new Font(FontFamily.GenericMonospace.Name, 9);

            lstCart.Font = font1;

            //for(int i = 0; i < lstCart.Items.Count; i++){
            //foreach(var item in lstCart.SelectedIndices) {
            //foreach(var item in lstCart.Items){

            txtOrdID.Text = OrderItems.nextOrd().ToString("00000");


            lstCart.Items.Add(cbopreordCD.Text.Substring(0, 5) + " " + cbopreordCD.Text.Substring(6, 30) + " " + txtQty.Text + "        €" + cbopreordCD.Text.Substring(37, 5));



            //Update Order value
            txtOrdValue.Text = (Convert.ToDecimal(txtOrdValue.Text) + (Convert.ToInt32(txtQty.Text) * Convert.ToDecimal(cbopreordCD.Text.Substring(37, 5)))).ToString();

            //txtOrdValue.Text = (Convert.ToDecimal(txtOrdValue.Text) + (Convert.ToInt32(txtQty.Text) * Convert.ToDecimal(cbopreordCD.Text.Substring(35, 5))).ToString("000.00"));



            //sum += Convert.ToDecimal(txtOrdValue.Text);
            //}
        }
Пример #2
0
        private void btnConfirmCD_Click(object sender, EventArgs e)
        {
            string suppID   = "002";
            float  ordValue = 13.45f;
            string cdid     = "00004";
            int    qty      = 100;


            //Confirm CD Preorder

            /*Retrieve all details of selected Supplier from Supplier File and
             * Retrieve all details of selected CD from CD File */

            DialogResult dr = MessageBox.Show("Are you sure you want to preorder this CD? \nOrdID: " + txtOrdID.Text + "\nCD: " + cbopreordCD.GetItemText(cbopreordCD.SelectedItem) +
                                              "\nSupplier: " + cboPreSupp.GetItemText(cboPreSupp.SelectedItem), "Confirm Preorder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                //Save Order Details in Order File


                MessageBox.Show("OrderID : " + txtOrderID.Text + "\nSuppID: " + suppID + "\nOrder Date: " + dtpOrder.Text + "\nOrder Value: \n€" + ordValue + "\nStatus: " +
                                status, "Order Details", MessageBoxButtons.OK, MessageBoxIcon.Information);



                //Save Order item Details in OrderItems File
                MessageBox.Show("OrdID : " + txtOrdID.Text + "\nCDID: " + cdid + "\nQty" + qty, "OrderItems Details", MessageBoxButtons.OK, MessageBoxIcon.Information);


                MessageBox.Show("This CD has now been ordered for the Supplier \nOrder ID: " + txtOrderID.Text + "\nCD: " + cbopreordCD.GetItemText(cbopreordCD.SelectedItem) +
                                "\nOrder Date: " + dtpOrder.Text, "Cd Preordered", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);


                txtOrderID.Text = Order.nextOrder().ToString("0000");
                loadSuppItems();
                txtOrdID.Text             = OrderItems.nextOrd().ToString("00000");
                cboPreSupp.SelectedIndex  = -1;
                cbopreordCD.SelectedIndex = -1;
                return;
            }
            else if (dr == DialogResult.No)
            {
                MessageBox.Show("This CD will not be preordered and placed for the Supplier", "Cd Preordered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                txtOrderID.Text = Order.nextOrder().ToString("0000");
                loadSuppItems();
                txtOrdID.Text             = OrderItems.nextOrd().ToString("00000");
                cboPreSupp.SelectedIndex  = -1;
                cbopreordCD.SelectedIndex = -1;
                return;
            }
        }
Пример #3
0
 private void frmPreordCD_Load(object sender, EventArgs e)
 {
     txtOrderID.Text = Order.nextOrder().ToString("1000");
     txtOrdID.Text   = OrderItems.nextOrd().ToString("10000");
     loadSuppItems();
 }
Пример #4
0
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            //Confirm CD Preorder

            /*Retrieve all details of selected Supplier from Supplier File and
             * Retrieve all details of selected CD from CD File */


            DialogResult dr = MessageBox.Show("Are you sure you want to preorder the CDs selected in the cart? \nOrder ID: " + txtOrderID.Text +
                                              "\nSupplier: " + cboPreSupp.GetItemText(cboPreSupp.SelectedItem), "Confirm Preorder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                Order order = new Order();
                //Save Order Details in Order File

                order.setOrderID(Convert.ToInt32(txtOrderID.Text));
                order.setOrdDate(String.Format("{0:dd-MM-yyyy}", dtpOrder.Value));
                order.setOrdValue(Convert.ToDecimal(txtOrdValue.Text));
                order.setStatus(status);
                order.setSuppID(Convert.ToInt32(txtSuppID.Text.Substring(0, 3)));

                order.placeOrder();

                MessageBox.Show("OrderID : " + txtOrderID.Text + "\nSuppID: " + txtSuppID.Text + "\nOrder Date: " + dtpOrder.Text + "\nOrder Value: €" + txtOrdValue.Text + "\nStatus: " +
                                status, "Order Details", MessageBoxButtons.OK, MessageBoxIcon.Information);


                foreach (var item in lstCart.Items)
                //Placing orderitems in cart
                //Confirming orderitems
                {
                    OrderItems orderitem = new OrderItems();

                    orderitem.setOrdID(Convert.ToInt32(txtOrdID.Text));
                    orderitem.setCDID(Convert.ToInt32(cbopreordCD.Text.Substring(0, 5)));
                    orderitem.setQty(Convert.ToInt32(txtQty.Text));
                    // orderitem.setQty(Convert.ToInt32(cbopreordCD.Text.Substring(6, 30)));
                    orderitem.setUnitCost(Convert.ToDecimal(cbopreordCD.Text.Substring(37, 5)));

                    orderitem.placeOrderItem();

                    //Save Order item Details in OrderItems File
                    MessageBox.Show("OrdID : " + txtOrdID.Text + "\nCDID: " + cbopreordCD.GetItemText(cbopreordCD.SelectedItem) + "\nQty: " + txtQty.Text
                                    + "\nUnit Cost: €" + cbopreordCD.Text.Substring(37, 5), "OrderItems Details", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    txtOrdID.Text = OrderItems.nextOrd().ToString("00000");
                }


                MessageBox.Show("This CD has now been ordered for the Supplier \nOrder ID: " + txtOrderID.Text + "\nCD: " + cbopreordCD.GetItemText(cbopreordCD.SelectedItem) +
                                "\nOrder Date: " + dtpOrder.Text, "Cd Preordered", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);


                txtOrderID.Text = Order.nextOrder().ToString("0000");
                txtSuppID.Clear();
                loadSuppItems();
                txtOrdValue.Clear();
                txtQty.Clear();
                cboPreSupp.SelectedIndex  = -1;
                cbopreordCD.SelectedIndex = -1;
            }
            else if (dr == DialogResult.No)
            {
                MessageBox.Show("This CD will not be preordered and placed for the Supplier", "Cd Preordered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtSuppID.Clear();
                loadSuppItems();
                txtOrdValue.Clear();
                txtQty.Clear();
                cboPreSupp.SelectedIndex  = -1;
                cbopreordCD.SelectedIndex = -1;
            }
        }