private void CreateManagerExecute() { try { CreateManager cm = new CreateManager(); cm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void AddManagerExecute() { try { CreateManager man = new CreateManager(); man.ShowDialog(); if ((man.DataContext as CreateManagerViewModel).isUpdated == true) { managerList = Service.Service.GetManagersList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void EditManagerExecute() { try { int managerId = manager.managerId; int userId = manager.userId; tblUser user = Service.Service.UserById(userId); tblClinicManager man = Service.Service.ManagerById(managerId); CreateManager create = new CreateManager(man, user); create.ShowDialog(); if ((create.DataContext as CreateManagerViewModel).isUpdated == true) { managerList = Service.Service.GetManagersList(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void LoginExecute() { try { if (Password == "WPFadmin" && Username == "WPFadmin") { CreateManager createManager = new CreateManager(); createManager.ShowDialog(); } List <String> UsernameList = new List <string>(); List <tblEmploye> EmployeList = context.tblEmployes.ToList(); foreach (tblEmploye item in EmployeList) { UsernameList.Add(item.Username); } List <string> PasswordList = new List <string>(); foreach (tblEmploye item in EmployeList) { PasswordList.Add(item.Pasword); } if (!PasswordList.Contains(Password) || !UsernameList.Contains(Username)) { MessageBox.Show("Username or password does not exist."); } else { tblEmploye employeID1 = (from r in context.tblEmployes where r.Pasword == Password select r).First(); tblEmploye employeID2 = (from r in context.tblEmployes where r.Username == Username select r).First(); if (employeID1.EmployeID != employeID2.EmployeID) { MessageBox.Show("Parametres exist but they are not matched."); } //ulogovan ali ne zna se ko je if (employeID1.EmployeID == employeID2.EmployeID) { List <int> employeInManagerList = new List <int>(); List <tblManager> managerList = context.tblManagers.ToList(); foreach (tblManager item in managerList) { employeInManagerList.Add(item.EmployeID.GetValueOrDefault()); } //menager loged in if (employeInManagerList.Contains(employeID1.EmployeID)) { tblManager manager = (from r in context.tblManagers where r.EmployeID == employeID1.EmployeID select r).First(); //modify mendager if (manager.LevelID == 1) { ModifyMenager ms = new ModifyMenager(); ms.ShowDialog(); } //readonly menager if (manager.LevelID == 2) { MessageBox.Show("ReadOnly manager"); } } //user if (!employeInManagerList.Contains(employeID1.EmployeID)) { MessageBox.Show("User"); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }