public void AdminSaveTest()
        {
            string lastName = GenString(_r.Next(4, 9));
            string firstName = GenString(_r.Next(4, 9));

            OpenConnection();

            Credentials c = new Credentials(lastName + firstName + "@testAdmin.com", Utils.Encrypter.GetMD5("0000"), Utils.UserTypes.ADMIN);
            Administrator a = new Administrator(credentialsService.Save(c), firstName, lastName);
            administratorService.Save(a);

            Assert.IsNotNull(administratorService.FindAllByProperty(Utils.AdminTableProperties.LastName, a.LastName));

            CloseConnection();
        }
        public void DoctorUpdateTest()
        {
            string lastName = GenString(_r.Next(4, 9));
            string firstName = GenString(_r.Next(4, 9));

            OpenConnection();

            Credentials c = new Credentials(lastName + firstName + "@testDoc.com", Utils.Encrypter.GetMD5("0000"), Utils.UserTypes.DOCTOR);
            Doctor d = new Doctor(credentialsService.Save(c), lastName, firstName, departmentService.FindAll()[0].Id, "85643213", Utils.DoctorStatus.ACTIVE);
            doctorService.Save(d);
            d.LastName = "Newman fon " + lastName;
            doctorService.Update(d);

            Assert.IsNotNull(doctorService.FindAllByProperty(Utils.DoctorTableProperties.LastName, d.LastName));

            CloseConnection();
        }
        public void PatientUpdateTest()
        {
            string lastName = GenString(_r.Next(4, 9));
            string firstName = GenString(_r.Next(4, 9));

            OpenConnection();

            Credentials c = new Credentials(lastName + firstName + "@testPatient.com", Utils.Encrypter.GetMD5("0000"), Utils.UserTypes.PATIENT);
            Patient p = new Patient(credentialsService.Save(c), lastName, firstName, "instsav363", "address", System.DateTime.Now, "geneticsDis", "54468413");
            patientService.Save(p);
            p.GeneticDiseases = "new genetics";
            patientService.Update(p);

            Assert.IsNotNull(patientService.FindAllByProperty(Utils.PatientTableProperties.GeneticDisorder, p.GeneticDiseases));

            CloseConnection();
        }
 /// <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;
     }
 }