private DateTime GetStarTime() { if (!Talks.Any()) { return(startTime); } var lastTalk = Talks.OrderByDescending(x => x.StarTime).First(); return(lastTalk.StarTime.Value.AddMinutes(lastTalk.Duration)); }
public bool RemoveTalk(SessionTalk talk) { if (Talks.Any(t => t.TalkID == talk.TalkID)) { talk.UnSchedule(); ClearSlot(talk.Duration); Talks.Remove(talk); return(true); } return(false); }
private void LoadTalks() { if (Talks.Any()) { return; } for (int i = 1; i <= 20; i++) { Talks.Add(new Talk { Title = $"Talk title {i}", Speaker = $"Speaker {i}", Date = DateTime.Now.AddDays(i) }); } }
public void AddTalkInSpecificTime(DateTime startTimeMin, DateTime startTimeMax, Talk talk) { if (!Talks.Any()) { talk.StarTime = startTimeMin; Talks.Add(talk); return; } var lastTalk = Talks.OrderByDescending(x => x.StarTime).First(); if (lastTalk.StarTime.Value.AddMinutes(lastTalk.Duration) <= startTimeMin) { talk.StarTime = startTimeMin; Talks.Add(talk); return; } talk.StarTime = lastTalk.StarTime.Value.AddMinutes(lastTalk.Duration) < startTimeMax?lastTalk.StarTime.Value.AddMinutes(lastTalk.Duration) : startTimeMax; Talks.Add(talk); }