Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            List <Order> ord = new List <Order>();

            ord = OrderDB.GetOrders();
            orderBindingSource.DataSource = ord;
        }
Exemplo n.º 2
0
        // method for getting data for the orders and displaying orders
        private void DisplayOrders()
        {
            List <Order> ord = new List <Order>();

            try
            {
                ord = OrderDB.GetOrders();
                orderBindingSource.DataSource = ord;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
Exemplo n.º 3
0
 private void btnSaveDate_Click(object sender, EventArgs e)
 {
     try
     {
         OrderDB.SaveShippedDate(orders[recordIndex], tmpDate); // call the Save method
         orders = OrderDB.GetOrders();                          // reload the orders list
         LoadOrders(recordIndex);                               // redisplay the information based on the current record
         btnSaveDate.Enabled = false;                           // disable the button as we are done this operation
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Method to refresh the list in any situation where it's needed
 /// </summary>
 private void RefreshList()
 {
     try
     {
         orders = OrderDB.GetOrders();                       // get an updated list of orders from the database
         dgvOrders.DataSource = orders;                      // put it in the data grid view
         dgvOrders.Columns[2].DefaultCellStyle.Format = "d"; // set the date columns to short date format
         dgvOrders.Columns[3].DefaultCellStyle.Format = "d";
         dgvOrders.Columns[4].DefaultCellStyle.Format = "d";
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error loading the order list: " + ex.Message, ex.GetType().ToString());
     }
 }
Exemplo n.º 5
0
 private void Form1_Shown(object sender, EventArgs e)
 {
     orders = OrderDB.GetOrders(); // populate the list with all the orders from the DB
     LoadOrders(recordIndex);      // set Form controls with the first order entity information
 }