Exemple #1
0
 //Butona tıklanınca textboxtaki OrderID ile birlikte sipariş detay formunu açan event
 private void btnOrderAra_Click(object sender, EventArgs e)
 {
     try
     {
         int newOrderID       = Convert.ToInt32(txtOrderAra.Text);
         SiparisDetayFormu f3 = new SiparisDetayFormu(newOrderID);
         f3.Show();
         SiparisDetaySorgulamaFormu f4 = new SiparisDetaySorgulamaFormu();
         f4.Close();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 //butona tıklandığında ilgili alanlarda yer alan bilgilerle Order tablosuna yeni bir kayıt atan event
 private void btnCreateOrder_Click(object sender, EventArgs e)
 {
     try
     {
         Order newOrder = new Order();
         newOrder.CustomerID   = Convert.ToString(cbCustomer.SelectedValue);
         newOrder.EmployeeID   = Convert.ToInt32(cbEmployee.SelectedValue);
         newOrder.OrderDate    = dtpOrderDate.Value;
         newOrder.RequiredDate = dtpRequiredDate.Value;
         newOrder.ShipVia      = Convert.ToInt32(cbShipvia.SelectedValue);
         newOrder.Freight      = Convert.ToDecimal(txtFreight.Text);
         newOrder.ShipAddress  = txtAddress.Text;
         newOrder.ShipCity     = txtCity.Text;
         ctx.Orders.Add(newOrder);
         ctx.SaveChanges();
         SiparisDetayFormu f3 = new SiparisDetayFormu(newOrder.OrderID);
         f3.Show();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }