コード例 #1
0
        void BinderStudentInfo()
        {
            try
            {
                DataTable student = StudentsInfoBLL.GetStudentInfoByID(StudentID);
                if (student == null)
                {
                    MessageBox.Show("没数据!");
                    return;
                }


                DataRow row = student.Rows[0];

                string    classid  = row["Student_Class"].ToString();
                DataTable students = StudentsInfoBLL.GetStudentsInfoByClassID(classid);

                DataRow stu = students.Rows[0];

                this.labelName.Text      = row["Student_Name"].ToString();
                this.labelIDCardNum.Text = row["StudentCard"].ToString();
                this.labelBirthday.Text  = row["StudentBirthDay"].ToString();
                this.labelEnterYear.Text = row["StudentEnterYear"].ToString();
                this.labelNative.Text    = row["StudentOrigin"].ToString();
                this.labelHomeTel.Text   = row["FamilyTel"].ToString();
                this.labelHomeAdd.Text   = row["StudentAddress"].ToString();
                this.labelFlatTel.Text   = row["DormTel"].ToString();
                this.labelMobile.Text    = row["Mobile"].ToString();
                this.labelEmail.Text     = row["Email"].ToString();

                this.labStuType.Text      = stu["SpeYears_Name"].ToString();
                this.labelClass.Text      = stu["Classes_Name"].ToString();
                this.labelSpeciality.Text = stu["Speciality_Name"].ToString();
                this.labelCollege.Text    = stu["College_Name"].ToString();



                if (row["Student_Sex"].ToString() == "男")
                {
                    this.labelSex.Text = "男";
                }
                else
                {
                    this.labelSex.Text = "女";
                }
                if (!string.IsNullOrEmpty(row["StudentNum"].ToString()))
                {
                    labelStuID.Text = row["StudentNum"].ToString();
                }
                else
                {
                    labelStuID.Text = "";
                }
            }

            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        private void tvColleges_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (e == null)
                {
                    return;
                }
                if (e.Node.Tag.ToString() == "Classes")//表示选中班级
                {
                    DataTable dt = StudentsInfoBLL.GetStudentsInfoByClassID(e.Node.Name);
                    lvStudentsInfo.Items.Clear();

                    foreach (DataRow stu in dt.Rows)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.Text = stu["Student_Name"].ToString();

                        lvi.Name = stu["Student_ID"].ToString();

                        lvi.SubItems.Add(stu["StudentNum"].ToString());
                        lvi.SubItems.Add(stu["Student_Sex"].ToString());
                        lvi.SubItems.Add(stu["College_Name"].ToString());
                        lvi.SubItems.Add(stu["Speciality_Name"].ToString());
                        lvi.SubItems.Add(stu["StudentEnterYear"].ToString());
                        lvi.SubItems.Add(stu["SpeYears_Name"].ToString());
                        lvi.SubItems.Add(stu["StudentOrigin"].ToString());

                        lvStudentsInfo.Items.Add(lvi);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }