public IList <IScheduleItem> GetAllScheduleItems(String projectId) { Project project = _projectDataAccess.GetByExternalId(projectId); if (project != null) { IList <Schedule> schedules = _scheduleDataAccess.GetAll(project.ID); IList <Sequence> sequences = _sequenceDataAccess.GetAll(project.ID, schedules.Where(s => (s.ScheduleItemType == ItemType.Sequence)).Select(s => s.ScheduleItemId).ToList()); IList <Script> scripts = _scriptDataAccess.GetAll(project.ID, schedules.Where(s => (s.ScheduleItemType == ItemType.Script)).Select(s => s.ScheduleItemId).ToList()); List <IScheduleItem> scheduleItems = new List <IScheduleItem>(); foreach (Schedule schedule in schedules) { if (schedule.ScheduleItemType == ItemType.Sequence) { scheduleItems.Add(new SequenceScheduleItem(schedule, sequences.SingleOrDefault(s => s.ID == schedule.ScheduleItemId))); } else if (schedule.ScheduleItemType == ItemType.Script) { scheduleItems.Add(new ScriptScheduleItem(schedule, scripts.SingleOrDefault(s => s.ID == schedule.ScheduleItemId))); } } return(scheduleItems.OrderBy(si => si.Name).ToList()); } else { _log.Info("GetAllSchedulesItems(" + projectId + "): Unable to find project"); return(new List <IScheduleItem>()); } }
public IList <Sequence> GetAllSequences(long projectId) { return(_sequenceDataAccess.GetAll(projectId).OrderBy(s => s.Name).ToList()); }