private void SaveExecute(object obj) { try { string content = null; currentPassword = (obj as PasswordBox).Password; if (Model.Person.ValidPassword(currentPassword)) { newUser.password = currentPassword; tblUser u = Service.Service.AddUser(newUser); newAdministrator.userId = u.userId; tblClinicAdministrator a = Service.Service.AddAdministrator(newAdministrator); if (u != null && a != null) { content = "Administrator with username " + newUser.username + " has been registered."; Login login = new Login(); MessageBox.Show("Administrator has been registered."); master.Close(); login.Show(); } } else { content = "Administrator 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(content); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SaveExecute(object obj) { try { string content = null; tblInstitute previous = Service.Service.GetInstitute(); if (previous.numberOfAccessPointsForInvalids > editClinic.numberOfAccessPointsForInvalids || previous.numberOfAmbulanceAccessPoints > editClinic.numberOfAmbulanceAccessPoints) { MessageBox.Show("Access points can only be greater than previous ones."); content = "Unsuccessful update of clinic due to lower values of access pointes then previouse ones."; } else { //edit tblInstitute institute = Service.Service.AddInstitute(editClinic); if (institute != null) { content = "Clinic has been edited."; MessageBox.Show("Clinic has been edited."); clinic.Close(); } } LogIntoFile.getInstance().PrintActionIntoFile(content); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void DeletePatientExecute() { MessageBoxResult result = MessageBox.Show("Do you realy want to delete this Patient?", "Delete Patient", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string content = "Clinic Patient with id: " + patient.patientId + "has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); Service.Service.DeletePatient(Service.Service.PatientById(patient.patientId)); patientList = Service.Service.PatientsList(); } }
private void DeleteExecute() { MessageBoxResult result = MessageBox.Show("Do you realy want to delete this Maintenance?", "Delete Report", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string content = "Clinic Maintenance with id: " + maintenance.maintenanceId + "has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); Service.Service.DeleteMaintenance(maintenance); maintenanceList = Service.Service.GetMaintenanceList(); } }
private void DeleteDoctorExecute() { MessageBoxResult result = MessageBox.Show("Do you realy want to delete this Doctor?", "Delete Doctor", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string content = "Clinic Doctor with id: " + doctor.doctorId + "has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); Service.Service.DeleteDoctor(Service.Service.DoctorById(doctor.doctorId)); doctorList = Service.Service.DoctorList(); patientList = Service.Service.PatientsList(); } }
private void DeleteManagerExecute() { MessageBoxResult result = MessageBox.Show("Do you realy want to delete this Manager?", "Delete Manager", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { string content = "Clinic Manager with id: " + manager.managerId + "has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); Service.Service.DeleteManager(Service.Service.ManagerById(manager.managerId)); managerList = Service.Service.GetManagersList(); doctorList = Service.Service.DoctorList(); } }
private void LogOutExecute() { try { string content = "Administrator has logged out."; LogIntoFile.getInstance().PrintActionIntoFile(content); Login login = new Login(); administrator.Close(); login.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void DoWorkAdd(object sender, DoWorkEventArgs e) { string content = "Employee " + newEmployee.fullname + " with employeeId " + newEmployee.employeeId; if (isEditingWindow) { content += " has been updated."; } else { content += " has been added."; } LogIntoFile.getInstance().PrintActionIntoFile(content); }
public void DoWorkDelete(object sender, DoWorkEventArgs e) { vwEmployee emp = viewEmployee; string content = "Employee " + viewEmployee.fullname + " with employeeId " + viewEmployee.employeeId + " has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); //log update for every employee who's manager has ben deleted List <tblEmployee> managersEmployee = Service.Service.GetManagersEmployees(emp.employeeId); for (int i = 0; i < managersEmployee.Count; i++) { content = "Employee " + managersEmployee[i].fullname + " with employeeId " + managersEmployee[i].employeeId + " has been updated."; LogIntoFile.getInstance().PrintActionIntoFile(content); } }
private void SaveExecute(object obj) { try { string content = null; currentPassword = (obj as PasswordBox).Password; if (Model.Person.ValidPassword(currentPassword)) { newUser.password = currentPassword; tblUser u = Service.Service.AddUser(newUser); newDoctor.userId = u.userId; newDoctor.shift = selectedShift; if (selectedManager != null) { newDoctor.managerId = selectedManager.managerId; } tblClinicDoctor doc = Service.Service.AddDoctor(newDoctor); if (u != null && doc != null) { if (isEditingWindow) { content = "Doctor with id: " + doc.doctorId + " has been updated"; } else { content = "Doctor with id: " + doc.doctorId + "has been registered"; } MessageBox.Show(content); isUpdated = true; register.Close(); } } else { content = "Doctor 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(content); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
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()); } }
private void SaveExecute(object obj) { try { Queue <tblClinicMaintenance> queue = Service.Service.GetMaintenanceQueue(); string message; //just for adding new items if (!isEditingWindow) { message = "Clinic Maintenance has been added."; //if there is already 3 services, remove first one, then continue with adding if (queue != null && queue.Count == 3) { tblClinicMaintenance deleteThis = queue.Dequeue(); Service.Service.DeleteMaintenance(deleteThis); string content = "Clinic Maintenance id: " + deleteThis.maintenanceId + " has been deleted"; LogIntoFile.getInstance().PrintActionIntoFile(content); } } else { message = "Clinic Maintenance has been updated."; } tblClinicMaintenance maintenance = Service.Service.AddMaintenance(newMaintenance); if (maintenance != null) { MessageBox.Show(message); isUpdated = true; LogIntoFile.getInstance().PrintActionIntoFile(message + "Id: " + maintenance.maintenanceId); main.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SaveExecute(object obj) { try { //add new clinic tblInstitute institute = Service.Service.AddInstitute(newClinic); admininstrator.instituteId = institute.instituteId; //edit editClinic Service.Service.AddAdministrator(admininstrator); if (institute != null) { string content = "Clinic has been created"; LogIntoFile.getInstance().PrintActionIntoFile(content); Administrator a = new Administrator(); MessageBox.Show("Clinic has been created."); clinic.Close(); a.Show(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void DoWorkDelete(object sender, DoWorkEventArgs e) { string content = "Employee " + viewEmployee.fullname + " with employeeId " + viewEmployee.employeeId + " has been deleted."; LogIntoFile.getInstance().PrintActionIntoFile(content); }
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 void DoWorkMethod(object sender, DoWorkEventArgs e) { string content = "Manager " + newEmployee.firstname + " " + newEmployee.lastname + ", access: " + newEmployee.access + ", sector: " + newEmployee.sector + ", has been created"; LogIntoFile.getInstance().PrintActionIntoFile(content); }