Beispiel #1
0
        //加载树
        private void LoadTreeNodes()
        {
            T_CollegeDAL collegeDal = new T_CollegeDAL();
            T_ClassDAL   classDal   = new T_ClassDAL();
            var          collegeRes = collegeDal.LoadCollege();

            TreeNode[] nodes = new TreeNode[collegeRes.Count];
            for (int i = 0; i < collegeRes.Count; i++)
            {
                TreeNode node = new TreeNode();
                node.Text = collegeRes[i].CollegeName;
                node.Tag  = collegeRes[i];
                nodes[i]  = node;
                var classRes = classDal.LoadClass(collegeRes[i].CollegeID);
                if (classRes == null)
                {
                    continue;
                }
                foreach (var item in classRes)
                {
                    TreeNode node1 = new TreeNode(item.ClassName);
                    node1.Tag = item;
                    nodes[i].Nodes.Add(node1);
                }
            }
            trvEx1.Nodes.AddRange(nodes);
        }
Beispiel #2
0
        private void LoadClass()
        {
            T_ClassDAL     dal    = new T_ClassDAL();
            List <T_Class> @class = dal.LoadClass();

            comClass.DataSource            = @class;
            comClass.SelectedIndexChanged += ComClass_SelectedIndexChanged;
            ComClass_SelectedIndexChanged(comClass, null);
        }
        private void FrmInsertedClassSetUpCourse_Load(object sender, EventArgs e)
        {
            //加载学院
            T_CollegeDAL dal = new T_CollegeDAL();

            comCollege.DataSource = dal.LoadCollege();
            //事件触发加载班级
            comCollege.SelectedIndexChanged += ComCollege_SelectedIndexChanged;
            comCollege.SelectedIndex         = 0;
            T_ClassDAL classDal = new T_ClassDAL();

            comClass.DataSource  = classDal.LoadClass();
            comCourse.DataSource = new T_CourseDAL().ExecuteListCourseName();
            comTeach.DataSource  = new T_TeachDAL().GetTeches();
        }
Beispiel #4
0
        private void trvEx1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var college = e.Node.Tag as T_College;

            if (college == null)
            {
                return;
            }
            T_ClassDAL classDAL = new T_ClassDAL();
            int        cur      = 1;

            try
            {
                var res = classDAL.LoadClass(college.CollegeID);
                dataGridView1.DataSource = res;
                cur       = 1;
                collegeID = college.CollegeID;
            }
            catch
            {
                cur = curIndex;
            }
            curIndex = cur;
        }