public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; User.Password = password; User.GenderId = selectedGender.GenderId; User.RoleId = 1; try { if (service.AddClinicUser(User) != 0) { MessageBox.Show("You have successfully added new Clinic administrator"); Logging.LoggAction("MasterAminViewModel", "Info", "Succesfull added new Administrator"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logging.LoggAction("MasterAminViewModel", "Error", ex.ToString()); } User = new ClinicUser(); masterAdminView.txtAdminPassword.Password = ""; User.DateOfBirth = DateTime.Now; }
public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; User.Password = password; User.GenderId = selectedGender.GenderId; User.RoleId = 2; try { int userId = service.AddClinicUser(User); if (userId != 0) { UserMaintainance.ClinicUserId = userId; if (service.AddNewMaintainance(UserMaintainance) != 0) { service.ChackNumberOfMaintainanc(); } MessageBox.Show("You have successfully added new maintainance"); Logging.LoggAction("AddMaintainanceViewModel", "Info", "Succesfull added new doctor"); MaintainancView maintainanceView = new MaintainancView(AdminUser); maintainanceView.Show(); addMaintainanceView.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logging.LoggAction("AddDoctorViewModel", "Error", ex.ToString()); } }
public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; User.Password = password; User.GenderId = SelectedGender.GenderId; User.RoleId = 3; try { int userId = service.AddClinicUser(User); if (userId != 0) { UserManager.ClinicUserId = userId; UserManager.ClinicFloor = SelectedFloor; if (service.AddNewManager(UserManager) != 0) { MessageBox.Show("You have successfully added new manager"); Logging.LoggAction("AddManagerViewModel", "Info", "Succesfull added new manager"); ManagerView managerView = new ManagerView(UserAdmin); managerView.Show(); addManagerView.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logging.LoggAction("AddManagerViewModel", "Error", ex.ToString()); } }
public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; User.Password = password; User.GenderId = selectedGender.GenderId; User.RoleId = 5; try { bool uniqueInsuranceNumber = service.CheckInsuranceNumber(UserPatient.InsuranceNumber); int drUniqueNumber = service.GetDoctorUniqueNumberByDoctorId(selectDoctor.ClinicUserId); if (uniqueInsuranceNumber) { int userId = service.AddClinicUser(User); if (userId != 0) { UserPatient.ClinicUserId = userId; UserPatient.UniqueDoctorNumber = drUniqueNumber; if (service.AddNewPatient(UserPatient) != 0) { MessageBox.Show("You have successfully added new patient"); Logging.LoggAction("AddPatientViewModel", "Info", "Succesfull added new doctor"); PatientView patientView = new PatientView(UserAdmin); patientView.Show(); addPatientView.Close(); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logging.LoggAction("AddDoctorViewModel", "Error", ex.ToString()); } }
public void SaveExecute(object parametar) { var passwordBox = parametar as PasswordBox; var password = passwordBox.Password; User.Password = password; User.GenderId = selectedGender.GenderId; User.RoleId = 4; try { if (User.ClinicUserId == 0) { bool uniqueNumber = service.CheckUniqueNumber(UserDoctor.UniqueNumber); bool uniqueBancAccount = service.CheckBancAccount(UserDoctor.BancAccount); if (uniqueNumber && uniqueBancAccount) { int userId = service.AddClinicUser(User); if (userId != 0) { UserDoctor.ClinicUserId = userId; UserDoctor.DepartmentId = selectedDepartment.DepartmentId; UserDoctor.WorkShiftId = selectedWorkShift.WorkShiftId; UserDoctor.ClinicManagerId = selectedManager.ClinicManagerId; if (service.AddNewDoctor(UserDoctor) != 0) { MessageBox.Show("You have successfully added new doctor"); Logging.LoggAction("AddDoctorViewModel", "Info", "Succesfull added new doctor"); DoctorView doctorView = new DoctorView(UserAdmin); doctorView.Show(); addDoctorView.Close(); } } } } else { int userId = service.AddClinicUser(User); if (userId != 0) { UserDoctor.ClinicUserId = userId; UserDoctor.DepartmentId = selectedDepartment.DepartmentId; UserDoctor.WorkShiftId = selectedWorkShift.WorkShiftId; UserDoctor.ClinicManagerId = selectedManager.ClinicManagerId; if (service.AddNewDoctor(UserDoctor) != 0) { MessageBox.Show("You have successfully added new doctor"); Logging.LoggAction("AddDoctorViewModel", "Info", "Succesfull added new doctor"); DoctorView doctorView = new DoctorView(UserAdmin); doctorView.Show(); addDoctorView.Close(); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logging.LoggAction("AddDoctorViewModel", "Error", ex.ToString()); } }