//删除成绩 private void btnDeleteGrade_Click(object sender, RoutedEventArgs e) { selectStu = smDgGradeLsit.SelectedItem as GradeExt; if (IdList.Contains(selectStu.Sid)) { MessageBox.Show("请关闭正在查看的学员信息界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要删除的学员!", "提示"); return; } GradeExt student = sm.GetStudentById(selectStu.Sid); if (student != null) { MessageBox.Show("您选择的学员信息已经被删除!", "提示"); return; } MessageBoxResult mbr = MessageBox.Show("您确定要删除【" + student.Sname + "】", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (mbr == MessageBoxResult.OK) { if (sm.DeleteStudentById(student.Sid)) { MessageBox.Show("删除成功!", "提示"); } else { MessageBox.Show("删除失败请稍后再试!", "提示"); } } }
public GradeUpdat(GradeExt stu) { InitializeComponent(); GradeList = stu; textcshap.Text = stu.CSharp.ToString(); textsql.Text = stu.SQLServerDB.ToString(); }
public bool UpdateStudentInfor(GradeExt student) { if (server.UpdateStudentInfor(student) <= 0) { return(false); } else { return(true); } }
public GradeAdd() { InitializeComponent(); GradeExt stu = new GradeExt(); textcshap.Text = stu.CSharp.ToString(); textsql.Text = stu.SQLServerDB.ToString(); texttime.Text = stu.UpdateTime.ToString("yyyy-MM-dd"); smclassCmb.DisplayMemberPath = "Sid"; smclassCmb.SelectedIndex = stu.Sid - 1; }
public GradeExt GetStudentById(int id) { string sql = "SELECT GradeList.Sid, Student.Sname ,CSharp,SQLServerDB,UpdateTime,StudentClass.Scname FROM GradeList INNER JOIN Student ON Student.Sid=GradeList.Sid INNER JOIN StudentClass ON StudentClass.Scid=Student.Sclassid WHERE GradeList.Sid=" + id; SqlDataReader reader = DBHepler.SQLHelper.GetReader(sql); GradeExt student = null; while (reader.Read()) { student = (new GradeExt() { Sid = Convert.ToInt32(reader["Sid"]), Sname = reader["Sname"].ToString(), CSharp = Convert.ToInt32(reader["CSharp"]), Scname = reader["Scname"].ToString(), SQLServerDB = Convert.ToInt32(reader["SQLServerDB"]), UpdateTime = Convert.ToDateTime(reader["UpdateTime"]) }); } return(student); }
//修改成绩信息 private void xgcj_Click(object sender, RoutedEventArgs e) { selectStu = smDgGradeLsit.SelectedItem as GradeExt; if (IdList.Contains(selectStu.Sid)) { MessageBox.Show("请关闭正在查看的学员成绩信息界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要修改的学员成绩!", "提示"); return; } GradeExt objStu = sm.GetStudentById(selectStu.Sid); GradeUpdat updateStuInfor = new GradeUpdat(objStu); updateStuInfor.ShowDialog(); students = sm.GetGrades(Convert.ToInt32(smclassCmb.SelectedValue)); smDgGradeLsit.ItemsSource = students; }
public int Getdaa(GradeExt student) { string sql = string.Format("INSERT INTO GradeList VALUES ({0}, {1}, {2}, {3})", student.Sid, student.CSharp, student.SQLServerDB, student.UpdateTime); return(DBHepler.SQLHelper.ExecuteNonQuery(sql)); }
public int UpdateStudentInfor(GradeExt student) { string sql = string.Format("UPDATE GradeList SET CSharp={0},SQLServerDB={1} WHERE Sid={2}", student.CSharp, student.SQLServerDB, student.Sid); return(DBHepler.SQLHelper.ExecuteNonQuery(sql)); }
public int Getdaa(GradeExt student) { return(server.Getdaa(student)); }