Ejemplo n.º 1
0
        void ReCountIdleTimeSpan()
        {
            IdleTimeSpans.Clear();
            var          scheduledConfs = Conferences.OrderBy(x => x.StartTime).ToList();
            IdleTimeSpan curTimeSpan    = null;

            for (int i = 0; i <= scheduledConfs.Count; i++)
            {
                if (i == 0)
                {
                    curTimeSpan = new IdleTimeSpan {
                        StartTime = OpenStartTime
                    };
                }
                if (i < scheduledConfs.Count && scheduledConfs[i].StartTime > curTimeSpan.StartTime)
                {
                    curTimeSpan.EndTime = scheduledConfs[i].StartTime;
                    IdleTimeSpans.Add(curTimeSpan);
                    curTimeSpan = new IdleTimeSpan {
                        StartTime = scheduledConfs[i].EndTime
                    };
                }
                if (i == scheduledConfs.Count && scheduledConfs.LastOrDefault().EndTime < OpenEndTime)
                {
                    curTimeSpan = new IdleTimeSpan {
                        StartTime = scheduledConfs.LastOrDefault().EndTime, EndTime = OpenEndTime
                    };
                }
            }
        }
Ejemplo n.º 2
0
 public ConferenceViewModel()
 {
     //Определяем контекст данных и связываем с базой данных
     _db = new DbContextEntityes("name=DbConnectionString");
     //Получаем список конференций
     Conferences = _db.Conferences.ToList();
     MinDate     = Conferences.OrderBy(w => w.Duration).FirstOrDefault().Duration;
     MaxDate     = Conferences.OrderByDescending(w => w.Duration).FirstOrDefault().Duration;
 }