コード例 #1
0
        public void GetSectionListNew()
        {
            try
            {
                _user = (User)Session["UserDetail"];
                DropDownListSection.Items.Clear();
                if (_user.IsAdminUser || IsLeader() || IsEducator())
                {
                    // _courseAndSectionIdTemp course id and section id
                    ListItem[] _courseAndSectionIdTemp = (ListItem[])Session["CourseAndSectionIdTemp"];

                    // _sectionAndCourseIdTemp section id and course id
                    ListItem[] _sectionAndCourseIdTemp = (ListItem[])Session["SectionAndCourseIdTemp"];
                    ListItem[] _temp = new ListItem[_courseAndSectionIdTemp.Count()];

                    String selectedCourseId = DropDownListCourse.SelectedItem.Value;
                    int count = 0;
                    for (int i = 0; i < _sectionAndCourseIdTemp.Count(); i++)
                    {
                        if (selectedCourseId == _sectionAndCourseIdTemp[i].Value)
                        {
                            ListItem _section = _inBloomApi.GetSectionById(_sectionAndCourseIdTemp[i].Text);
                            _temp[count] = new ListItem(_section.Text, _section.Value);
                            DropDownListSection.Items.Add(_section);
                        }
                    }

                    Section section = new Section(_temp);
                    Session["Section"] = section;

                }

            }
            catch (Exception Ex)
            {

            }
        }
コード例 #2
0
        public void GetSectionList()
        {
            DropDownListSection.Items.Clear();
            try
            {
                _user = (User)Session["UserDetail"];
                if (_user.IsAdminUser)
                {
                    String CourseName = DropDownListCourse.SelectedItem.Value;
                    ListItem[] _sectionList = _inBloomApi.GetSectionForAdmin(DropDownListSchool.SelectedItem.Value.ToString(), CourseName);

                    if (_sectionList != null)
                    {
                        for (int i = 0; i < _sectionList.Count(); i++)
                        {
                            if (_sectionList[i] != null)
                            {
                                DropDownListSection.Items.Add(new ListItem(_sectionList[i].Text, _sectionList[i].Value.ToString()));
                            }
                        }
                    }

                    ListItem[] _temp = new ListItem[DropDownListSection.Items.Count];
                    for (int i = 0; i < DropDownListSection.Items.Count; i++)
                    {
                        _temp[i] = new ListItem(DropDownListSection.Items[i].Text, DropDownListSection.Items[i].Value);
                    }
                    Section section = new Section(_temp);
                    Session["Section"] = section;

                }
                else
                {
                    ListItem[] _courseIdAndCourseOfferingId = (ListItem[])Session["CourseIdAndCourseOfferingId"];
                    String SelectedCourseId = DropDownListCourse.SelectedItem.Value;
                    String CourseOfferingId = "";
                    for (int i = 0; i < _courseIdAndCourseOfferingId.Count(); i++)
                    {
                        if (_courseIdAndCourseOfferingId[i].Text == SelectedCourseId)
                        {
                            CourseOfferingId = _courseIdAndCourseOfferingId[i].Value;
                        }
                    }

                    ListItem[] _listSection = _inBloomApi.GetSection(DropDownListSchool.SelectedItem.Value.ToString(), CourseOfferingId);

                    if (_listSection != null)
                    {
                        ListItem[] _sectionAndCourseOfferingId = (ListItem[])Session["SectionAndCourseOfferingId"];
                        ListItem[] _temp = new ListItem[_sectionAndCourseOfferingId.Count()];
                        for (int Index = 0; Index < _listSection.Length; Index++)
                        {
                            if (_listSection[Index] != null)
                            {
                                for (int i = 0; i < _sectionAndCourseOfferingId.Count(); i++)
                                {
                                    if (_sectionAndCourseOfferingId[i].Text == _listSection[Index].Value.ToString())
                                    {
                                        DropDownListSection.Items.Add(new ListItem(_listSection[Index].Text, _listSection[Index].Value.ToString()));
                                        _temp[i] = new ListItem(_listSection[Index].Text, _listSection[Index].Value.ToString());
                                    }
                                }

                            }

                        }

                        //ListItem[] _temp = new ListItem[_listSection.Count()];
                        //int count = 0;
                        //for (int i = 0; i < _listSection.Count(); i++)
                        //{
                        //    if (_listSection[i] != null)
                        //    {
                        //        _temp[count] = new ListItem(_listSection[i].Text, _listSection[i].Value);
                        //        count = count + 1;
                        //    }
                        //}

                        //Section section = new Section(_listSection);
                        //Session["Section"] = section;
                        Section section = new Section(_temp);
                        Session["Section"] = section;
                    }
                    else
                    {
                        Session["Section"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }