Beispiel #1
0
        // GET: /HumanResources/HRStaff/
        public ActionResult Index(int? page, int? pageSize)
        {
            StackTrace st = new StackTrace();
            StackFrame sf = st.GetFrame(0);

            MethodBase mb = sf.GetMethod();

            try
            {
                StaffFilterClauseModel m = this.StaffClause;
                DynamicStaffClause c = new DynamicStaffClause(m);
                List<HRStaffRecord> ss = c.Execute();

                ViewBag.Total = ss.Count().ToString();

                if (page == null)
                    page = 1;

                if (pageSize == null)
                    pageSize = 12;

                PagedList<HRStaffRecord> pl = new PagedList<HRStaffRecord>(ss, page.Value, pageSize.Value);

                return View(pl);
            }
            catch (Exception ex)
            {
                AnvilExceptionModel em = new AnvilExceptionModel(ex, "Get Staff Records", "Public", "Home", "Index");
                return View("Error", em);
            }
        }
        public void Refresh()
        {
            this.Clear();

            try
            {
                List<StaffFilterClause> _clauses = DbContext.StaffFilterClauses
                    .Where(x => x.FilterId.Equals(FilterId))
                    .OrderBy(x => x.SortIndex)
                    .ToList();

                int count = _clauses.Count();

                foreach (StaffFilterClause c in _clauses)
                {
                    DynamicStaffClause dsc = new DynamicStaffClause(c);
                    Add(dsc);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Could not get staff clauses from the database", ex);
            }
        }