예제 #1
0
    private void LoadDefaultData()
    {
        LessonQuery lessonQuery = new LessonQuery();

        lessonQuery.AppendEquals(LessonColumn.CustomerId, customer.CustomerId.ToString());
        TList <Lesson>   lessons = DataRepository.LessonProvider.Find(lessonQuery.GetParameters(), "LessonDate DESC");
        LessonTypeLookup lookUp  = null;
        Dictionary <string, LessonTypeLookup> lessonTypeLookUp = new Dictionary <string, LessonTypeLookup>();

        foreach (Lesson l in lessons)
        {
            DataRepository.LessonProvider.DeepLoad(l);
            lookUp = DataRepository.LessonTypeLookupProvider.GetByLessonTypeId(l.LessonTypeId);
            if (lookUp != null && !lessonTypeLookUp.ContainsKey(lookUp.LessonTypeText))
            {
                lessonTypeLookUp.Add(lookUp.LessonTypeText, lookUp);
            }
        }
        if (lessons.Count > 0)
        {
            foreach (LessonTypeLookup l in lessonTypeLookUp.Values)
            {
                DropDownList2.Items.Add(new ListItem(l.LessonTypeText, l.LessonTypeId.ToString()));
            }
            if (!DropDownList1.Enabled)
            {
                DropDownList1.Enabled = true;
            }
            if (!DropDownList3.Enabled)
            {
                DropDownList3.Enabled = true;
            }
            LoadVideoList();
        }
        else
        {
            DropDownList1.Enabled = false;
            DropDownList3.Enabled = false;
        }
    }
예제 #2
0
    private TList <Movie> GetMovies(int lessonTypeId)
    {
        TList <Movie> movies = new TList <Movie>();

        DataRepository.CustomerProvider.DeepLoad(customer);
        LessonQuery lessonQuery = new LessonQuery();

        lessonQuery.AppendEquals(string.Empty, LessonColumn.CustomerId, customer.CustomerId.ToString());
        lessonQuery.AppendEquals("AND", LessonColumn.LessonTypeId, lessonTypeId.ToString());
        TList <Lesson> lessons = DataRepository.LessonProvider.Find(lessonQuery.GetParameters());

        foreach (Lesson l in lessons)
        {
            DataRepository.LessonProvider.DeepLoad(l);
            foreach (Movie m in l.MovieCollection)
            {
                DataRepository.MovieProvider.DeepLoad(m);
                movies.Add(m);
            }
        }
        // movies.Sort("MovieType ASC, DateRecorded DESC");
        movies.Sort("DateRecorded DESC");
        return(movies);
    }