Ejemplo n.º 1
0
 public static List<LogEntry> ReadAll(SupportedPeriod period)
 {
     using (BadgeDataContext db = new BadgeDataContext(BadgeDataContext.ConnectionString)) {
         return (from entry in db.Entries
                 where entry.Time.Date >= period.From.Date && entry.Time.Date <= period.To.Date
                     orderby entry.Time
                     select entry).ToList();
     }
 }
Ejemplo n.º 2
0
        public static List<ReportLog> ReadAll(SupportedPeriod period)
        {
            var list = new List<ReportLog>();

            using (BadgeDataContext db = new BadgeDataContext(BadgeDataContext.ConnectionString)) {

                var entrylistIn = (from entry in db.Entries
                                   where entry.EntryTypeEnum == Model.EntryType.In && entry.Time >= period.From && entry.Time <= period.To
                                   orderby entry.Time
                                   select entry);
                var entrylistOut = (from entry in db.Entries
                                    where entry.EntryTypeEnum == Model.EntryType.Out && entry.Time >= period.From && entry.Time <= period.To
                                    orderby entry.Time
                                    select entry);

                foreach (var item in entrylistIn) {
                    list.Add(new ReportLog(item,
                                            entrylistOut.FirstOrDefault(log => log.Time > item.Time)));
                }

            }

            return list;
        }