コード例 #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());
     }
 }
コード例 #2
0
 public void QuitExecute()
 {
     try
     {
         PatientView patientView = new PatientView(UserAdmin);
         patientView.Show();
         addPatientView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #3
0
 public void GoToPatientExecute()
 {
     try
     {
         PatientView main = new PatientView(user);
         main.Show();
         administratorView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #4
0
        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());
            }
        }