Beispiel #1
0
        //
        // GET: /Employees/List?terms=Mar
        public JsonNetResult List(EmployeeSearchParameters searchParameters)
        {
            var query   = new SearchEmployees(searchParameters);
            var results = Query(query);

            return(Json(new
            {
                Items = results,
                Skipped = searchParameters.Skip,
                TotalResults = query.Stats.TotalResults
            }));
        }
Beispiel #2
0
        //
        // GET: /Employees/
        public ViewResult Index(EmployeeSearchParameters searchParameters)
        {
            AttachmentSlot[] slotsToShow = Query(new AttachmentSlotsQuery <Employee>());
            log.Dump(LogLevel.Debug, slotsToShow, "attachmentSlots");
            ScriptManager.RegisterGlobalJavascript(
                "ViewData",
                new
            {
                attachmentSlots = slotsToShow
            },
                500);

            return(View(searchParameters));
        }
        public async Task <IEnumerable <Employee> > GetEmployeesAsync(EmployeeSearchParameters parameters)
        {
            var employees = context.Employees as IQueryable <Employee>;

            if (!string.IsNullOrWhiteSpace(parameters.GenderDisplay))
            {
                var gender = Enum.Parse <Gender>(parameters.GenderDisplay.Trim());
                employees = employees.Where(e => e.Gender == gender);
            }
            if (!string.IsNullOrWhiteSpace(parameters.EmployeeNo))
            {
                employees = employees.Where(e => e.EmployeeNo.Contains(parameters.EmployeeNo));
            }
            if (!string.IsNullOrWhiteSpace(parameters.Name))
            {
                employees = employees.Where(e => e.Name.Contains(parameters.Name));
            }
            //TODO:添加其它查询条件
            return(await employees
                   .OrderBy(e => e.DepartmentId).OrderBy(e => e.EmployeeNo)
                   .ToListAsync());
        }
        //
        // GET: /Employees/
        public ViewResult Index(EmployeeSearchParameters searchParameters)
        {
            AttachmentSlot[] slotsToShow = Query(new AttachmentSlotsQuery<Employee>());
            log.Dump(LogLevel.Debug, slotsToShow, "attachmentSlots");
            ScriptManager.RegisterGlobalJavascript(
                "ViewData",
                new
                {
                    attachmentSlots = slotsToShow
                },
                500);

            return View(searchParameters);
        }
 //
 // GET: /Employees/List?terms=Mar
 public JsonNetResult List(EmployeeSearchParameters searchParameters)
 {
     var query = new SearchEmployees(searchParameters);
     var results = Query(query);
     return Json(new
     {
         Items = results,
         Skipped = searchParameters.Skip,
         TotalResults = query.Stats.TotalResults
     });
 }