示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmEdit editor = new frmEdit();

            if (editor.ShowDialog() == DialogResult.OK)
            {
                StuDbAccessor.Add(editor.student);
                this.ViewAllStudent();
            }
        }
示例#2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Student selStudent = this.GetFirstSelectedStudent();

            if (selStudent != null)
            {
                frmEdit editor = new frmEdit(selStudent);
                int     oldId  = selStudent.ID;
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    StuDbAccessor.Update(oldId, selStudent);
                    this.ViewAllStudent();
                }
            }
        }