コード例 #1
0
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            if (productListView.SelectedValue != null)
            {
                using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
                {
                    var bestel = ctx.BestellingProducts.Select(x => x).ToList();
                    if (bestel.Contains(productListView.SelectedValue))
                    {
                        var bestelingId = ctx.BestellingProducts.Select(x => x).Where(x => x.ProductID == (int)productListView.SelectedValue).FirstOrDefault();
                        ctx.BestellingProducts.RemoveRange(ctx.BestellingProducts.Where(x => x.ProductID == (int)productListView.SelectedValue)).FirstOrDefault();
                        ctx.Bestellings.RemoveRange(ctx.Bestellings.Where(x => x.ID == bestelingId.BestellingID));
                        ctx.Products.RemoveRange(ctx.Products.Where(p => p.ID == (int)productListView.SelectedValue)).FirstOrDefault();
                    }
                    else
                    {
                        ctx.Products.RemoveRange(ctx.Products.Where(p => p.ID == (int)productListView.SelectedValue)).FirstOrDefault();
                    }

                    System.Windows.Forms.DialogResult result = MyMessageBox.Show("Are you sure want to delet the product?", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        MessagBoxInfo.Show("Product successfully deleted", MessagBoxInfo.CmessageBoxTitle.Info);
                        ctx.SaveChanges();
                    }
                }
            }
            updateListView();
        }
コード例 #2
0
 private void btnJasonCreat_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var           products     = ctx.Products.Select(x => x);
         List <object> listProducts = new List <object>();
         foreach (var item in products)
         {
             Product productList = new Product()
             {
                 ID            = item.ID,
                 Naam          = item.Naam,
                 Marge         = item.Marge,
                 Eenheid       = item.Eenheid,
                 BTW           = item.BTW,
                 LeverancierID = item.LeverancierID,
                 CategorieID   = item.CategorieID,
                 Inkoopprijs   = item.Inkoopprijs,
                 InStock       = item.InStock
             };
             listProducts.Add(productList);
         }
         JsonCreat(listProducts);
         MessagBoxInfo.Show("Template created", MessagBoxInfo.CmessageBoxTitle.Info);
     }
 }
コード例 #3
0
        private void updateFilter()
        {
            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                switch (cmbPerson.SelectedItem)
                {
                case "A->Z":
                    var person = ctx.Personeelslids.Select(x => x).OrderBy(x => x.Voornaam);
                    listViewPersonLid.ItemsSource = person.ToList();
                    break;

                case "Z->A":
                    var person1 = ctx.Personeelslids.Select(x => x).OrderByDescending(x => x.Voornaam);
                    listViewPersonLid.ItemsSource = person1.ToList();
                    break;

                case "UserType ↑":
                    var userType = ctx.Personeelslids.Select(x => x).OrderBy(x => x.Usertype);
                    listViewPersonLid.ItemsSource = userType.ToList();
                    break;

                case "UserType ↓":
                    var userType1 = ctx.Personeelslids.Select(x => x).OrderByDescending(x => x.Usertype);
                    listViewPersonLid.ItemsSource = userType1.ToList();
                    break;

                default:
                    break;
                }
            }
        }
コード例 #4
0
 private void btnRemove_Click(object sender, RoutedEventArgs e)
 {
     if (listViewOrder.SelectedValue != null)
     {
         using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
         {
             var bestelingProd = ctx.BestellingProducts.Select(x => x).ToList();
             if (bestelingProd.Contains(listViewOrder.SelectedValue))
             {
                 System.Windows.Forms.DialogResult result = MyMessageBox.Show("Are you sure you want to delete the order and all the datas? ", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                 if (result == System.Windows.Forms.DialogResult.Yes)
                 {
                     var bestProd = ctx.BestellingProducts.RemoveRange(ctx.BestellingProducts.Where(x => x.BestellingID == (int)listViewOrder.SelectedValue));
                     var best     = ctx.Bestellings.RemoveRange(ctx.Bestellings.Where(x => x.ID == (int)listViewOrder.SelectedValue));
                     MessagBoxInfo.Show("Data successfully deleted", MessagBoxInfo.CmessageBoxTitle.Info);
                     ctx.SaveChanges();
                     updateTheList();
                 }
             }
             else
             {
                 var best1 = ctx.Bestellings.RemoveRange(ctx.Bestellings.Where(x => x.ID == (int)listViewOrder.SelectedValue));
                 ctx.SaveChanges();
                 updateTheList();
             }
         }
     }
 }
コード例 #5
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            int number = 0;

            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                if (productListView.SelectedValue != null && Convert.ToInt32(txtQuantity.Text) != 0)
                {
                    var product = ctx.Products.Select(x => x).Where(x => x.ID == (int)productListView.SelectedValue).FirstOrDefault();
                    foreach (var item in myProductinKars)
                    {
                        if (item.ProductinKarID == product.ID)
                        {
                            number++;
                        }
                    }
                    if (number == 1)
                    {
                        MessagBoxInfo.Show("The product is already in the shopping car", MessagBoxInfo.CmessageBoxTitle.Info);
                    }
                    else
                    {
                        myProductinKars.Add(new ProductinKar(Convert.ToInt32(txtQuantity.Text), (double)product.Inkoopprijs, product.ID, product.Naam, (int)product.LeverancierID, (double)product.Marge, (double)product.BTW, product.Eenheid));
                    }
                }
                ctx.SaveChanges();
            }
            lbShoppingCart.ItemsSource       = null;
            lbShoppingCart.SelectedValuePath = "ProductinKarID";
            lbShoppingCart.ItemsSource       = myProductinKars;
            updateTotalPrice();
        }
コード例 #6
0
        private void btnAddSave_Click(object sender, RoutedEventArgs e)
        {
            if (chekText(true))
            {
                do
                {
                    using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
                    {
                        try
                        {
                            var sup = ctx.Leveranciers.Where(x => x.Company == txtCompany.Text && x.Contactpersoon == txtContactPerson.Text).Count();

                            if (sup == 0)
                            {
                                ctx.Leveranciers.Add(new Leverancier()
                                {
                                    Contactpersoon = txtContactPerson.Text,
                                    Company        = txtCompany.Text,
                                    Telefoonnummer = txtPhone.Text,
                                    Emailadres     = txtEmail.Text,
                                    Straatnaam     = txtStreet.Text,
                                    Huisnummer     = Convert.ToInt32(txtHouseNumber.Text),
                                    Bus            = Convert.ToInt32(txtMailbox.Text),
                                    Postcode       = Convert.ToInt32(txtZipcode.Text),
                                    Gemeente       = txtTown.Text
                                });
                                string newSuppplier = $"{txtCompany.Text}\n" +
                                                      $"{txtContactPerson.Text}\n" +
                                                      $"{txtPhone.Text}\n" +
                                                      $"{txtEmail.Text}\n" +
                                                      $"{txtStreet.Text} {txtHouseNumber.Text} {txtMailbox.Text}\n" +
                                                      $"{txtZipcode.Text}\n" +
                                                      $"{txtTown.Text}";
                                System.Windows.Forms.DialogResult result = MessagBoxInfo.Show(newSuppplier, MessagBoxInfo.CmessageBoxTitle.Info);
                                if (result == System.Windows.Forms.DialogResult.OK)
                                {
                                    ctx.SaveChanges();
                                    updateTheList();
                                    hidePanel();
                                }
                            }
                            else
                            {
                                MessagBoxInfo.Show("Company is already exist", MessagBoxInfo.CmessageBoxTitle.Error);
                            }
                        }
                        catch (Exception)
                        {
                            MessagBoxInfo.Show("Something wrong", MessagBoxInfo.CmessageBoxTitle.Warning);
                        }
                    }
                } while (false);
            }
            else
            {
                MessagBoxInfo.Show("Something missing", MessagBoxInfo.CmessageBoxTitle.Warning);
            }
        }
コード例 #7
0
 private void UpdateListView()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var cusList = ctx.Klants.Select(x => x);
         listViewCustomer.SelectedValuePath = "ID";
         listViewCustomer.ItemsSource       = cusList.ToList();
     }
 }
コード例 #8
0
 private void updateTheList()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var supl = ctx.Leveranciers.Select(l => l);
         supportList.SelectedValuePath = "ID";
         supportList.ItemsSource       = supl.ToList();
     }
 }
コード例 #9
0
 private void updateTheList()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var personLid = ctx.Personeelslids.Select(x => x);
         listViewPersonLid.SelectedValuePath = "ID";
         listViewPersonLid.ItemsSource       = personLid.ToList();
     }
 }
コード例 #10
0
 private void updateCmbSupplier()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var supl = ctx.Leveranciers.Select(x => x);
         cmbSupplier.SelectedValuePath = "ID";
         cmbSupplier.DisplayMemberPath = "Company";
         cmbSupplier.ItemsSource       = supl.ToList();
     }
 }
コード例 #11
0
 private void updateCmbKlant()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var klant = ctx.Klants.Select(x => new { Id = x.ID, Name = x.Voornaam + " " + x.Achternaam });
         cmbKlant.SelectedValuePath = "Id";
         cmbKlant.DisplayMemberPath = "Name";
         cmbKlant.ItemsSource = klant.ToList();
     }
 }
コード例 #12
0
 private void fillTheList()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var orderopro = ctx.BestellingProducts.Select(x => new { Id          = x.BestellingProductID, BestelinId = x.BestellingID,
                                                                  ProductName = x.Product.Naam, Quantity = x.Pieces });
         listViewOrderProduct.SelectedValuePath = "Id";
         listViewOrderProduct.ItemsSource       = orderopro.ToList();
     }
 }
コード例 #13
0
 private void btnAll_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var product = ctx.Products.Select(x => x);
         productListView.SelectedValuePath = "ID";
         productListView.ItemsSource       = product.ToList();
     }
     txtQuantity.Text = 0.ToString();
     txtPrice.Text    = string.Empty;
 }
コード例 #14
0
 private void productListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         if (productListView.SelectedValue != null)
         {
             var product = ctx.Products.Select(x => x).Where(x => x.ID == (int)productListView.SelectedValue).FirstOrDefault();
             txtPrice.Text = ((product.Inkoopprijs + product.Marge) * (1 + product.BTW / 100)) + "€";
         }
     };
 }
コード例 #15
0
 private void btnPc_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var product = ctx.Products.Select(x => x).Where(x => x.CategorieID == 9);
         lbProduct.DisplayMemberPath = "Naam";
         lbProduct.SelectedValuePath = "ID";
         lbProduct.ItemsSource = product.ToList();
     }
     txtQuantity.Text = 0.ToString();
     txtTaxPrice.Text = string.Empty;
 }
コード例 #16
0
 private void btnEcs_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         foreach (var item in myProductinKars)
         {
             var product = ctx.Products.Select(x => x).Where(x => x.ID == item.ProductinKarID).FirstOrDefault();
             product.InStock = product.InStock + item.Quantity;
             ctx.SaveChanges();
         }
     }
     System.Windows.Application.Current.Shutdown();
 }
コード例 #17
0
 private void btnBack_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         foreach (var item in myProductinKars)
         {
             var product = ctx.Products.Select(x => x).Where(x => x.ID == item.ProductinKarID).FirstOrDefault();
             product.InStock = product.InStock + item.Quantity;
             ctx.SaveChanges();
         }
     }
     MainMenu mainMenu = new MainMenu(loggedInUser);
     mainMenu.ShowDialog();
 }
コード例 #18
0
 private void updateEditForm()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         if (listViewOrder.SelectedValue != null)
         {
             var select = ctx.Bestellings.Select(x => x).Where(x => x.ID == (int)listViewOrder.SelectedValue).FirstOrDefault();
             cmbKlant.SelectedValue        = select.KlantID;
             cmbPersonmember.SelectedValue = select.PersoneelslidID;
             cmbSupplier.SelectedValue     = select.LeverancierID;
             dtDatum.SelectedDate          = select.DatumOpgemaakt;
         }
     }
 }
コード例 #19
0
        private void lbProduct_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                if (lbProduct.SelectedValue != null)
                {
                    var product = ctx.Products.Select(x => x).Where(x => x.ID == (int)lbProduct.SelectedValue).FirstOrDefault();
                    //txtPrice.Text = (product as Product).nettoPrice().ToString();
                    txtTaxPrice.Text = Convert.ToDouble((product.Inkoopprijs + product.Marge) * (1 + Convert.ToDouble(product.BTW) / 100)).ToString() + "€";
                    txtInfo.Text = product.Specifications;
                }
            };

        }
コード例 #20
0
 private void btnAddSave_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         if (chekErrorsText(true))
         {
             do
             {
                 try
                 {
                     ctx.Klants.Add(new Klant()
                     {
                         Voornaam       = txtFirstName.Text,
                         Achternaam     = txtLastName.Text,
                         Straatnaam     = txtStreet.Text,
                         Huisnummer     = Convert.ToInt32(txtHouseNumber.Text),
                         Bus            = Convert.ToInt32(txtMailbox.Text),
                         Postcode       = Convert.ToInt32(txtZipcode.Text),
                         Gemeente       = txtTown.Text,
                         Telefoonnummer = txtPhone.Text,
                         Emailadres     = txtEmail.Text,
                         AangemaaktOp   = Convert.ToDateTime(DateTimePicker.Text),
                         Opmerking      = txtComment.Text
                     });
                     var klant = ctx.Klants.Select(x => x).Where(y => y.Voornaam == txtFirstName.Text && y.Achternaam == txtLastName.Text).Count();
                     if (klant == 0)
                     {
                         MessagBoxInfo.Show("New Customer", MessagBoxInfo.CmessageBoxTitle.Info);
                         ctx.SaveChanges();
                         UpdateListView();
                         hidePanel();
                     }
                     else
                     {
                         MessagBoxInfo.Show("De customer alredy exist", MessagBoxInfo.CmessageBoxTitle.Error);
                     }
                 }
                 catch
                 {
                     MessagBoxInfo.Show("Something wrong", MessagBoxInfo.CmessageBoxTitle.Error);
                 }
             } while (false);
         }
         else
         {
             MessagBoxInfo.Show("Something missing", MessagBoxInfo.CmessageBoxTitle.Error);
         }
     }
 }
コード例 #21
0
 private void fillEditForm()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         if (listViewPersonLid.SelectedValue != null)
         {
             var select = ctx.Personeelslids.Select(x => x).Where(x => x.ID == (int)listViewPersonLid.SelectedValue).FirstOrDefault();
             txtFirstname.Text        = select.Voornaam;
             txtLastname.Text         = select.Achternaam;
             txtPassword.Text         = select.Password;
             txtUsername.Text         = select.Username;
             cmbUsertype.SelectedItem = select.Usertype;
         }
     }
 }
コード例 #22
0
 private void updateTheList()
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         var order = ctx.Bestellings.Select(x => new
         {
             Id      = x.ID,
             Datum   = x.DatumOpgemaakt,
             Person  = x.Personeelslid.Voornaam + " " + x.Personeelslid.Achternaam,
             Leveran = x.Leverancier.Company,
             Klant   = x.Klant.Voornaam + " " + x.Klant.Achternaam
         });
         listViewOrder.SelectedValuePath = "Id";
         listViewOrder.ItemsSource       = order.ToList();
     }
 }
コード例 #23
0
        private void fillComboBox()
        {
            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                var supList = ctx.Leveranciers.Select(x => x);
                cmbSupplier.SelectedValuePath = "ID";
                cmbSupplier.DisplayMemberPath = "Company";
                cmbSupplier.ItemsSource       = supList.ToList();


                var catList = ctx.Categories.Select(x => x);
                cmbCategory.SelectedValuePath = "ID";
                cmbCategory.DisplayMemberPath = "CategorieNaam";
                cmbCategory.ItemsSource       = catList.ToList();
            }
        }
コード例 #24
0
 private void btnLogout_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         foreach (var item in myProductinKars)
         {
             var product = ctx.Products.Select(x => x).Where(x => x.ID == item.ProductinKarID).FirstOrDefault();
             product.InStock = product.InStock + item.Quantity;
             ctx.SaveChanges();
         }
     }
     MainWindow mainwindow = new MainWindow();
     var myWindow = Window.GetWindow(this);
     myWindow.Close();
     mainwindow.ShowDialog();
 }
コード例 #25
0
 private void btnRemove_Click(object sender, RoutedEventArgs e)
 {
     if (listViewOrderProduct.SelectedValue != null)
     {
         using  (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
         {
             System.Windows.Forms.DialogResult result = MyMessageBox.Show("Are you sure want to delet the product?", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
             if (result == System.Windows.Forms.DialogResult.Yes)
             {
                 var bestPro = ctx.BestellingProducts.RemoveRange(ctx.BestellingProducts.Where(x => x.BestellingProductID == (int)listViewOrderProduct.SelectedValue)).FirstOrDefault();
                 ctx.SaveChanges();
                 MessagBoxInfo.Show("Data successfully deleted", MessagBoxInfo.CmessageBoxTitle.Info);
                 fillTheList();
             }
         }
     }
 }
コード例 #26
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         if (lbShoppingCart.SelectedIndex != -1)
         {
             var product = ctx.Products.Select(x => x).Where(x => x.ID == (int)lbShoppingCart.SelectedValue).FirstOrDefault();
             System.Windows.Forms.DialogResult result = MyMessageBox.Show("are you sure you want delete from shopping cart", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
             if (result == System.Windows.Forms.DialogResult.Yes)
             {
                 myProductinKars.RemoveAt(lbShoppingCart.SelectedIndex);
             }
         }
     }
     updateShoppingList();
     updateTotalPrice();
 }
コード例 #27
0
        // le kell frisiteni az osszes listat
        private void btnOrder_Click(object sender, RoutedEventArgs e)
        {
            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                if (cmbCustomer.SelectedValue != null && myProductinKars.Count() != 0)
                {
                    System.Windows.Forms.DialogResult result = MyMessageBox.Show("Do you confirm the order?", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        ctx.Bestellings.Add(new Bestelling()
                        {
                            PersoneelslidID = loggedInUser.ID,
                            KlantID         = (int)cmbCustomer.SelectedValue,
                            LeverancierID   = null,
                            DatumOpgemaakt  = DateTime.Now
                        });

                        ctx.SaveChanges();
                        var lastBesttelingId = ctx.Bestellings.Select(x => x.ID).Max();
                        foreach (var item in myProductinKars)
                        {
                            ctx.BestellingProducts.Add(new BestellingProduct()
                            {
                                BestellingID = lastBesttelingId,
                                ProductID    = item.ProductinKarID,
                                Pieces       = item.Quantity
                            });
                            var product = ctx.Products.Select(x => x).Where(x => x.ID == item.ProductinKarID).FirstOrDefault();
                            product.InStock = product.InStock - item.Quantity;
                            ctx.SaveChanges();
                        }
                        myProductinKars.Clear();
                        txtQuantity.Text   = 0.ToString();
                        txtPrice.Text      = string.Empty;
                        txtTotalPrice.Text = string.Empty;
                        updateShoppingList();
                        MessagBoxInfo.Show("Order successful", MessagBoxInfo.CmessageBoxTitle.Info);
                    }
                }
                else
                {
                    MessagBoxInfo.Show("Something missing", MessagBoxInfo.CmessageBoxTitle.Error);
                }
            }
        }
コード例 #28
0
 private void btnRemove_Click(object sender, RoutedEventArgs e)
 {
     if (listViewPersonLid.SelectedValue != null)
     {
         using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
         {
             var bestelingperson = ctx.Bestellings.Select(x => x).ToList();
             if (bestelingperson.Contains(listViewPersonLid.SelectedValue))
             {
                 var selectPerson       = ctx.Personeelslids.Select(x => x).Where(x => x.ID == (int)listViewPersonLid.SelectedValue).FirstOrDefault();
                 var selectOrde         = ctx.Bestellings.Select(x => x).Where(x => x.PersoneelslidID == selectPerson.ID).FirstOrDefault();
                 var selectOrderProduct = ctx.BestellingProducts.Select(x => x).Where(x => x.BestellingID == selectOrde.ID).FirstOrDefault();
                 System.Windows.Forms.DialogResult result = MyMessageBox.Show("Are you sure you want to delete the user and all the datas and orders?", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                 if (result == System.Windows.Forms.DialogResult.Yes)
                 {
                     var ord    = ctx.BestellingProducts.RemoveRange(ctx.BestellingProducts.Where(x => x.BestellingID == selectOrderProduct.BestellingID));
                     var order  = ctx.Bestellings.RemoveRange(ctx.Bestellings.Where(x => x.PersoneelslidID == selectPerson.ID));
                     var person = ctx.Personeelslids.RemoveRange(ctx.Personeelslids.Where(x => x.ID == (int)listViewPersonLid.SelectedValue)).FirstOrDefault();
                     MessagBoxInfo.Show(selectPerson.Voornaam + " " + selectPerson.Achternaam + " " + "successfully deleted", MessagBoxInfo.CmessageBoxTitle.Info);
                     ctx.SaveChanges();
                 }
                 else
                 {
                     System.Windows.Forms.DialogResult result2 = MyMessageBox.Show("Would you like to delete only the person", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                     if (result == System.Windows.Forms.DialogResult.Yes)
                     {
                         var person = ctx.Personeelslids.RemoveRange(ctx.Personeelslids.Where(x => x.ID == (int)listViewPersonLid.SelectedValue)).FirstOrDefault();
                         ctx.SaveChanges();
                     }
                 }
             }
             else
             {
                 System.Windows.Forms.DialogResult result2 = MyMessageBox.Show("Are you sure you want to delete the user?", MyMessageBox.CMessageBoxButton.Yes, MyMessageBox.CMessageBoxButton.No);
                 if (result2 == System.Windows.Forms.DialogResult.Yes)
                 {
                     var person = ctx.Personeelslids.RemoveRange(ctx.Personeelslids.Where(x => x.ID == (int)listViewPersonLid.SelectedValue)).FirstOrDefault();
                     ctx.SaveChanges();
                 }
             }
         }
         updateTheList();
         hideEditform();
     }
 }
コード例 #29
0
        public CustomerOverview()
        {
            InitializeComponent();
            List <string> sortCustomer = new List <string>()
            {
                "A->Z",
                "Z->A",
                "Bought ↑",
                "Bought ↓",
            };

            cmbFilter.ItemsSource = sortCustomer;
            using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
            {
                var supl = ctx.Klants.Select(l => l);
                listViewCustomer.ItemsSource = supl.ToList();
            }
        }
コード例 #30
0
 private void btnReg_Click(object sender, RoutedEventArgs e)
 {
     using (IndividueelProjectEntities2 ctx = new IndividueelProjectEntities2())
     {
         ctx.Personeelslids.Add(new Personeelslid
         {
             Username = txtUserName.Text.ToString(),
             Password = txtPassword.Password.ToString(),
             Usertype = cmbUserType.SelectedItem.ToString()
         });
         ctx.SaveChanges();
     }
     //MessageBox.Show($"New user successfully created\n" +
     //    $"{txtUserName.Text}\n" +
     //    $"{txtPassword.Password.ToString()}\n" +
     //    $"{cmbUserType.SelectedItem.ToString()}");
     DialogResult = true;
 }