public List <string> GetCTXDownloadMonthYear() { HashSet <string> list = new HashSet <string>(); foreach (var item in CTXFileCollection.OrderBy(t => t.DateAdded)) { list.Add(item.DateAdded.ToString("MMM-dd-yyyy")); } return(list.ToList()); }
public CTXFile GetFile(string ctxFileName) { var ctx = CTXFileCollection.FirstOrDefault(t => t.CTXFileName == ctxFileName); if (ctx.XML == "") { ctx.XML = GetXMLOfCTX(ctx); } return(ctx); }
public CTXFile GetFile(int id, bool getXML = true) { var ctx = CTXFileCollection.FirstOrDefault(t => t.RowID == id); if (ctx != null && getXML && ctx.XML == "") { ctx.XML = GetXMLOfCTX(ctx); } return(ctx); }
public List <CTXFileSummaryView> GetCTXFilesSummaryView(DateTime downloadDate) { List <CTXFileSummaryView> files = new List <CTXFileSummaryView>(); foreach (var item in CTXFileCollection .Where(t => t.DateAdded > downloadDate && t.DateAdded < downloadDate.AddDays(1)) .OrderBy(t => t.DateAdded)) { files.Add(new CTXFileSummaryView(item)); } return(files); }
public List <string> GetUserNames() { var grouped = CTXFileCollection .OrderBy(t => t.UserName) .Where(t => t.UserName != null && t.UserName.Length > 0) .GroupBy(t => t.UserName) .Select(g => new { user = g.Key }); var list = new List <string>(); foreach (var item in grouped) { list.Add(item.user); } return(list); }
private List <CTXFile> GetAll( bool checkXML = false, bool excludeExtracted = false, bool refreshReadTrack = false ) { var list = new List <CTXFile>(); if (checkXML) { list = CTXFileCollection.OrderBy(t => t.DateStart).ToList(); foreach (var ctx in list) { if (ctx.XML == "") { ctx.XML = GetXMLOfCTX(ctx); } } //return list; } else { list = CTXFileCollection.OrderBy(t => t.DateStart).ToList(); //return CTXFileCollection.OrderBy(t => t.DateStart).ToList(); } if (refreshReadTrack) { excludeExtracted = false; } if (excludeExtracted) { return(list.Where(t => t.TrackExtracted = false).ToList()); } else { return(list); } }
public List <DateTime> getCTXUserHistoryMonths(string userName) { HashSet <DateTime> userHistory = new HashSet <DateTime>(); foreach (var item in CTXFileCollection.Where(t => t.UserName == userName).OrderBy(t => t.DateStart)) { DateTime?monthYear = null; if (item.DateStart != null) { monthYear = (DateTime)item.DateStart; } else if (item.DateEnd != null) { monthYear = (DateTime)item.DateEnd; } if (monthYear != null) { userHistory.Add(new DateTime(((DateTime)monthYear).Year, ((DateTime)monthYear).Month, 1)); } } return(userHistory.ToList()); }
public bool Exists(string ctxFileName) { return(CTXFileCollection.FirstOrDefault(t => t.CTXFileName == ctxFileName) != null); }