示例#1
0
        public void SeedDB()
        {
            using (var db = new LiteDatabase(Constants.DB_NAME))
            {
                //clean up
                IEnumerable <string> collectionNames = db.GetCollectionNames().ToList();
                foreach (string collectionName in collectionNames)
                {
                    db.DropCollection(collectionName);
                }
            }

            //setup test data
            Employee nextMgr = new Employee()
            {
                Id = Guid.Empty
            };

            for (int i = 0; i < 99; i++)
            {
                FakeName fname                = GetAName();
                DateTime onboardDate          = DateTime.Now.AddMonths(random.Next(-100, -12));
                DateTime recentPerfReviewDate = new DateTime(DateTime.Now.Year - 1, onboardDate.Month, 1);
                Employee theNextMgr           = EmployeeFactory.CreateEmployee(fname.FirstName, fname.LastName, (Gender)GetValue(genders), fname.Email, nextMgr, (Title)GetValue(titles), (Level)GetValue(levels), random.Next(50000, 200000), random.Next(0, 10000), onboardDate);
                HistoryFactory.CreateHistory(theNextMgr, nextMgr, (Title)GetValue(titles), (Level)GetValue(levels), random.Next(50000, 200000), random.Next(0, 10000), ActionType.ANNUAL_PERFORMANCE_REVIEW, recentPerfReviewDate);
                nextMgr = theNextMgr;
            }
        }
示例#2
0
        public void CreateEmployeeHistory(Guid employeeId, Guid managerId, Title title, Level level, Decimal salary, Decimal bonus, ActionType action, DateTime date)
        {
            LiteCollection <Employee> employees = PersistenceStore.Current.GetEmployeeStore();
            var employee = employees.FindById(employeeId);
            var manager  = managerId == Guid.Empty ? new Employee()
            {
                Id = Guid.Empty
            } : employees.FindById(managerId);

            HistoryFactory.CreateHistory(employee, manager, title, level, salary, bonus, action, date);
        }