private void btnSubmit_Click(object sender, RoutedEventArgs e) { string username = txtUsername.Text; string paswoord = txtPaswoord.Password; if (txtUsername.Text == "" || txtPaswoord.Password == "") { MessageBox.Show("Please fill in User name and Pasword "); } using (WareHouseBEntities cxt = new WareHouseBEntities()) { var checkPaswoord = cxt.Paswoords.Where(p => p.UserName == username && p.UserPaswoord == paswoord).Count(); if (checkPaswoord == 1) { Paswoord login = cxt.Paswoords.Where(p => p.UserName == username).FirstOrDefault(); MainMenu mainMenu = new MainMenu(); mainMenu.Show(); this.Close(); } else { MessageBox.Show("Not corect paswoord or username", "Error Box"); } } }
private void btnSaveChanges_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { cxt.SaveChanges(); } }
private void btnViewWorkers_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { var viewworkerquery = cxt.Leveranciers.Select(l => l); dtWorkers.ItemsSource = viewworkerquery.ToList(); } }
private void btnView_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { var viewquery = cxt.Klants.Select(k => k); dataKlanten.ItemsSource = viewquery.ToList(); } }
private void btnAdmin_Click(object sender, RoutedEventArgs e) { string username = txtUsername.Text; string paswoord = txtPaswoord.Password; using (WareHouseBEntities cxt = new WareHouseBEntities()) { var checkAdmin = cxt.Paswoords.Where(ap => ap.UserName == username && ap.UserPaswoord == paswoord && ap.UserId == 1).Count(); if (checkAdmin == 1) { Paswoord login = cxt.Paswoords.Where(p => p.UserName == username).FirstOrDefault(); AdminMenu adminMenu = new AdminMenu(); adminMenu.Show(); this.Close(); } else { MessageBox.Show("You are not administrator"); } } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { cxt.Klants.Add(new Klant() { Voornaam = txtVoornam.Text.Trim(), Achternaam = txtAChternaam.Text.Trim(), Straatnaam = txtStraatnaam.Text.Trim(), Huisnummer = Convert.ToInt32(txtHuisnummer.Text.Trim()), Postcode = Convert.ToInt32(txtPostcode.Text.Trim()), Gemeente = txtGemeente.Text.Trim(), Emaiadress = txtEmail.Text.Trim(), Telefoonnummer = Convert.ToInt32(txtTelefonnummer.Text.Trim()), AangemaaktOp = dtAangemaktop.SelectedDate, Opmerking = txtOpmerking.Text.Trim() }); cxt.SaveChanges(); } using (WareHouseBEntities cxt = new WareHouseBEntities()) { Random random = new Random(); for (int i = 0; i < 5; i++) { random.Next(); } int randompaswoord = random.Next(); cxt.Paswoords.Add(new Paswoord() { UserName = txtVoornam.Text + txtPostcode.Text, UserPaswoord = randompaswoord.ToString(), UserType = "Klant" }); MessageBox.Show($"Your user name is{txtVoornam.Text} and paswoord is {randompaswoord} "); cxt.SaveChanges(); } }
private void btnProductInfor_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { } }
private void Save_Click(object sender, RoutedEventArgs e) { using (WareHouseBEntities cxt = new WareHouseBEntities()) { } }