コード例 #1
0
ファイル: StaffController.cs プロジェクト: wpmyj/BlueHr
        private void SetStaffTypeList(int?type, bool allowBlank = true)
        {
            IStaffTypeService sts = new StaffTypeService(Settings.Default.db);

            StaffTypeSearchModel stsm = new StaffTypeSearchModel();

            List <StaffType> st = sts.Search(stsm).ToList();

            List <SelectListItem> select = new List <SelectListItem>();

            if (allowBlank)
            {
                select.Add(new SelectListItem {
                    Text = "", Value = ""
                });
            }

            foreach (var it in st)
            {
                if (type.HasValue && type.ToString().Equals(it.id))
                {
                    select.Add(new SelectListItem {
                        Text = it.name, Value = it.id.ToString(), Selected = true
                    });
                }
                else
                {
                    select.Add(new SelectListItem {
                        Text = it.name, Value = it.id.ToString(), Selected = false
                    });
                }
            }
            ViewData["staffTypeList"] = select;
        }
コード例 #2
0
ファイル: StaffTypeService.cs プロジェクト: wpmyj/BlueHr
        public IQueryable <StaffType> Search(StaffTypeSearchModel searchModel)
        {
            DataContext          dc           = new DataContext(this.DbString);
            IStaffTypeRepository staffTypeRep = new StaffTypeRepository(dc);

            return(staffTypeRep.Search(searchModel));
        }
コード例 #3
0
ファイル: StaffTypeRepository.cs プロジェクト: wpmyj/BlueHr
        public IQueryable <StaffType> Search(StaffTypeSearchModel searchModel)
        {
            IQueryable <StaffType> stafftypes = this.context.StaffType;

            if (!string.IsNullOrEmpty(searchModel.Name))
            {
                stafftypes = stafftypes.Where(c => c.name.Contains(searchModel.Name.Trim()));
            }
            return(stafftypes);
        }
コード例 #4
0
ファイル: StaffTypeService.cs プロジェクト: wpmyj/BlueHr
        public StaffTypeInfoModel GetStaffTypeInfo(StaffTypeSearchModel searchModel)
        {
            StaffTypeInfoModel     info         = new StaffTypeInfoModel();
            DataContext            dc           = new DataContext(this.DbString);
            IStaffTypeRepository   staffTypeRep = new StaffTypeRepository(dc);
            IQueryable <StaffType> staffTypes   = staffTypeRep.Search(searchModel);

            info.staffTypeCount = dc.Context.GetTable <JobTitle>().Where(c => c.id.Equals(staffTypes.Count() > 0 ? staffTypes.First().id : -1)).Count();

            return(info);
        }
コード例 #5
0
ファイル: StaffTypeController.cs プロジェクト: wpmyj/BlueHr
        public ActionResult Search([Bind(Include = "Name")] StaffTypeSearchModel q)
        {
            int pageIndex = 0;

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

            IStaffTypeService ss = new StaffTypeService(Settings.Default.db);

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

            ViewBag.Query = q;

            return(View("Index", staffTypes));
        }
コード例 #6
0
ファイル: StaffTypeController.cs プロジェクト: wpmyj/BlueHr
        public ActionResult Index(int?page)
        {
            int pageIndex = PagingHelper.GetPageIndex(page);

            StaffTypeSearchModel q = new StaffTypeSearchModel();

            IStaffTypeService ss = new StaffTypeService(Settings.Default.db);

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

            ViewBag.Query = q;

            StaffTypeInfoModel info = ss.GetStaffTypeInfo(q);

            ViewBag.Info = info;

            return(View(staffTypes));
        }