/// <summary>
 /// find current user that is logged in the application and get his email in order to fill the edit
 /// form with his old email
 /// </summary>
 private void PopulateEmailInput()
 {
     _credentialsService = new CredentialsService();
     _credentials        = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (_credentials != null)
     {
         textBoxUserEmail.Text = _credentials.Email;
     }
 }
 /// <summary>
 ///  Get user (identified by SessionData.UserSessionData.CurrentUserId) data from database using CredentialsService and PatientService 
 ///and display data on the page
 /// </summary>
 private void DisplayPatientInfo()
 {
     _credentialsService = new CredentialsService();
     Credentials credentials = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);
     _patientService = new PatientService();
     Patient patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (patient != null && credentials != null)
     {
         SetImages();
         labelPatientName.Content = patient.FirstName + " " + patient.LastName;
         labelPatientEmail.Content = credentials.Email;
         labelPatientPhone.Content = patient.PhoneNumber;
         labelPatientAddress.Content = patient.Address;
     }
 }
        /// <summary>
        ///  Get user (identified by SessionData.UserSessionData.CurrentUserId) data from database using CredentialsService and PatientService
        ///and display data on the page
        /// </summary>
        private void DisplayPatientInfo()
        {
            _credentialsService = new CredentialsService();
            Credentials credentials = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);

            _patientService = new PatientService();
            Patient patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId);

            if (patient != null && credentials != null)
            {
                SetImages();
                labelPatientName.Content    = patient.FirstName + " " + patient.LastName;
                labelPatientEmail.Content   = credentials.Email;
                labelPatientPhone.Content   = patient.PhoneNumber;
                labelPatientAddress.Content = patient.Address;
            }
        }
        /// <summary>
        ///Handler for helpButton click event,
        ///open help according to current user type
        /// </summary>
        private void helpButton_Click(object sender, RoutedEventArgs e)
        {
            int id = SessionData.UserSessionData.CurrentUserId;

            _credentialsService = new CredentialsService();
            Credentials c = _credentialsService.FindById(id);

            if (c != null)
            {
                switch (c.Type)
                {
                case Utils.UserTypes.ADMIN: System.Diagnostics.Process.Start(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) + "\\Resources\\helps\\AdminHelp.chm"); break;

                case Utils.UserTypes.PATIENT: System.Diagnostics.Process.Start(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) + "\\Resources\\helps\\PatientHelp.chm"); break;

                case Utils.UserTypes.DOCTOR: System.Diagnostics.Process.Start(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) + "\\Resources\\helps\\DoctorHelp.chm"); break;
                }
            }
        }
 /// <summary>
 /// find current user that is logged in the application and get his email in order to fill the edit
 /// form with his old email
 /// </summary>
 private void PopulateEmailInput()
 {
     _credentialsService = new CredentialsService();
     _credentials = _credentialsService.FindById(SessionData.UserSessionData.CurrentUserId);
     if (_credentials != null)
     {
         textBoxUserEmail.Text = _credentials.Email;
     }
 }