public DriverAllowanceDatatable GetDriverAllowancesForTable(int page, int itemsPerPage, string sortBy, bool reverse, string searchValue)
        {
            try
            {
                var drivers = (from p in _driverAllowanceRepository.GetAllQueryable()
                               //join c in _customerRepository.GetAllQueryable() on p.CustomerMainC equals c.CustomerMainC
                               //  where p.CustomerSubC == c.CustomerSubC
                               select new DriverAllowancePatternViewModel
                {
                    CustomerMainC = p.CustomerMainC,
                    CustomerSubC = p.CustomerSubC,
                    CustomerN = "",                                                     //c.CustomerN,
                    ApplyD = p.ApplyD,
                    UnitPriceMethodI = p.UnitPriceMethodI,
                }).Distinct().AsQueryable();
                //searching
                //if (!string.IsNullOrWhiteSpace(searchValue))
                //{
                //	searchValue = searchValue.ToLower();
                //drivers = drivers.Where(i => (i.CustomerN != null && i.CustomerN.ToLower().Contains(searchValue)) ||
                //	(i.CustomerMainC != null && i.CustomerMainC.ToLower().Contains(searchValue)) ||
                //	(i.CustomerSubC != null && i.CustomerSubC.ToLower().Contains(searchValue)));
                //}

                // sorting, paging
                List <DriverAllowancePatternViewModel> result = drivers.OrderBy(sortBy + (reverse ? " descending" : "")).Skip((page - 1) * itemsPerPage).Take(itemsPerPage).ToList();

                var datatable = new DriverAllowanceDatatable()
                {
                    Data  = result,
                    Total = drivers.Count()
                };
                return(datatable);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }