private BookingStatisticModel CalculateStatistic() { //kamus DisplayFormatHelper dfh = new DisplayFormatHelper(); int statistic; Business.Infrastructure.FilterInfo filters, singleFilter; BookingStatisticModel model = new BookingStatisticModel(); //algoritma CustomPrincipal user = User as CustomPrincipal; if (user.IdOwner != null) { //berangkat besok filters = new Business.Infrastructure.FilterInfo { Filters = new List <Business.Infrastructure.FilterInfo> { new Business.Infrastructure.FilterInfo { Field = "start_rent", Operator = "eq", Value = DateTime.Now.AddDays(1).ToString(dfh.SqlDateFormat) }, new Business.Infrastructure.FilterInfo { Field = "status", Operator = "neq", Value = RentStatus.CANCEL.ToString() } }, Logic = "and" }; AddOwnerFilter(filters, user.IdOwner.Value); statistic = RepoRent.Count(filters); model.TomorrowDeparture = statistic; //belum ditugaskan filters.Filters.Clear(); filters.Filters.Add(new Business.Infrastructure.FilterInfo { Field = "status", Operator = "neq", Value = RentStatus.CANCEL.ToString() }); AddOwnerFilter(filters, user.IdOwner.Value); statistic = RepoRent.CountUnassignedCar(filters); model.UnassignedCar = statistic; statistic = RepoRent.CountUnassignedDriver(filters); model.UnassignedDriver = statistic; //unpaid filters.Filters.Clear(); singleFilter = new Business.Infrastructure.FilterInfo { Field = "rent.id_owner", Operator = "eq", Value = user.IdOwner.ToString() }; filters.Filters.Add(singleFilter); singleFilter = new Business.Infrastructure.FilterInfo { Field = "status", Operator = "eq", Value = InvoiceStatus.UNPAID.ToString() }; filters.Filters.Add(singleFilter); statistic = RepoInvoice.Count(filters); model.UnpaidInvoice = statistic; //cancel filters.Filters.Clear(); singleFilter = new Business.Infrastructure.FilterInfo { Field = "status", Operator = "eq", Value = RentStatus.CANCEL.ToString() }; filters.Filters.Add(singleFilter); AddOwnerFilter(filters, user.IdOwner.Value); statistic = RepoRent.Count(filters); model.CancelledRent = statistic; } return(model); }