Beispiel #1
0
        public Profile(Person person)
        {
            this.person = person;
            if (person.NetworkStats != null)
            {
                firstDegreeConnections = person.NetworkStats.properties[0].Value;
                secondDegreeConnections = person.NetworkStats.properties[1].Value;
            }
            DateTime _month = DateTime.Today;
            DateTime _week = DateTime.Today;
            if (_week.DayOfWeek != DayOfWeek.Sunday)
            {
                _week = _week.AddDays(7 + DayOfWeek.Sunday - DateTime.Today.DayOfWeek);
            }

            monthes = new SortedDictionary<int, Data>();
            weeks = new SortedDictionary<int, Data>();
            int k = 0;
            for (int i = 1; i <= 4; i++, _month = _month.AddMonths(-1))
            {
                Data month = new Data(i);
                monthes.Add(i, month);
                month.month = _month.Month;
                if (i == 1)
                {
                    month.content = "Current Month";
                }
                else
                {
                    month.content = _month.ToString("MMMM yyyy");
                }
                for (
                    int j = 1;
                    (_week.Month == _month.Month && _week.Day > 3) || (_week.Month > _month.Month && _week.Day <= 3);
                    j++, _week = _week.AddDays(-7), k++
                    )
                {
                    Data week = new Data(k);
                    weeks.Add(k, week);
                    week.month = _month.Month;
                    week.week = j;
                    if (j == 1 && i == 1)
                    {
                        week.content = "Current Week";
                        week.date = DateTime.Today.ToString("dd.MM.yyyy");
                    }
                    else
                    {
                        week.content = _week.AddDays(-6).ToString("dd.MM.yyyy") + " - " + _week.ToString("dd.MM.yyyy");
                        week.date = _week.ToString("dd.MM.yyyy");
                    }

                }
            }
        }
Beispiel #2
0
Datei: Data.cs Projekt: Gloor/lma
 internal void addRaw(Data item)
 {
     addStatistics(item.likes, item.comments);
     activities.Add(item);
 }
Beispiel #3
0
        public void add(Data item)
        {
            int i = DateTime.Today.Month - item._date.Month + 1;
            if (monthes.ContainsKey(i))
                monthes[i].addStatistics(item.likes, item.comments);

            var start_week = DateTime.Today;
            if(start_week.DayOfWeek != DayOfWeek.Sunday) {
                start_week = start_week.AddDays(7 + DayOfWeek.Sunday - DateTime.Today.DayOfWeek);
            }
            int k = (int) Math.Floor((double)(start_week.Subtract(item._date).Days / 7));
            if (weeks.ContainsKey(k))
                weeks[k].addRaw(item);
        }