Beispiel #1
0
        public bool KillDates(string date)
        {
            bool anyDup = false;

            foreach (CPhoto photo in db.Photos)
            {
                string dateSTR = string.Empty;
                bool   dupDate = false;
                foreach (CStats stats in photo.Stats)
                {
                    if (stats.Date == dateSTR)
                    {
                        dupDate = true;
                        break;
                    }
                    dateSTR = stats.Date;
                }
                if (dupDate)
                {
                    anyDup = true;
                    break;
                }
            }
            bool anychange = false;

            if (anyDup)
            {
                int    count    = 0;
                string killDate = "20140624";
                for (int ndx = 0; ndx != db.Photos.Count; ndx++)
                {
                    List <CStats> statsList = new List <CStats>();
                    count = 0;
                    for (int xdx = 0; xdx != db.Photos[ndx].Stats.Count; xdx++)
                    {
                        if (string.Compare(killDate, db.Photos[ndx].Stats[xdx].Date, true) == 0)
                        {
                            string y = db.Photos[ndx].Stats[xdx].Date;
                            count++;
                        }
                        else
                        {
                            statsList.Add(CStats.Clone(db.Photos[ndx].Stats[xdx]));
                        }
                    }
                    if (count != 0)
                    {
                        anychange            = true;
                        db.Photos[ndx].Stats = statsList;
                    }
                }
            }
            return(anychange);
        }
Beispiel #2
0
        List <CStats> _Slim(CPhoto photo)
        {
            List <CStats> replacement = new List <CStats>();
            int           prior       = 0;

            foreach (CStats stat in photo.Stats)
            {
                if (stat.Views != prior)
                {
                    replacement.Add(CStats.Clone(stat));
                }
                prior = stat.Views;
            }
            if (replacement.Count != 0 & (replacement.Count != photo.Stats.Count))
            {
                return(replacement);
            }
            return(null);
        }
Beispiel #3
0
        List <CStats> _Trim(CPhoto photo, int max, DateTime dtLimit)
        {
            List <CStats> replacement = new List <CStats>();

            if (photo.Stats.Count > max)
            {
                foreach (CStats stat in photo.Stats)
                {
                    if (CWorker.Str2DT(stat.Date) > dtLimit)
                    {
                        replacement.Add(CStats.Clone(stat));
                    }
                }
            }
            if (replacement.Count != 0 & (replacement.Count != photo.Stats.Count))
            {
                return(replacement);
            }
            return(null);
        }