Example #1
0
        public static async System.Threading.Tasks.Task ChangeOrderStatusJob()
        {
            IBaseRepository <Order> _orderService = new BaseRepositoryEF <Order>();

            System.Diagnostics.Debug.WriteLine("Late job!");
            DateTime oldestDate = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
            var      orders     = await _orderService.FindAllAsync(o => o.Status == OrderStatus.Pending& o.CreatedAt < oldestDate);

            if (orders.Count() > 0)
            {
                foreach (var item in orders)
                {
                    item.IsCancel = false;
                    await _orderService.UpdateAsync(item, item.OrderId);
                }
                //var result = await _orderService.UpdateAllAsync(orders, "OrderId");
            }
        }
 public static PageListResult <U> GetPage <T, PK, U>(this BaseRepositoryEF <T, PK> repository, int page, int pageSize, string predicate, string order) where T : class
 {
     return(GetPageInternal <T, U>(repository.Context, page, pageSize, (query) => string.IsNullOrEmpty(predicate) ? query : query.Where(predicate), order));
 }
 public static PageListResult <U> GetPage <T, PK, U>(this BaseRepositoryEF <T, PK> repository, int page, int pageSize, Expression <Func <T, bool> > predicate, string order) where T : class
 {
     return(GetPageInternal <T, U>(repository.Context, page, pageSize, (query) => query.Where(predicate), order));
 }
 public static List <U> GetRange <T, PK, U>(this BaseRepositoryEF <T, PK> repository, string predicate, string order) where T : class
 {
     return(GetRangeInternal <T, U>(repository.Context, (query) => string.IsNullOrEmpty(predicate) ? query : query.Where(predicate), order));
 }
 public static List <U> GetRange <T, PK, U>(this BaseRepositoryEF <T, PK> repository, Expression <Func <T, bool> > predicate, string order) where T : class
 {
     return(GetRangeInternal <T, U>(repository.Context, (query) => query.Where(predicate), order));
 }
Example #6
0
 public static Task <List <U> > GetRangeAsync <T, U>(this BaseRepositoryEF <T, int> repository, Expression <Func <T, bool> > predicate, string order) where T : class
 {
     return(repository.GetRangeAsync <T, int, U>(predicate, order));
 }
Example #7
0
 public static List <U> GetRange <T, U>(this BaseRepositoryEF <T, int> repository, string predicate, string order) where T : class
 {
     return(repository.GetRange <T, int, U>(predicate, order));
 }
Example #8
0
 public static Task <PageListResult <U> > GetPageAsync <T, U>(this BaseRepositoryEF <T, string> repository, int page, int pageSize, string predicate, string order) where T : class
 {
     return(repository.GetPageAsync <T, string, U>(page, pageSize, predicate, order));
 }
Example #9
0
 public static PageListResult <U> GetPage <T, U>(this BaseRepositoryEF <T, string> repository, int page, int pageSize, Expression <Func <T, bool> > predicate, string order) where T : class
 {
     return(repository.GetPage <T, string, U>(page, pageSize, predicate, order));
 }
Example #10
0
 public static Task <List <U> > GetRangeAsync <T, U>(this BaseRepositoryEF <T, string> repository, string predicate, string order) where T : class
 {
     return(repository.GetRangeAsync <T, string, U>(predicate, order));
 }