public void Setup()
 {
     _validEmployee1 = ObjectMother.ValidEmployee("emp1").WithEntityId(1);
     _validEmployee2 = ObjectMother.ValidEmployee("emp2").WithEntityId(2);
     _selectedEmployees = new[] { _validEmployee2, _validEmployee2 };
     _selectedEntities = new[]{_validEmployee1,_validEmployee2};
     dto = new SelectBoxPickerDto{Selected = new[]{"1","2"}};
     _repo = MockRepository.GenerateMock<IRepository>();
     _repo.Expect(x => x.Find<Employee>(1)).Return(_validEmployee1);
     _repo.Expect(x => x.Find<Employee>(2)).Return(_validEmployee2);
     _selectBoxPickerService = new SelectBoxPickerService(_selectListItemService,_repo);
     _result = _selectBoxPickerService.GetListOfSelectedEntities<Employee>(dto);
 }
 public void Setup()
 {
     Bootstrapper.BootstrapTest();
     _systemClock = SystemClock.For(DateTime.Parse("1/1/2020 8:00 AM"));
     _employee = ObjectMother.ValidEmployee("Raif").WithEntityId(1);
     _task1 = ObjectMother.ValidTask("task1").WithEntityId(1);
     _task1.ScheduledStartTime = DateTime.Parse("1/2/2020 8:00 AM");
     _task2 = ObjectMother.ValidTask("task1").WithEntityId(2);
     _task2.ScheduledStartTime = DateTime.Parse("1/3/2020 8:00 AM");
     _task3 = ObjectMother.ValidTask("task1").WithEntityId(3);
     _task3.ScheduledStartTime = DateTime.Parse("1/1/2010 8:00 AM");
     _employee.AddTask(_task1);
     _employee.AddTask(_task2);
     _employee.AddTask(_task3);
     _SUT = new EmployeeHasNoOutstandingTasks(_systemClock);
     _ruleResult = _SUT.Execute(_employee);
 }
Beispiel #3
0
 public virtual void RemoveEmployee(Employee employee)
 {
     _employees.Remove(employee);
 }
Beispiel #4
0
 public virtual void AddEmployee(Employee employee)
 {
     if (!employee.IsNew() && _employees.Contains(employee)) return;
     _employees.Add(employee);
 }
Beispiel #5
0
        private void CreateEmployee()
        {
            _employee1 = new Employee()
            {
                EmployeeId = "123",
                EmployeeType = "Student",
                Address1 = "123 street",
                Address2 = "apt a",
                BirthDate = DateTime.Parse("1/5/1972"),
                City = "Austin",
                Email = "*****@*****.**",
                FirstName = "Raif",
                LastName = "Harik",
                LoginName = "*****@*****.**",
                Password = "******",
                PhoneHome = "123.123.1234",
                PhoneMobile = "123.123.1234",
                State = "Tx",
                ZipCode = "12345",
                Company = _company
            };

            _employee2 = new Employee()
            {
                EmployeeId = "1234",
                Address1 = "123 street",
                Address2 = "apt a",
                BirthDate = DateTime.Parse("1/5/1972"),
                City = "Austin",
                Email = "*****@*****.**",
                FirstName = "Amahl",
                LastName = "Harik",
                LoginName = "*****@*****.**",
                Password = "******",
                PhoneHome = "123.123.1234",
                PhoneMobile = "123.123.1234",
                State = "Tx",
                ZipCode = "12345",
                Company = _company
            };
            _repository.Save(_employee1);
            _repository.Save(_employee2);
        }
        public ActionResult Save(EmployeeViewModel input)
        {
            Employee employee;
            if (input.Employee.EntityId > 0)
            {
                employee = _repository.Find<Employee>(input.Employee.EntityId);
            }
            else
            {
                employee = new Employee();
                var companyId = _httpContextAbstractor.GetCompanyIdFromIdentity();
                var company = _repository.Find<Company>(companyId);
                employee.Company = company;
            }
            employee = mapToDomain(input, employee);

            if (input.DeleteImage)
            {
                _uploadedFileHandlerService.DeleteFile(employee.ImageUrl);
                employee.ImageUrl = string.Empty;
            }

            var serverDirectory = "/CustomerPhotos/" + _httpContextAbstractor.GetCompanyIdFromIdentity() + "/Employees";
            employee.ImageUrl = _uploadedFileHandlerService.GetUploadedFileUrl(serverDirectory, employee.FirstName+"_"+employee.LastName);
            var crudManager = _saveEntityService.ProcessSave(employee);

            crudManager = _uploadedFileHandlerService.SaveUploadedFile(serverDirectory, employee.FirstName + "_" + employee.LastName, crudManager);
            var notification = crudManager.Finish();
            return Json(notification,"text/plain");
        }
 private Employee mapToDomain(EmployeeViewModel model, Employee employee)
 {
     var employeeModel = model.Employee;
     employee.EmployeeId = employeeModel.EmployeeId;
     employee.Address1 = employeeModel.Address1;
     employee.Address2= employeeModel.Address2;
     employee.FirstName= employeeModel.FirstName;
     employee.LastName = employeeModel.LastName;
     employee.EmployeeType= employeeModel.EmployeeType;
     employee.EmergencyContact = employeeModel.EmergencyContact;
     employee.EmergencyContactPhone= employeeModel.EmergencyContactPhone;
     employee.Password = employeeModel.Password;
     employee.Email = employeeModel.Email;
     employee.LoginName = employeeModel.Email;
     employee.PhoneMobile = employeeModel.PhoneMobile;
     employee.City = employeeModel.City;
     employee.State = employeeModel.State;
     employee.ZipCode = employeeModel.ZipCode;
     employee.Status= employeeModel.Status;
     employee.Notes = employeeModel.Notes;
     employee.UserRoles = UserRole.Employee.ToString();//model.UserRoleSelectBoxPickerDto.Selected.Aggregate((i, j) => i + "," + j);
     return employee;
 }
 public void Setup()
 {
     _validEmployee1 = ObjectMother.ValidEmployee("emp1").WithEntityId(1);
     _validEmployee2 = ObjectMother.ValidEmployee("emp2").WithEntityId(2);
     _validEmployee3 = ObjectMother.ValidEmployee("emp3").WithEntityId(3);
     _validEmployee4 = ObjectMother.ValidEmployee("emp4").WithEntityId(4);
     _selectedEmployees = new []{_validEmployee3,_validEmployee4};
     _selectListItemService = MockRepository.GenerateMock<ISelectListItemService>();
     _availableSelectListItems = new[]
                                     {
                                         _selectListItem1,
                                         _selectListItem2,
                                         new SelectListItem {Text = "emp3", Value = "3"},
                                         new SelectListItem {Text = "emp4", Value = "4"}
                                     };
     _selectedSelectListItems = new[]
                                    {
                                        new SelectListItem {Text = "emp3", Value = "3"},
                                        new SelectListItem {Text = "emp4", Value = "4"}
                                    };
     _selectListItemService.Expect(x => x.CreateList<Employee>(null, null, false,true)).IgnoreArguments().Return(_availableSelectListItems);
     _selectListItemService.Expect(x => x.CreateList(_selectedEmployees, null, null, false)).IgnoreArguments().Return(_selectedSelectListItems);
     _selectBoxPickerService = new SelectBoxPickerService(_selectListItemService, null);
     _result = _selectBoxPickerService.GetPickerDto(_selectedEmployees,x=>x.FullName,x=>x.EntityId);
 }