Example #1
0
        public async Task <ActionResult> List()
        {
            DateTime work_date = CommonHelper.GetDateTime(Request["work_date"]);
            string   employee  = CommonHelper.GetValue(Request["employee"]);

            int    pgnum      = string.IsNullOrEmpty(Request["pgnum"]) ? 1 : Convert.ToInt32(Request["pgnum"]);
            int    pgsize     = string.IsNullOrEmpty(Request["pgsize"]) ? 0 : Convert.ToInt32(Request["pgsize"]);
            string sortcolumn = string.IsNullOrEmpty(Request["sortcolumn"]) ? EmployeeHelper.DEFAULT_SORT_COLUMN : Request["sortcolumn"];
            string sortdir    = string.IsNullOrEmpty(Request["sortdir"]) ? EmployeeHelper.DEFAULT_SORT_DIR : Request["sortdir"];

            Sort sort = new Sort(sortcolumn, sortdir);

            Dictionary <string, object> filters = new Dictionary <string, object>
            {
                { "work_date", work_date },
                { "employee", employee }
            };

            ListModel <Attendance> l = null;

            if (work_date == default(DateTime) && string.IsNullOrEmpty(employee))
            {
                l = await AttendanceHelper.GetAll(pgnum, pgsize, sort);
            }

            else
            {
                l = await AttendanceHelper.GetFilterBy(filters, pgnum, pgsize, sort);
            }

            return(View("_list", l));
        }
Example #2
0
        //
        // GET: /Admin/Attendance/

        public async Task <ActionResult> Index()
        {
            ListModel <Attendance> l = null;

            l = await AttendanceHelper.GetAll();

            return(View(l));
        }