public IList<ShiftData> GetShifts()
 {
     using (var context = new HumanResourceBoundedContext())
     {
         return context.Shifts.AsNoTracking().Project().To<ShiftData>().ToList();
     }
 }
Exemplo n.º 2
0
 public IList <DepartmentData> GetDepartments()
 {
     using (var context = new HumanResourceBoundedContext())
     {
         return(context.Departments.AsNoTracking().Project().To <DepartmentData>().ToList());
     }
 }
 public IList<DepartmentData> GetDepartments()
 {
     using (var context = new HumanResourceBoundedContext())
     {
         return context.Departments.AsNoTracking().Project().To<DepartmentData>().ToList();
     }
 }
Exemplo n.º 4
0
 public void GetFirstNamePeople()
 {
     using (var HRcontext = new HumanResourceBoundedContext())
     {
         Assert.AreEqual(HRcontext.People.Find(16).FirstName, "David");
     }
 }
Exemplo n.º 5
0
 public IList <ShiftData> GetShifts()
 {
     using (var context = new HumanResourceBoundedContext())
     {
         return(context.Shifts.AsNoTracking().Project().To <ShiftData>().ToList());
     }
 }
Exemplo n.º 6
0
 public void GetFirstNamePeople()
 {
     using (var HRcontext = new HumanResourceBoundedContext())
     {
         Assert.AreEqual(HRcontext.People.Find(16).FirstName, "David");
     }
 }
        public EmployeeData GetEmployeeWithDepartment(int businessId)
        {
            using (var context = new HumanResourceBoundedContext())
            {
                var linqQuery = context.Employees.Include(n => n.Person)
                    .Include(n => n.EmployeeDepartmentHistories)
                    .Where(e => e.BusinessEntityID == businessId)
                    .Project().To<EmployeeData>().SingleOrDefault();

                return linqQuery;
            }
        }
Exemplo n.º 8
0
        public EmployeeData GetEmployeeWithDepartment(int businessId)
        {
            using (var context = new HumanResourceBoundedContext())
            {
                var linqQuery = context.Employees.Include(n => n.Person)
                                .Include(n => n.EmployeeDepartmentHistories)
                                .Where(e => e.BusinessEntityID == businessId)
                                .Project().To <EmployeeData>().SingleOrDefault();

                return(linqQuery);
            }
        }
Exemplo n.º 9
0
 public void GetAdvWrks_DepartmentCount()
 {
     //Arrange
     var deptCount = 0;
     //Act
     using (var HRcontext = new HumanResourceBoundedContext())
     {
         deptCount = HRcontext.Departments.Count();
     }
     //Assert
     Assert.AreEqual(deptCount, 16);
 }
Exemplo n.º 10
0
        public void GetAdvWrks_DepartmentCount()
        {
            //Arrange
            var deptCount = 0;

            //Act
            using (var HRcontext = new HumanResourceBoundedContext())
            {
                deptCount = HRcontext.Departments.Count();
            }
            //Assert
            Assert.AreEqual(deptCount, 16);
        }
Exemplo n.º 11
0
        public void GetAdvWorks_EmployeesCount()
        {
            //Arrange
            var empCount = 0;
            //Act
            using (var HRcontext = new HumanResourceBoundedContext())
            {
                empCount = HRcontext.Employees.Count();
            }
            //Assert

            Assert.AreEqual(empCount, 290);
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            //ObjMappingConfiguration.Configure();
            // IEveryLogger _logger = new EveryLogger();
            //_logger.Log(GlobalType.GlobalInformational, "Hello World");
            //_logger.Log(GlobalType.GlobalError, "This is an ERROR !!");
            //_logger.Log(GlobalType.GlobalWarning, "Hello World, This a WARNING");

            //Mapper.CreateMap<byte, int>().ConvertUsing(new ByteToIntMapConverter());
            //Mapper.CreateMap<Shift, ShiftData>()
            //    .ForMember(sfData => sfData.Id, map => map.MapFrom(p => p.ShiftID));

            //using (var context = new HumanResourceBoundedContext())
            //{
            //    var test = context.Shifts.Project().To<ShiftData>().ToList();

            //    foreach (var item in test)
            //    {
            //        Console.WriteLine(item.Name + " " + item.StartTime);
            //    }
            //}

            using (var context = new HumanResourceBoundedContext())
            {

                var linqQuery = context.Employees.Include(n => n.Person)
                    .Include(n => n.EmployeeDepartmentHistories);

                int page = 1;
                int pageSize = 10;

                if (page > 0 && pageSize > 0)
                {
                    linqQuery = linqQuery.OrderBy(n => n.BusinessEntityID).Skip(page - 1).Take(pageSize);
                }

                //var companyList = context.Employees.AsNoTracking()
                //    .Include(n => n.EmployeeDepartmentHistories)
                //    .Where(e => e.BusinessEntityID == 16).Project().To<EmployeeData>().ToList();

                var companList = linqQuery.Project().To<EmployeeData>().ToList();

                foreach (var item in companList)
                {
                    Console.WriteLine(string.Format("{0}, {1}", item.FullName, item.DepartmentHistory.Count));
                }

            }

            Console.ReadLine();
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            //ObjMappingConfiguration.Configure();
            // IEveryLogger _logger = new EveryLogger();
            //_logger.Log(GlobalType.GlobalInformational, "Hello World");
            //_logger.Log(GlobalType.GlobalError, "This is an ERROR !!");
            //_logger.Log(GlobalType.GlobalWarning, "Hello World, This a WARNING");

            //Mapper.CreateMap<byte, int>().ConvertUsing(new ByteToIntMapConverter());
            //Mapper.CreateMap<Shift, ShiftData>()
            //    .ForMember(sfData => sfData.Id, map => map.MapFrom(p => p.ShiftID));

            //using (var context = new HumanResourceBoundedContext())
            //{
            //    var test = context.Shifts.Project().To<ShiftData>().ToList();

            //    foreach (var item in test)
            //    {
            //        Console.WriteLine(item.Name + " " + item.StartTime);
            //    }
            //}

            using (var context = new HumanResourceBoundedContext())
            {
                var linqQuery = context.Employees.Include(n => n.Person)
                                .Include(n => n.EmployeeDepartmentHistories);


                int page     = 1;
                int pageSize = 10;

                if (page > 0 && pageSize > 0)
                {
                    linqQuery = linqQuery.OrderBy(n => n.BusinessEntityID).Skip(page - 1).Take(pageSize);
                }

                //var companyList = context.Employees.AsNoTracking()
                //    .Include(n => n.EmployeeDepartmentHistories)
                //    .Where(e => e.BusinessEntityID == 16).Project().To<EmployeeData>().ToList();

                var companList = linqQuery.Project().To <EmployeeData>().ToList();

                foreach (var item in companList)
                {
                    Console.WriteLine(string.Format("{0}, {1}", item.FullName, item.DepartmentHistory.Count));
                }
            }


            Console.ReadLine();
        }
Exemplo n.º 14
0
        public void GetAdvWorks_EmployeesCount()
        {
            //Arrange
            var empCount = 0;

            //Act
            using (var HRcontext = new HumanResourceBoundedContext())
            {
                empCount = HRcontext.Employees.Count();
            }
            //Assert

            Assert.AreEqual(empCount, 290);
        }
        public IList<EmployeeData> GetEmployees(string query, int page, int pageSize)
        {
            using (var context = new HumanResourceBoundedContext())
            {
                //#if DEBUG
                //context.Database.Log = message => File.AppendText("C:\\mylog.txt").WriteLine(message);
                //#endif
                var linqQuery = context.Employees.Include(n => n.Person);

                if (!string.IsNullOrEmpty(query))
                {
                    linqQuery = linqQuery.Where(n => n.Person.FirstName.Contains(query));
                }
                if (page > 0 && pageSize > 0)
                {
                    linqQuery = linqQuery.OrderBy(n => n.BusinessEntityID).Skip(page - 1).Take(pageSize);
                }

                return linqQuery.Project().To<EmployeeData>().ToList();
            }
        }
Exemplo n.º 16
0
        public IList <EmployeeData> GetEmployees(string query, int page, int pageSize)
        {
            using (var context = new HumanResourceBoundedContext())
            {
                //#if DEBUG
                //context.Database.Log = message => File.AppendText("C:\\mylog.txt").WriteLine(message);
                //#endif
                var linqQuery = context.Employees.Include(n => n.Person);

                if (!string.IsNullOrEmpty(query))
                {
                    linqQuery = linqQuery.Where(n => n.Person.FirstName.Contains(query));
                }
                if (page > 0 && pageSize > 0)
                {
                    linqQuery = linqQuery.OrderBy(n => n.BusinessEntityID).Skip(page - 1).Take(pageSize);
                }

                return(linqQuery.Project().To <EmployeeData>().ToList());
            }
        }