Ejemplo n.º 1
0
 void initContracts()
 {
     //如果存在Student.xml查询所有学生信息,如果不存在,则创建后在查询
     if (File.Exists(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"/xml/Student.xml"))
     {
         dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo();
     }
     else
     {
         StudentInfoBLL.CreateStudentXml();
         dataGridView1.DataSource = StudentInfoBLL.GetAllStudentInfo();
     }
     //初始化数据表格dataGitlView的列标题
     dataGridView1.Columns[0].HeaderText = "学生编号";
     dataGridView1.Columns[1].HeaderText = "学生姓名";
     dataGridView1.Columns[2].HeaderText = "学生性别";
     dataGridView1.Columns[3].HeaderText = "学生年龄";
     dataGridView1.Columns[4].HeaderText = "出生日期";
     dataGridView1.Columns[5].HeaderText = "手机号码";
     dataGridView1.Columns[6].HeaderText = "家庭住址";
     dataGridView1.Columns[7].HeaderText = "电子邮箱";
     dataGridView1.Columns[8].HeaderText = "专    业";
 }