private void btnOrderUpdate_Click(object sender, EventArgs e)
 {
     gelenOrder.CustomerID   = cmbCustomers.SelectedValue.ToString();
     gelenOrder.EmployeeID   = (int)cmbEmployees.SelectedValue;
     gelenOrder.OrderDate    = dtpOrderDate.Value;
     gelenOrder.RequiredDate = dtpRequiredDate.Value;
     gelenOrder.ShipVia      = (int)cmbShipVia.SelectedValue;
     gelenOrder.Freight      = Convert.ToDecimal(txtFreight.Text);
     db.SaveChanges();
     MessageBox.Show("Order has been Updated.");
     OrderDoldur();
     ComboDoldur();
 }
        private void btnCreateOrder_Click(object sender, EventArgs e)
        {
            Order ord = new Order();

            ord.CustomerID   = cmbCustomers.SelectedValue.ToString();
            ord.EmployeeID   = (int)cmbEmployees.SelectedValue;
            ord.OrderDate    = dtpOrderDate.Value;
            ord.RequiredDate = dtpRequiredDate.Value;
            ord.ShipVia      = (int)cmbShipVia.SelectedValue;
            ord.Freight      = Convert.ToDecimal(txtFreight.Text);
            ord.ShipCountry  = txtCountry.Text;
            ord.ShipAddress  = txtAddress.Text;

            db.Orders.Add(ord);
            db.SaveChanges();
            FormOrderHeaderDetail frm2 = new FormOrderHeaderDetail(ord.OrderID);

            //  frm2.Show();
            MessageBox.Show("Ekleme yapıldı");
        }
Пример #3
0
        private void btnCreateOrder_Click(object sender, EventArgs e)
        {
            Order orders = new Order();

            orders.CustomerID   = cmbCustomers.SelectedValue.ToString();
            orders.EmployeeID   = (int)cmbEmployees.SelectedValue;
            orders.OrderDate    = dtpOrderDate.Value;
            orders.RequiredDate = dtpRequiredDate.Value;
            orders.ShipVia      = (int)cmbShipVia.SelectedValue;
            orders.Freight      = Convert.ToDecimal(txtFreight.Text);
            orders.ShipCountry  = txtCountry.Text;
            orders.ShipAddress  = txtAddress.Text;

            db.Orders.Add(orders);

            db.SaveChanges();

            MessageBox.Show("New order has been Inserted to DataBase");

            FormOrderHeaderDetail frm = new FormOrderHeaderDetail(orders.OrderID);

            frm.Show();
            this.Hide();
        }