コード例 #1
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, ListFilterParam list, string filter = "")
        {
            if (Global.CurrentUser.OfficePositionID == 250 || Global.CurrentUser.OfficePositionID == 251 ||
                Global.CurrentUser.OfficePositionID == 252 || Global.CurrentUser.OfficePositionID == 253 ||
                Global.CurrentUser.OfficePositionID == 254 || Global.CurrentUser.RoleId == 1 ||
                Global.CurrentUser.RoleId == 11)
            {
                list.filter7 = list.filter7;
            }
            else
            {
                list.filter7 = "2";
            }

            filter = filter + (!String.IsNullOrEmpty(list.filter11) ? (!String.IsNullOrEmpty(filter.Trim()) ? " AND " : "") + " OrganizationUnitName LIKE N'%" + list.filter11 + "%'" : "");
            filter = filter + (!String.IsNullOrEmpty(list.filter12) ? (!String.IsNullOrEmpty(filter.Trim()) ? " AND " : "") + " StaffName LIKE N'%" + list.filter12 + "%'" : "");

            filter = filter.Replace("!!", "%");
            var db = new PerformanceReportDAL();

            ViewBag.pageIndex = pageIndex;
            ViewBag.pageSize  = pageSize;
            int?total = 0;
            TableColumnsTotal totalColumns = new TableColumnsTotal();
            var baseListParam = new BaseListParam()
            {
                FilterField  = filter,
                OrderByField = "",
                UserType     = Global.CurrentUser.RoleId,
                UserId       = Global.CurrentUser.LoginUserId,
                DeptId       = Global.CurrentUser.OrganizationUnitID,
                PageIndex    = pageIndex,
                PageSize     = pageSize,
                LanguageCode = Global.CurrentUser.CurrentLanguageID.ToString()
            };
            var result = db.GetPerformanceReport(baseListParam, list, out total, out totalColumns);

            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = totalColumns,
                userid = baseListParam.UserId
            })));
        }