public JsonResult FilterData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)
        {
            SearchFilter searchFilter = ScanTimeApprovalManager.SearchData(requestModel);
            ScanTimeApprovalSqlParameters parameters = new ScanTimeApprovalSqlParameters();
            var dateTimeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter {
                DateTimeFormat = "dd/MM/yyyy"
            };
            SearchParams param = new SearchParams();

            if (!string.IsNullOrEmpty(searchprm))
            {
                param = JsonConvert.DeserializeObject <SearchParams>(searchprm, dateTimeConverter);
            }

            parameters.FromDate       = param.StartDate ?? SystemConfig.CurrentDate.AddDays(-30);
            parameters.ToDate         = param.EndDate ?? SystemConfig.CurrentDate;
            parameters.UserLoggedIn   = CustomerAuthorize.CurrentUser.EmployeeCode;
            parameters.ShowWaiting    = param.ShowMissing == "on";
            parameters.StartRow       = (requestModel.Start / requestModel.Length) + 1;
            parameters.EndRow         = requestModel.Length;
            parameters.OrderBy        = string.IsNullOrEmpty(searchFilter.OrderBy) ? "EmployeeNo" : searchFilter.OrderBy;
            parameters.OrderDirection = searchFilter.OrderDirection == "ASC" ? 1 : 0;
            parameters.FilterBy       = parameters.FilterBy = requestModel.Search.Value;
            parameters.ShowUnNoReg    = false;

            ScanTimeApprovalCollection collection = ScanTimeApprovalManager.GetAll(parameters);
            int totalRecord = 0;

            if (collection.Count > 0)
            {
                totalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, totalRecord, totalRecord), JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter searchFilter = ScanTimeApprovalManager.SearchData(requestModel);
            ScanTimeApprovalSqlParameters parameters = new ScanTimeApprovalSqlParameters();

            parameters.FromDate       = SystemConfig.CurrentDate.AddDays(-30);
            parameters.ToDate         = SystemConfig.CurrentDate;
            parameters.UserLoggedIn   = CustomerAuthorize.CurrentUser.EmployeeCode;
            parameters.ShowWaiting    = true;
            parameters.StartRow       = (requestModel.Start / requestModel.Length) + 1;
            parameters.EndRow         = requestModel.Length;
            parameters.OrderBy        = string.IsNullOrEmpty(searchFilter.OrderBy) ? "EmployeeNo" : searchFilter.OrderBy;
            parameters.OrderDirection = searchFilter.OrderDirection == "ASC" ? 1 : 0;
            parameters.FilterBy       = requestModel.Search.Value;
            parameters.ShowUnNoReg    = false;
            parameters.Condition      = requestModel.Search.Value;

            ScanTimeApprovalCollection collection = ScanTimeApprovalManager.GetAll(parameters);
            int totalRecord = 0;

            if (collection.Count > 0)
            {
                totalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, totalRecord, totalRecord), JsonRequestBehavior.AllowGet));
        }