Exemplo n.º 1
0
 //Get a specific order ID from the dropdown list
 private void GetOrder(int orderID)
 {
     try
     {
         order            = OrdersDB.GetOrder(orderID);
         orderDetailsList = OrderDetailsDB.GetOrderDetails(orderID);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.GetType().ToString());
     }
 }
Exemplo n.º 2
0
 //load the values (orderIDs) of the combobox
 private void LoadComboBox()
 {
     //access the OrdersDB
     orderIDs = OrdersDB.GetOrderIDs();
     if (orderIDs.Count > 0) // if there are members
     {
         cmbBoxOrderID.DataSource    = orderIDs;
         cmbBoxOrderID.SelectedIndex = 0; // triggers SelectedIndexChanged
     }
     else // no members
     {
         MessageBox.Show("There are no members. " +
                         "Add some members in the database, and restart the application ", "Empty Load");
         Application.Exit();
     }
 }
Exemplo n.º 3
0
        //open modify shipped date window and allow for changes
        private void btnModifyShip_Click(object sender, EventArgs e)
        {
            frmModifyShipped secondForm = new frmModifyShipped();

            secondForm.order = order;                      // set current member on the second form
            DialogResult result = secondForm.ShowDialog(); // display second form modal

            if (result == DialogResult.OK)
            {
                order = secondForm.order; // receive current member from the second form
            }
            else if (result == DialogResult.Retry)
            {
                order = OrdersDB.GetOrder(order.OrderID);
            }
            this.GetOrder(order.OrderID);
            this.DisplayOrder();
            txtOrderTotal.Text = CalculateTotal().ToString("c");
        }
Exemplo n.º 4
0
 //accept new shipped date and update the value on the database
 private void btnAcceptShipping_Click(object sender, EventArgs e)
 {
     if (IsValidDateShipped())
     {
         // build Member object with the new data
         Orders newOrder = new Orders();
         newOrder.ShippedDate = order.ShippedDate;
         DateTime?dateTime = null;
         //check to see if value of shippedDate is null
         if (txtShippedDate.Text != "")
         {
             dateTime = Convert.ToDateTime(txtShippedDate.Text);
         }
         else
         {
             dateTime = null;
         }
         try                                                     // try to update
         {
             if (!OrdersDB.UpdateOrder(order.OrderID, dateTime)) //failed
             {
                 MessageBox.Show("Another user has updated or " +
                                 "deleted current member", "Concurrency Error");
                 this.DialogResult = DialogResult.Retry;
             }
             else
             {
                 //order = newOrder;
                 this.DialogResult = DialogResult.OK;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error while updating: " + ex.Message, ex.GetType().ToString());
         }
     }
 }