//添加 private void Add_Click(object sender, RoutedEventArgs e) { //仅当教师用户登录可用 //判断Frame中的Page页面 var control = Selection.arg; if (control == "fromInfo") { Add_StudentInfo asi = new Add_StudentInfo(); this.Frame.Content = asi; } else if (control == "fromAch") { Add_StudentAchievement asa = new Add_StudentAchievement(); this.Frame.Content = asa; } else if (control == "fromFile") { Add_StudentFile asf = new Add_StudentFile(); this.Frame.Content = asf; } }
//修改 public void Modify_Click(object sender, RoutedEventArgs e) { //仅当教师用户登录可用 //判断Frame中的Page页面 var control = Selection.arg; //从Selection获取参数,判断表 if (control == "fromInfo") { Add_StudentInfo asi = new Add_StudentInfo(); DataClassesDataContext db = new DataClassesDataContext(); var query = from n in db.学生信息表 //where n.学号 == StudentInfo.arg where n.学号 == num select n; foreach (var m in query) { asi.xuehao.Text = m.学号; asi.zhuanye.Text = m.专业; asi.zhenghi.Text = m.政治面貌; asi.xingming.Text = m.姓名; asi.xingbie.Text = m.性别; asi.jiating.Text = m.家庭住址; asi.lianxi.Text = m.联系电话; asi.birthday.Text = m.出生年月; asi.banji.Text = m.班级; asi.jiguan.Text = m.籍贯; } this.Frame.Content = asi; } else if (control == "fromAch") { // Add_StudentInfo asi = new Add_StudentInfo(); Add_StudentAchievement asa = new Add_StudentAchievement(); DataClassesDataContext db = new DataClassesDataContext(); var query = from n in db.学生成绩表 //where n.学号 == StudentInfo.arg where n.学号 == num select n; foreach (var m in query) { asa.xuehao.Text = m.学号; asa.zhuanye.Text = m.专业; asa.xingming.Text = m.姓名; asa.banji.Text = m.班级; asa.fenshu1.Text = m.高等数学_上_; asa.fenshu2.Text = m.高等数学_下_; asa.fenshu3.Text = m.概率论; asa.fenshu4.Text = m.线性代数; asa.fenshu5.Text = m.c语言程序设计; asa.fenshu6.Text = m.离散数学; } this.Frame.Content = asa; } else if (control == "fromFile") { // Add_StudentInfo asi = new Add_StudentInfo(); // Add_StudentAchievement asa = new Add_StudentAchievement(); Add_StudentFile asf = new Add_StudentFile(); DataClassesDataContext db = new DataClassesDataContext(); var query = from n in db.学生档案表 //where n.学号 == StudentInfo.arg where n.学号 == num select n; foreach (var m in query) { asf.xuehao.Text = m.学号; asf.zhuanye.Text = m.专业; asf.minzu.Text = m.民族; asf.xingming.Text = m.姓名; asf.xingbie.Text = m.性别; asf.jiating.Text = m.家庭住址; asf.lianxi.Text = m.联系电话; asf.jiangcheng.Text = m.奖罚情况; asf.banji.Text = m.班级; asf.jiguan.Text = m.籍贯; asf.liuji.Text = m.留级情况; } this.Frame.Content = asf; } }