Ejemplo n.º 1
0
        internal static void AddHBSummary(AccountHarvestedSummary s)
        {
            var context = new AccountHarvestedSummaryDataContext();

            context.AccountHarvestedSummaries.InsertOnSubmit(entity: s);

            context.SubmitChanges();
        }
Ejemplo n.º 2
0
        internal static List <AccountHarvestedSummary> GetHBSummary(string account, int days, long chatId)
        {
            var context = new AccountHarvestedSummaryDataContext();

            DateTime startDate = DateTime.Today.AddDays(value: -days);


            return(context.AccountHarvestedSummaries
                   .Where(predicate: e => e.MonitoredAccount == account)
                   .Where(predicate: e => e.OwnedByUser == chatId)
                   .Where(predicate: e => e.DateOfInput > startDate.Date)
                   .ToList());
        }
Ejemplo n.º 3
0
        internal static void DeleteHbSummaryForUser(string account, long chatId)
        {
            var context = new AccountHarvestedSummaryDataContext();

            var summaries = GetHBSummary(account: account, days: 1000, chatId: chatId);

            foreach (var sum in summaries)
            {
                context.AccountHarvestedSummaries.Attach(entity: sum);
                context.AccountHarvestedSummaries.DeleteOnSubmit(entity: sum);
            }

            context.SubmitChanges();
        }