Пример #1
0
 public EmployeeForm(Employee employee)
 {
     this.Employee = employee;
     creatingEmployee = false;
     InitializeComponent();
     Init();
 }
Пример #2
0
        public void Employee_ShouldNotValidateIfPasswordEmpty()
        {
            //Arrange
            var employee = new Employee()
            {
                Login = "******",
                Name = "Andrzej",
                Surname = "Kowalski",
            };

            //Act
            var errorCount = 0;
            foreach (var error in employee.Validate())
                errorCount++;
            //Assert
            Assert.AreEqual(errorCount, 1);

            //Arrange
            employee.Password = Security.CalculateMD5Hash("");
            //Act
            errorCount = 0;
            foreach (var error in employee.Validate())
                errorCount++;
            //Assert
            Assert.AreEqual(errorCount, 1);
        }
Пример #3
0
        public void Employee_ShouldNotValidateIfLoginEmpty()
        {
            //Arrange
            var employee = new Employee()
                {
                    Name = "Andrzej",
                    Surname = "Kowalski",
                    Password = "******"
                };

            //Act
            var errorCount = 0;
            foreach (var error in employee.Validate())
                errorCount++;
            //Assert
            Assert.AreEqual(errorCount,1);
        }
Пример #4
0
 private void Zarzadzanie_UpdateEmployee(Employee employee)
 {
     try
     {
         UnitOfWork.EmployeeRepository.Update(employee);
         UnitOfWork.SaveChanges();
     }
     catch (Exception xcp)
     {
         MessageBox.Show(xcp.Message);
     }
 }
Пример #5
0
        private void Zarzadzanie_AddEmployee(Employee employee)
        {
            try
            {
                var activePharmacy = UnitOfWork.PharmacyRepository.GetPharmacyById(AptekaGlobals.ActivePharmacyId);
                activePharmacy.Employees.Add(employee);
                UnitOfWork.SaveChanges();

            }
            catch (Exception xcp)
            {
                MessageBox.Show(xcp.Message);
            }
        }
Пример #6
0
 public EmployeeForm()
 {
     Employee = new Employee();
     InitializeComponent();
     Init();
 }