Пример #1
0
 public Plant GetPlant(int productId)
 {
     return(TryGetResult <Plant>(() => {
         return DataTable.Where(x => x.Id == productId).Select(x => new Plant()
         {
             Address = x.Plants.Address,
             City = x.Plants.Cities.Name,
             Name = x.Plants.Name,
             State = x.Plants.Cities.State,
             Zip = x.Plants.Zip
         }).FirstOrDefault();
     }, useCache: true, keySuffix: productId, nonExpireCache: true));
 }
Пример #2
0
 public Contact GetSupportManager(int productId)
 {
     return(TryGetResult <Contact>(() => {
         return DataTable.Where(p => p.Id == productId).Select(c => new Contact()
         {
             Address = c.SupportManager.Address,
             City = c.SupportManager.Cities.Name,
             Email = c.SupportManager.Email,
             FullName = c.SupportManager.FullName,
             State = c.SupportManager.Cities.State,
             Zip = c.SupportManager.Zip,
             Phone = c.SupportManager.Phone
         }).FirstOrDefault();
     }, useCache: true, keySuffix: productId, nonExpireCache: true));
 }
Пример #3
0
 // Footer Range Control
 public IEnumerable <RangeChartData> GetRangeChartData(DateTime startDate, DateTime endDate)
 {
     return(TryGetResult <IEnumerable <RangeChartData> >(() => {
         return DataTable.Where(s => s.SaleDate >= startDate && s.SaleDate <= endDate).
         GroupBy(s => new { Year = s.SaleDate.Year, Month = s.SaleDate.Month, Day = s.SaleDate.Day }).
         Select(groupS => new {
             Year = groupS.Key.Year,
             Month = groupS.Key.Month,
             Day = groupS.Key.Day,
             TotalCost = groupS.Sum(x => x.TotalCost)
         }).ToList().Select(c => new RangeChartData()
         {
             Argument = new DateTime(c.Year, c.Month, c.Day),
             Value = c.TotalCost
         }).OrderBy(s => s.Argument);
     }, useCache: true, keySuffix: string.Format("{0}.{1}", startDate, endDate)));
 }
Пример #4
0
        public DateTime GetMaxDate()
        {
            var endDateInterval = DateTimeHelper.GetIntervalEndDate(DateTime.Now, SelectionInterval.Day);

            return(TryGetResult(() => DataTable.Where(s => s.SaleDate <= endDateInterval).Max(s => s.SaleDate), useCache: true));
        }
Пример #5
0
 public double GetSalesRevenue(DateTime minDate, DateTime maxDate)
 {
     return(TryGetResult <double>(() => {
         return DataTable.Where(s => s.SaleDate >= minDate && s.SaleDate <= maxDate).Sum(s => s.TotalCost);
     }, useCache: true, keySuffix: string.Format("{0}.{1}", minDate, maxDate)));
 }