Example #1
0
 private void SignInCommandExecute(object obj)
 {
     try
     {
         string password = (obj as PasswordBox).Password;
         doctor  = dataBaseService.FindDoctorCredentials(UserName, password);
         patient = dataBaseService.FindPatientCredentials(UserName, password);
         if (doctor != null)
         {
             DoctorView doctorView = new DoctorView(doctor);
             login.Close();
             doctorView.Show();
             return;
         }
         else if (patient != null)
         {
             PatientView patientView = new PatientView(patient);
             login.Close();
             patientView.Show();
             return;
         }
         else
         {
             MessageBox.Show("Wrong usename or password");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public void QuitExecute()
 {
     try
     {
         DoctorView doctorView = new DoctorView(UserAdmin);
         doctorView.Show();
         addDoctorView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #3
0
 public void GoToDoctorExecute()
 {
     try
     {
         DoctorView main = new DoctorView(user);
         main.Show();
         administratorView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(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());
            }
        }