public RegisterPatientViewModel(RegisterPatient open, tblClinicPatient p, tblUser user) { register = open; newUser = user; newPatient = p; isEditingWindow = true; }
public AdministratorViewModel(Administrator open) { administrator = open; maintenanceList = Service.Service.GetMaintenanceList(); doctorList = Service.Service.DoctorList(); patientList = Service.Service.PatientsList(); managerList = Service.Service.GetManagersList(); maintenance = new tblClinicMaintenance(); doctor = new tblClinicDoctor(); manager = new vwClinicManager(); patient = new tblClinicPatient(); }
private void SaveExecute(object obj) { try { string message = null; currentPassword = (obj as PasswordBox).Password; if (Model.Person.ValidPassword(currentPassword)) { newUser.password = currentPassword; tblUser u = Service.Service.AddUser(newUser); newPatient.userId = u.userId; tblClinicPatient p = Service.Service.AddPatient(newPatient); if (u != null && p != null) { if (isEditingWindow) { message = "Patient with id: " + p.patientId + " has been upadated."; } else { message = "Patient with id: " + p.patientId + " has been registered."; } isUpdated = true; MessageBox.Show(message); register.Close(); } } else { message = "Patient registration failed due to weak password"; MessageBox.Show("Pasword must contain at least 6charc including one upper, one lower, one numeric and one special char. Try again"); } LogIntoFile.getInstance().PrintActionIntoFile(message); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public RegisterPatientViewModel(RegisterPatient open) { register = open; newUser = new tblUser(); newPatient = new tblClinicPatient(); }
private void LoginExecute(object obj) { try { string content = null; person.password = (obj as PasswordBox).Password; tblUser user = Service.Service.GetUser(person.username, person.password); if (user == null) { if (person.isMaster()) { content = "Master has logged in"; Master master = new Master(); login.Close(); master.Show(); } else { content = "Unsuccessful login with username " + person.username + " and password " + person.password; MessageBox.Show("Invalid username or password.Try again"); } } else { if (Service.Service.isPatient(user) != null) { content = "Patient with username " + person.username + " has logged in."; tblClinicPatient patient = Service.Service.isPatient(user); Patient p = new Patient(); p.Show(); } else if (Service.Service.isDoctor(user) != null) { content = "Doctor with username " + person.username + " has logged in."; tblClinicDoctor doctor = Service.Service.isDoctor(user); Doctor d = new Doctor(); d.Show(); } else if (Service.Service.isManager(user) != null) { content = "Manager with username " + person.username + " has logged in."; tblClinicManager manager = Service.Service.isManager(user); Manager m = new Manager(); m.Show(); } else { tblClinicAdministrator admin = Service.Service.isAdministrator(user); Administrator a = new Administrator(); content = "Administrator has logged in."; if (Service.Service.InstituteExist()) { login.Close(); a.Show(); } else { CreateClinic create = new CreateClinic(admin); login.Close(); create.Show(); } } } LogIntoFile.getInstance().PrintActionIntoFile(content); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public RegisterPatient(tblClinicPatient patient, tblUser user) { InitializeComponent(); this.DataContext = new RegisterPatientViewModel(this, patient, user); }