private void DoNewWorkerView(object obj) { WorkerViewModel wvm = new WorkerViewModel(null); wvm.AddWorkerEvent += MainModel.AddWorker; WorkerView wView = new WorkerView { DataContext = wvm }; wView.ShowDialog(); }
private void DoOpenWorkerView(object obj) { if (obj == null) { return; } WorkerViewModel wvm = new WorkerViewModel((WorkerModel)obj); wvm.UpdateWorkerEvent += MainModel.UpdateWorker; WorkerView wView = new WorkerView { DataContext = wvm }; wView.ShowDialog(); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { if (txtUsername.Text == "WPFMaster" && txtPassword.Password == "WPFAccess") { _logged = true; MasterView view = new MasterView(); view.Show(); } else { try { using (CompanyDBEntities db = new CompanyDBEntities()) { foreach (tblUser user in db.tblUsers) { if (user.Username == txtUsername.Text && user.UserPassword == txtPassword.Password) { foreach (tblAdmin admin in db.tblAdmins) { if (admin.UserID == user.UserID) { AdminView view = new AdminView(); view.ShowDialog(); _logged = true; return; } } foreach (tblManager manager in db.tblManagers) { if (manager.UserID == user.UserID) { ManagerView view = new ManagerView(); view.ShowDialog(); _logged = true; return; } } foreach (tblWorker worker in db.tblWorkers) { if (worker.UserID == user.UserID) { WorkerView view = new WorkerView(); view.ShowDialog(); _logged = true; return; } } } } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } if (_logged == false) { MessageBox.Show("Username or Password Incorrect."); } }