コード例 #1
0
 public List <TEntity> GetRange(int index, int count)
 {
     try
     {
         return(Context.Set <TEntity>().OrderBy(QueryableExtention.GetKeyField(typeof(TEntity))).Skip(index).Take(count).ToList());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        private ConsumptionPredictionModel GetConsumptionPrediction(IQueryable <MeterDetails> meterDetails)
        {
            DateTime startDate, endDate;

            QueryableExtention.GetStartAndEndDate(out startDate, out endDate);

            var inDateRange = startDate != DateTime.MinValue || endDate != DateTime.MinValue;

            var cunsumptionPrediction = new ConsumptionPredictionModel
            {
                Consumption = inDateRange ? this.GetGivenDateConsumption(meterDetails, startDate, endDate) : this.GetMonthlyConsumption(meterDetails),
                Prediction  = inDateRange ? this.GetGivenDatePrediction(meterDetails, startDate, endDate) : this.GetMonthlyPrediction(meterDetails)
            };

            return(cunsumptionPrediction);
        }