private void OrderCheck()
        {
            try
            {
                secilenID = Convert.ToInt32(txtOrdersID.Text);


                //   List<Order_Detail> od_List = db.Order_Details.Where(x => secilenID == x.OrderID).ToList();
                List <Order> odList2 = db.Orders.Where(x => secilenID == x.OrderID).ToList();
                if (odList2.Count == 0)
                {
                    MessageBox.Show(secilenID + "nolu siparis yok.");
                }
                else
                {
                    FormOrderHeaderDetail frmOrdHeadDet = new FormOrderHeaderDetail(secilenID);


                    frmOrdHeadDet.Show();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Girilen siparis icin veri okuma yapilamadi.");
            }
        }
Example #2
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();
        }