/// <summary>
        /// 获取一周课表
        /// </summary>
        /// <param name="classTable"></param>
        private void GetWeekCourse(ClassTable classTable)
        {
            if (classTable == null || classTable.ClassTableItems == null)
            {
                return;
            }

            CourseViewList.Clear();
            CourseList.Clear();
            for (var i = 1; i < 6; i++)
            {
                for (var j = 1; j < 9; j++)
                {
                    var course = new Course()
                    {
                        CurriculumNumber = j,
                        WeekId           = i,
                        CourseName       = "-"
                    };
                    var exsitCourse =
                        classTable.ClassTableItems.FirstOrDefault(o => o.CurriculumNumber == j && o.WeekId == i);
                    CourseList.Add(exsitCourse ?? course);
                }
            }

            for (var i = 1; i < 9; i++)
            {
                var cvm = GetCourseView(i);
                CourseViewList.Add(cvm);
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                CourseList.Clear();
                var items = await App.Database.GetCoursesAsync(Term);

                foreach (var item in items)
                {
                    CourseList.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #3
0
        private void DoFilter(object o)
        {
            string instructor = o.ToString();
            var    course     = CourseAll;

            if (instructor != "All")
            {
                course = CourseAll.Where(c => c.CourseInstructors.Exists(e => e == instructor)).ToList();
            }
            CourseList.Clear();
            foreach (var item in course)
            {
                CourseList.Add(item);
            }
        }
Beispiel #4
0
        private void DoFilter(object o)
        {
            string             teacher = o.ToString();
            List <CourseModel> temp    = courseAll;

            if (teacher != "全部")
            {
                temp = courseAll.Where(c => c.Teachers.Exists(e => e == teacher)).ToList();
            }
            CourseList.Clear();

            foreach (var item in temp)
            {
                CourseList.Add(item);
            }
        }
        async Task ExecuteLoadCourses()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            try
            {
                CourseList.Clear();
                var courses = await App.DB.ShowCourses(Term);

                foreach (var course in courses)
                {
                    CourseList.Add(course);
                }
            }
            catch (Exception exception) { }
            finally { IsBusy = false; }
        }
Beispiel #6
0
        private void InitCourseList()
        {
            for (int i = 0; i < 10; i++)
            {
                CourseList.Add(new CourseModel {
                    IsShowSkeleton = true
                });
            }
            Task.Run(new Action(async() =>
            {
                courseAll = LocalDataAccess.GetInstance().GetCourses();
                await Task.Delay(4000);

                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    CourseList.Clear();
                    foreach (var item in courseAll)
                    {
                        CourseList.Add(item);
                    }
                }));
            }));
        }
 public static void ClearCourseList()
 {
     CourseList.Clear();
     
 }
Beispiel #8
0
        private void ExecuteSearch(object parameter)
        {
            String QueryBaseAddition  = "";
            String dynamic_query_part = "";

            foreach (var v in text_criteria)
            {
                if (v.isChecked)
                {
                    if (dynamic_query_part == "")
                    {
                        dynamic_query_part = dynamic_query_part + v.representation + " LIKE '%" + v.input + "%'";
                    }
                    else
                    {
                        dynamic_query_part = dynamic_query_part + " AND " + v.representation + " LIKE '%" + v.input + "%'";
                    }
                }
            }

            foreach (var v in list_criteria)
            {
                if (v.isChecked)
                {
                    bool used = false;
                    if (v.representation == "Läsperiod" && v.Selected != "")
                    {
                        QueryBaseAddition += "JOIN Läsperioder USING (Kurskod) ";
                        used = true;
                    }
                    if (v.representation == "Specialisering" && v.Selected != "")
                    {
                        QueryBaseAddition += "JOIN Specialiseringar USING (Kurskod) ";
                        used = true;
                    }
                    if (dynamic_query_part == "" && used)
                    {
                        dynamic_query_part = dynamic_query_part + v.representation + " LIKE '%" + v.Selected + "%'";
                    }
                    else if (used || v.representation == "Poängtyp")
                    {
                        dynamic_query_part = dynamic_query_part + " AND " + v.representation + " LIKE '%" + v.Selected + "%'";
                    }
                }
            }

            foreach (var v in Interval_criteria)
            {
                if (v.isChecked)
                {
                    String lower = v.LowerBounds.ToString().Replace(',', '.');
                    String upper = v.UpperBounds.ToString().Replace(',', '.');

                    if (dynamic_query_part == "")
                    {
                        dynamic_query_part = dynamic_query_part + v.representation + " >= " + lower + " AND " + v.representation + " <= " + upper;
                    }
                    else
                    {
                        dynamic_query_part = dynamic_query_part + " AND " + v.representation + " >= " + lower + " AND " + v.representation + " <= " + upper;
                    }
                }
            }
            CourseList.Clear();
            String query = "SELECT DISTINCT Kurskod, Antal_poäng, Poängtyp, Kursnamn, Beskrivning,  Representant_email FROM spec_course_info " + QueryBaseAddition + " WHERE " + dynamic_query_part + ";";

            if (dynamic_query_part != "")
            {
                foreach (var v in PerformDatabaseCourseAccess(query))
                {
                    CourseList.Add(v);
                }
            }
        }