Example #1
0
        private void btnOrderShow_Click(object sender, EventArgs e)
        {
            int             orderID    = Convert.ToInt32(tbOrderID.Text);
            var             order      = db.Orders.Where(x => x.OrderID == orderID).FirstOrDefault();
            FormOrderDetail frmDetails = new FormOrderDetail(order.OrderID);

            frmDetails.Show();
            //this.Hide();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Order order = new Order();

            order.CustomerID   = cbCustomer.SelectedValue.ToString();
            order.EmployeeID   = (int)cbEmployee.SelectedValue;
            order.OrderDate    = dtpOrderDate.Value;
            order.RequiredDate = dtpOrderDate.Value;
            order.ShipVia      = (int)cbShipVia.SelectedValue;
            order.Freight      = Convert.ToDecimal(tbFreight.Text);
            db.Orders.Add(order);
            db.SaveChanges();

            FormOrderDetail frmDetails = new FormOrderDetail(order.OrderID);

            frmDetails.Show();
            //this.Hide();
        }