示例#1
0
        public IQueryable <ExtraWorkRecord> Search(ExtraWorkRecordSearchModel searchModel)
        {
            IQueryable <ExtraWorkRecord> q = this.context.ExtraWorkRecord;

            if (!string.IsNullOrEmpty(searchModel.staffNr))
            {
                q = q.Where(c => c.staffNr.Contains(searchModel.staffNr.Trim()));
            }

            if (!string.IsNullOrEmpty(searchModel.extraWorkTypeId))
            {
                q = q.Where(c => c.extraWorkTypeId.Equals(searchModel.extraWorkTypeId));
            }

            if (searchModel.durStart.HasValue)
            {
                q = q.Where(s => s.otTime >= searchModel.durStart.Value);
            }


            if (searchModel.durEnd.HasValue)
            {
                q = q.Where(s => s.otTime <= searchModel.durEnd.Value);
            }
            return(q.OrderByDescending(s => s.otTime));
        }
示例#2
0
        public ExtraWorkRecordInfoModel GetExtraWorkRecordInfo(ExtraWorkRecordSearchModel searchModel)
        {
            ExtraWorkRecordInfoModel info = new ExtraWorkRecordInfoModel();
            DataContext dc = new DataContext(this.DbString);
            IExtraWorkRecordRepository   rep     = new ExtraWorkRecordRepository(dc);
            IQueryable <ExtraWorkRecord> results = rep.Search(searchModel);

            info.extraWorkRecordCount = dc.Context.GetTable <ExtraWorkRecord>().Where(c => c.id.Equals(results.Count() > 0 ? results.First().id : -1)).Count();

            return(info);
        }
示例#3
0
        public ActionResult Search([Bind(Include = "staffNr,extraWorkTypeId,durStart,durEnd")] ExtraWorkRecordSearchModel q)
        {
            SetDropDownList(null);

            int pageIndex = 0;

            int.TryParse(Request.QueryString.Get("page"), out pageIndex);
            pageIndex = PagingHelper.GetPageIndex(pageIndex);

            IExtraWorkRecordService ss = new ExtraWorkRecordService(Settings.Default.db);

            IPagedList <ExtraWorkRecord> models = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize);

            ViewBag.Query = q;

            return(View("Index", models));
        }
示例#4
0
        public ActionResult Index(int?page)
        {
            SetDropDownList(null);

            int pageIndex = PagingHelper.GetPageIndex(page);

            ExtraWorkRecordSearchModel q = new ExtraWorkRecordSearchModel();

            IExtraWorkRecordService ss = new ExtraWorkRecordService(Settings.Default.db);

            IPagedList <ExtraWorkRecord> models = ss.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize);

            ViewBag.Query = q;

            ExtraWorkRecordInfoModel info = ss.GetExtraWorkRecordInfo(q);

            ViewBag.Info = info;

            return(View(models));
        }
示例#5
0
 public IQueryable <ExtraWorkRecord> Search(ExtraWorkRecordSearchModel searchModel)
 {
     return(rep.Search(searchModel));
 }