示例#1
0
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            int lecturerId;

            if (isLecFilter && isSubFilter)
            {
                lecturerId = lecturers.Find(l => l.Name == search_lec_val).EmployeeId;
                sessions   = _sessionViewModel.LoadSessionDataByLecturer(lecturerId);
                List <SessionEntity> lecSubFilteredList = new List <SessionEntity>();
                lecSubFilteredList = sessions.FindAll(s => s.SubjectCode == search_combobx.Text);
                sessions           = lecSubFilteredList;
                isLecFilter        = false;
                isSubFilter        = false;
            }
            else if (searchby_combobx.Text == "Subject")
            {
                sessions = _sessionViewModel.LoadSessionDataBySubject(search_combobx.Text);
            }
            else if (searchby_combobx.Text == "Group")
            {
                sessions = _sessionViewModel.LoadSessionDataByGroup(search_combobx.Text);
            }
            else if (searchby_combobx.Text == "Sub Group")
            {
                sessions = _sessionViewModel.LoadSessionDataBySubGroup(search_combobx.Text);
            }
            else if (searchby_combobx.Text == "Tag")
            {
                sessions = _sessionViewModel.LoadSessionDataByTag(search_combobx.Text);
            }
            else if (searchby_combobx.Text == "Lecturer")
            {
                lecturerId = lecturers.Find(l => l.Name == search_combobx.Text).EmployeeId;
                sessions   = _sessionViewModel.LoadSessionDataByLecturer(lecturerId);
            }
            SetDataGrid();
        }