예제 #1
0
        //Add order to database...
        private void StartOrder()
        {
            int customerIndex = dgvCustomers.CurrentRow.Index;

            //Create object for the order
            order             = new Order();
            order.Payment     = cmbPayment.SelectedValue.ToString();
            order.Salesperson = salespersonID.ToString();
            order.Date        = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            order.Time        = Convert.ToDateTime(DateTime.Now.ToShortTimeString());
            order.Completed   = false;
            order.Collected   = false;
            order.Customer    = dgvCustomers[0, customerIndex].Value.ToString();
            order.Total       = orderTotal;

            //Add order to database
            try
            {
                handlerOrder.AddOrder(order);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to add the order!" + Environment.NewLine + Environment.NewLine + ex.Message);
            }

            //Get the order number from database
            try
            {
                orderNumber = handlerOrder.GetOrderNumber();
            }
            catch
            {
            }
        }
예제 #2
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            int customerIndex = dgvCustomers.CurrentRow.Index;

            Order order = new Order();

            order.Payment     = cmbPayment.SelectedIndex.ToString();
            order.Salesperson = salespersonID.ToString();
            order.Date        = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            order.Time        = Convert.ToDateTime(DateTime.Now.ToShortTimeString());
            order.Completed   = false;
            order.Collected   = false;
            order.Customer    = dgvCustomers[0, customerIndex].Value.ToString();
            order.Total       = Convert.ToDouble(lblTotal.Text);

            handlerOrder.AddOrder(order);
        }