Example #1
0
        private void btnSaveOrder_Click(object sender, RoutedEventArgs e)
        {
            if (cbCustomer.SelectedItem != null)
            {
                //Combobox ui
                customer    myCustomer    = (customer)cbCustomer.SelectedItem;
                producttype myProductType = (producttype)cbProductType.SelectedItem;
                product     myProduct     = (product)cbProduct.SelectedItem;
                //Textbox uitlezen en opslaan in variable
                string sHoeveelheid = txtHoeveelheid.Text;
                int    iHoeveelheid = Convert.ToInt32(sHoeveelheid);
                //Nieuw product aanmaken
                order        myOrder        = new order();
                itemsinorder myItemsInOrder = new itemsinorder();
                //Velden met variabele vullen
                myOrder.date = DateTime.Now;
                customer selCustomer = (customer)cbCustomer.SelectedItem;
                myOrder.customerId = selCustomer.id;

                db.orders.InsertOnSubmit(myOrder);
                db.SubmitChanges();

                myItemsInOrder.amount    = iHoeveelheid;
                myItemsInOrder.orderId   = myOrder.id;
                myItemsInOrder.productId = myProduct.id;

                //Ready changes & changes uitvoeren

                db.itemsinorders.InsertOnSubmit(myItemsInOrder);
                db.SubmitChanges();
                //Refresh database
                SetData();

                //Confirmation
                MessageBox.Show("Opgeslagen");
            }
            else
            {
                MessageBox.Show("Selecteer eerst een type");
            }
        }
Example #2
0
 private void detach_itemsinorders(itemsinorder entity)
 {
     this.SendPropertyChanging();
     entity.product = null;
 }
Example #3
0
 partial void Deleteitemsinorder(itemsinorder instance);
Example #4
0
 partial void Updateitemsinorder(itemsinorder instance);
Example #5
0
 partial void Insertitemsinorder(itemsinorder instance);
Example #6
0
 private void attach_itemsinorders(itemsinorder entity)
 {
     this.SendPropertyChanging();
     entity.order = this;
 }