private void Button_Click(object sender, RoutedEventArgs e) { WSREntities db = new WSREntities(); addclothtostock acs = new addclothtostock(); acs.ShowDialog(); }
public Entrance() { InitializeComponent(); WSREntities db = new WSREntities(); var data = from r in db.ClothStock select r; datagridClothStock.ItemsSource = data.ToList(); }
private void btnReg_Click(object sender, RoutedEventArgs e) { using (WSREntities db = new WSREntities()) { if (txtPassword.Text == txtConfirm.Text) { Users usr = new Users { username = txtUsername.Text, password = txtPassword.Text, role = txtRole.Text }; db.Users.Add(usr); db.SaveChanges(); MessageBox.Show("Успешно!!!"); Close(); } else { MessageBox.Show("Пароли не совпадают!!!"); } } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { WSREntities db = new WSREntities(); foreach (var users in db.Users) { if (users.username == txtUsername.Text.Trim() && users.password == txtPassword.Text.Trim()) { switch (users.role) { case "Director": Director dr = new Director(); this.Hide(); dr.Show(); break; case "Client": Client cl = new Client(); this.Hide(); cl.Show(); break; case "Manager": Manager mgr = new Manager(); this.Hide(); mgr.Show(); break; case "Storekeeper": Storekeeper strkpr = new Storekeeper(); this.Hide(); strkpr.Show(); break; } } } }