Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        public CTXFile GetFile(string ctxFileName)
        {
            var ctx = CTXFileCollection.FirstOrDefault(t => t.CTXFileName == ctxFileName);

            if (ctx.XML == "")
            {
                ctx.XML = GetXMLOfCTX(ctx);
            }
            return(ctx);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        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());
        }
Exemplo n.º 8
0
 public bool Exists(string ctxFileName)
 {
     return(CTXFileCollection.FirstOrDefault(t => t.CTXFileName == ctxFileName) != null);
 }