private void reinitInfos() { lock (lockObj) { if ((DateTime.Now - reinit).Minutes < 5) { return; } var jw = new JournalViewer(journalForlder); infos = new Dictionary <string, Dictionary <int, Dictionary <int, int> > >(); var items = jw.GetAllJournals().GroupBy(x => x.machineName); foreach (var item in items) { infos[item.Key] = new Dictionary <int, Dictionary <int, int> >(); foreach (var y in item.GroupBy(x => x.date.Year)) { infos[item.Key][y.Key] = new Dictionary <int, int>(); foreach (var m in y.GroupBy(x => x.date.Month)) { infos[item.Key][y.Key][m.Key] = m.Count(); } } } reinit = DateTime.Now; } }
private List <JournalItem> GetByInfos(IEnumerable <JournalInfo> ifs) { var res = new List <JournalItem>(); var itms = new JournalViewer(journalForlder).GetAllJournals(); foreach (var item in ifs) { res.AddRange(itms.Where(x => { return(x.date.Year == item.Year && x.date.Month == item.Month); })); } return(res); }
public void SendJournal(List <JournalItem> items) { var jw = new JournalViewer(journalForlder); var cur = jw.GetAllJournals(); var newItms = items.Where(x => !cur.Contains(x)); foreach (var item in newItms) { Journal.Journal.WriteLog(item, journalForlder); } }
private List <JournalInfo> GetJournalInfos() { var res = new List <JournalInfo>(); var jw = new JournalViewer(journalForlder); foreach (var y in jw.GetAllJournals().Where(x => x.machineName == Environment.MachineName).GroupBy(x => x.date.Year)) { foreach (var m in y.GroupBy(x => x.date.Month)) { res.Add(new JournalInfo { Year = y.Key, Month = m.Key, Count = m.Count() }); } } return(res); }