コード例 #1
0
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsOrderCollection AllOrders = new clsOrderCollection();
            //validate the data on the Windows Form
            string Error = AllOrders.ThisOrder.Valid(txtEmail.Text, txtTotalPrice.Text, txtDateOrdered.Text, txtShippingAddress.Text, txtPhonenum.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllOrders.ThisOrder.Find(mOrderId);
                //get the data entered by the user

                AllOrders.ThisOrder.Email           = txtEmail.Text;
                AllOrders.ThisOrder.TotalPrice      = Convert.ToDecimal(txtTotalPrice.Text);
                AllOrders.ThisOrder.DateOrdered     = Convert.ToDateTime(txtDateOrdered.Text);
                AllOrders.ThisOrder.ShippingAddress = Convert.ToString(txtShippingAddress.Text);
                AllOrders.ThisOrder.Phonenum        = txtPhonenum.Text;


                //UPDATE the record
                AllOrders.Update();
                //All done so redirect back to the main page
                OrderManageForm OM = new OrderManageForm();
                this.Hide();
                OM.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }
コード例 #2
0
        private void btnManageOrder_Click(object sender, EventArgs e)
        {
            OrderManageForm OM = new OrderManageForm();

            this.Hide();
            OM.ShowDialog();
            this.Close();
        }
コード例 #3
0
        private void btnNo_Click(object sender, EventArgs e)
        {
            //All done so redirect back to the main page
            OrderManageForm OM = new OrderManageForm();

            this.Hide();
            OM.ShowDialog();
            this.Close();
        }
コード例 #4
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            string            message = "The Order has been deleted successfully.";
            string            caption = "Deletion Confirmation";
            DialogResult      result;
            MessageBoxButtons button = MessageBoxButtons.OK;

            result = MessageBox.Show(message, caption, button);

            if (result == DialogResult.OK)
            {
                //delete the record
                DeleteOrder();
                //All done so redirect back to the main page
                OrderManageForm OM = new OrderManageForm();
                this.Hide();
                OM.ShowDialog();
                this.Close();
            }
        }
コード例 #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            clsOrderCollection AllOrders = new clsOrderCollection();
            string             Error     = AllOrders.ThisOrder.Valid(txtEmail.Text, txtTotalPrice.Text, txtDateOrdered.Text, txtShippingAddress.Text, txtPhonenum.Text);
            string             message   = "Are you sure to Update the existing Order?";
            string             caption   = "User Confirmation!";
            MessageBoxButtons  buttons   = MessageBoxButtons.YesNo;
            DialogResult       result;

            //Displays the MessageBox

            //if there are no Errors returned
            if (Error == "")
            {
                //show the Message box
                result = MessageBox.Show(message, caption, buttons);

                //if "Yes" is pressed
                if (result == DialogResult.Yes)
                {
                    //execute the Update method
                    Update();

                    //All done so redirect back to the main page
                    OrderManageForm OM = new OrderManageForm();
                    this.Hide();
                    OM.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered : " + Error;
            }
        }