public IList<ShiftData> GetShifts() { using (var context = new HumanResourceBoundedContext()) { return context.Shifts.AsNoTracking().Project().To<ShiftData>().ToList(); } }
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(); } }
public void GetFirstNamePeople() { using (var HRcontext = new HumanResourceBoundedContext()) { Assert.AreEqual(HRcontext.People.Find(16).FirstName, "David"); } }
public IList <ShiftData> GetShifts() { using (var context = new HumanResourceBoundedContext()) { return(context.Shifts.AsNoTracking().Project().To <ShiftData>().ToList()); } }
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; } }
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); } }
public void GetAdvWrks_DepartmentCount() { //Arrange var deptCount = 0; //Act using (var HRcontext = new HumanResourceBoundedContext()) { deptCount = HRcontext.Departments.Count(); } //Assert Assert.AreEqual(deptCount, 16); }
public void GetAdvWorks_EmployeesCount() { //Arrange var empCount = 0; //Act using (var HRcontext = new HumanResourceBoundedContext()) { empCount = HRcontext.Employees.Count(); } //Assert Assert.AreEqual(empCount, 290); }
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(); }
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(); }
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(); } }
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()); } }