예제 #1
0
        public object GetReadings(DataTablesAjaxRequestModel tableModel)
        {
            int total         = 0;
            int totalFiltered = 0;

            var records = _readingService.GetReadings(
                TemporaryTenantid,
                tableModel.PageIndex,
                tableModel.PageSize,
                tableModel.SearchText,
                tableModel.GetSortText(new string[] { "TenantId", "MonthYear", "PreviousReading", "PresentReading", "DayOffset", "NetUnit", "PerUnitPrice", "TotalBillofThisMonth" }),
                out total,
                out totalFiltered);

            return(new
            {
                recordsTotal = total,
                recordsFiltered = totalFiltered,
                data = (from record in records
                        select new string[]
                {
                    _tenantService.GetTenant(record.TenantId).Name,
                    record.ReadingTakenDate.AddMonths(-1).ToString("MMMM,yyyy"),
                    record.PreviousReading.ToString(),
                    record.PresentReading.ToString(),
                    // record.DayOffset.ToString(),
                    record.NetUnit.ToString(),
                    record.PerUnitPrice.ToString(),
                    record.TotalBillofThisMonth.ToString(),
                    record.Id.ToString()
                }
                        ).ToArray()
            });
        }