public R1Employee CreateTestEmployee(LubrizolData context, string firstName, string middleName, string lastName, string employeeId, string status = "Active")
        {
            var employee = context.Lubrizol_Employees.FirstOrDefault(x => x.EmployeeID == employeeId);

            if (employee != null)
            {
                DeleteTestEmployee(context, employeeId);
            }

            employee = new R1Employee
            {
                FirstName  = firstName,
                MiddleName = middleName,
                LastName   = lastName,
                EmployeeID = employeeId,
                Name       = string.Format("{0} {1}", firstName, lastName),
                Initials   = string.Format("{0}{1}{2}", string.IsNullOrWhiteSpace(firstName) ? "" : firstName.Substring(0, 1)
                                           , string.IsNullOrWhiteSpace(middleName) ? "" : middleName.Substring(0, 1)
                                           , string.IsNullOrWhiteSpace(lastName) ? "" : lastName.Substring(0, 1)),
                LastLoadDate       = DateTime.Now,
                LastUpdated        = DateTime.Now,
                EmployeeStatus     = status == "Active" ? 'A' : 'I',
                EmployeeStatusDesc = status,
                Division           = Guid.NewGuid().ToString()
            };

            context.Lubrizol_Employees.InsertOnSubmit(employee);
            context.SubmitChanges();

            return(employee);
        }
Exemple #2
0
 public virtual bool Filter(Config config, R1Employee employee, Person person)
 {
     return(config.EmployeeFilters.IsMatch(employee) && config.PersonFilters.IsMatch(person));
 }