public ActionResult History(CheckStatus status = CheckStatus.All, int page = 1)
 {
     var filter = new DataBookFilter
     {
         Name = sAMAccountName,
         Status = status,
         Page = new Page(page)
     };
     ViewBag.List = Core.DataBookManager.Get(filter);
     ViewBag.Page = filter.Page;
     return View();
 }
 //审批历史
 public ActionResult CHistory(bool? Label, CheckStatus status = CheckStatus.All, string Name = null, string GroupName = null, int page = 1)
 {
     var filter = new DataBookFilter
     {
         Status = status,
         Checker = sAMAccountName,
         Name = Name,
         GroupName = GroupName,
         Label = Label,
         Page = new Page(page)
     };
     ViewBag.List = Core.DataBookManager.Get(filter);
     ViewBag.Page = filter.Page;
     var list = Core.DataBookManager.GetList(sAMAccountName);
     ViewBag.NList = list.GroupBy(e => e.Name).Select(e => e.Key).ToList();
     ViewBag.GList = list.GroupBy(e => e.GroupName).Select(e => e.Key).ToList();
     return View();
 }
        public List<DataBook> Get(DataBookFilter Filter)
        {
            using (var db = GetJURDataContext())
            {
                var query = db.DataBooks.AsQueryable();
                switch (Filter.Status)
                {
                    case CheckStatus.Agree:
                    case CheckStatus.Disagree:
                    case CheckStatus.Wait:
                        query = query.Where(e => e.Status == Filter.Status);
                        break;
                    case CheckStatus.All:
                    default:
                        break;
                }
                if (!string.IsNullOrEmpty(Filter.Name))
                {
                    query = query.Where(e => e.Name == Filter.Name);
                }
                if (!string.IsNullOrEmpty(Filter.Checker))
                {
                    query = query.Where(e => e.Checker == Filter.Checker);
                }
                if (!string.IsNullOrEmpty(Filter.GroupName))
                {
                    query = query.Where(e => e.GroupName == Filter.GroupName);
                }
                if (Filter.Label.HasValue)
                {
                    query = query.Where(e => e.Label == Filter.Label.Value);
                }

                if (Filter.Page != null)
                {
                    Filter.Page.RecordCount = query.Count();
                    query = query.OrderBy(e => e.ID).Skip(Filter.Page.PageSize * (Filter.Page.PageIndex - 1)).Take(Filter.Page.PageSize);
                }
                return query.ToList();
            }
        }