Beispiel #1
0
        void AddCheckedCoursesToList(Academic.ViewModel.Subject.Subject sub = null)
        {
            var list = (List <Academic.ViewModel.Subject.Subject>)ViewState["SelectedCourses"];

            if (list != null)
            {
                if (sub != null)
                {
                    if (sub.Checked)
                    {
                        list.Add(sub);
                        EachSelectedCourseUC each = (EachSelectedCourseUC)
                                                    Page.LoadControl(
                            "~/Views/Structure/All/UserControls/CourseLinkage/EachSelectedCourseUC.ascx");
                        each.ID = "each" + sub.Id + sub.Name;
                        each.SetName(sub.Id, sub.Name);
                        each.RemoveClicked += each_RemoveClicked;
                        pnlSelectedCourses.Controls.Add(each);
                    }
                    else
                    {
                        sub.Checked = true;
                        var found = list.Find(x => x.Id == sub.Id);
                        list.Remove(found);
                        var removeEachCourse = pnlSelectedCourses.FindControl("each" + sub.Id + sub.Name);
                        if (removeEachCourse != null)
                        {
                            pnlSelectedCourses.Controls.Remove(removeEachCourse);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        void InitialLoadOfCheckedCourses()
        {
            var list = (List <Academic.ViewModel.Subject.Subject>)ViewState["SelectedCourses"];

            if (list != null)
            {
                foreach (var subject in list)
                {
                    EachSelectedCourseUC each = (EachSelectedCourseUC)
                                                Page.LoadControl("~/Views/Structure/All/UserControls/CourseLinkage/EachSelectedCourseUC.ascx");
                    each.ID = "each" + subject.Id + subject.Name;
                    each.SetName(subject.Id, subject.Name);
                    each.RemoveClicked += each_RemoveClicked;
                    pnlSelectedCourses.Controls.Add(each);
                }
            }
        }