private void CheckForRaminingTalks() { //find the reaming talks total time which are not yet scheduled. double remainingTalksDuration = localtalks.Where(item => item.IsScheduled == false).Sum(item1 => item1.Value); //if the remaining time is more then 0, try to adjust the talks in the Networkin session if (remainingTalksDuration > 0) { int i = 0; while (i < tracks.Count) { ITrack track = tracks[i]; ITalkList talkList = null; foreach (SessionEnum item in (SessionEnum[])Enum.GetValues(typeof(SessionEnum))) { int sessionTime = Convert.ToInt32(((TimeSpan)SessionHelper.GetSesionAttributes(item, Constants.Duration)).TotalMinutes); if ((SessionEnum)item == SessionEnum.Networking) { talkList = creator.ScheduleTalksForEachTrack(sessionTime, localtalks.Where(talk => talk.IsScheduled == false).ToList()); track[item] = talkList; track[item].Add(new Talk(item.ToString(), 0)); } } i++; } } }
/// <summary> /// The method is used to change the status returned from the Engine to IsScheduled true. /// </summary> /// <param name="talkList">The talk list recieved from the engine</param> /// <param name="talks">The parent talk list</param> private void ChangeTheTalkStatusToSchedule(ITalkList talkList, IList <ITalk> talks) { try { talks = talks.Select(item => { if (talkList.Contains(item)) { item.IsScheduled = true; } return(item); }).ToList(); } catch (Exception ex) { Log.LogInfo(ex.StackTrace); throw ex; } }
public void Add(Conference.Utility.SessionEnum key, ITalkList value) { local.Add(key, value); }
public bool TryGetValue(Conference.Utility.SessionEnum key, out ITalkList value) { throw new NotImplementedException(); }
/// <summary> /// The method get the track and respective talks for each session in the track. /// </summary> /// <returns></returns> private IList <ITrack> GetTracks() { try { //Get all the session present in the Track for the day SessionEnum[] array = (SessionEnum[])Enum.GetValues(typeof(SessionEnum)); //Get the sum of all the sessions time excluding the Lunch Time double allSessionTime = array.Where(item => ((SessionEnum)item) != SessionEnum.Lunch).Sum(item => ((TimeSpan)SessionHelper.GetSesionAttributes(item, Constants.Duration)).TotalMinutes); //Get the number of tracks by dividing the all talks time by the session time available double numberOfTracks = allTalksTime / allSessionTime; tracks = new List <ITrack>(); for (int i = 0; i < Convert.ToInt32(numberOfTracks); i++) { //create a track Track track = new Concrete.Track(); //for each session in the track, get the number of talks using the Generic engine foreach (SessionEnum item in (SessionEnum[])Enum.GetValues(typeof(SessionEnum))) { ITalkList talkList = null; int sessionTime = Convert.ToInt32(((TimeSpan)SessionHelper.GetSesionAttributes(item, Constants.Duration)).TotalMinutes); //If the session are Lunch and Netowrking add the blank talk reference bool isExtraTime = (bool)SessionHelper.GetSesionAttributes(item, Constants.IsExtraTime); bool isTalkSession = (bool)SessionHelper.GetSesionAttributes(item, Constants.IsTalkSession); if (isExtraTime || !isTalkSession) { track.Add(item, new TalkList() { new Talk(item.ToString(), sessionTime) }); } else { //For each session we will pass the parameter to the Engine the total number of the minutes as capacity and all the talks talkList = creator.ScheduleTalksForEachTrack(sessionTime, localtalks.Where(talk => talk.IsScheduled == false).ToList()); track.Add(item, talkList); } } tracks.Add(track); } //Find the talks which are not yet scheduled CheckForRaminingTalks(); AssignTimeToTalks(tracks); return(tracks); } catch (Exception ex) { Log.LogInfo(ex.StackTrace); throw; } }