Example #1
0
        private void btnStudentAdd_Click(object sender, EventArgs e)
        {
            //LinqLayer.AddStudent("Fred", "Flintstone");

            frmAddEditStudent addEditStudentForm = new frmAddEditStudent();

            addEditStudentForm.AddEdit   = StudentOperation.Add;
            addEditStudentForm.Id        = -1;
            addEditStudentForm.FirstName = "";
            addEditStudentForm.LastName  = "";
            addEditStudentForm.ShowDialog();
            LoadStudentGrid();
        }
Example #2
0
 private void btnStudentEdit_Click(object sender, EventArgs e)
 {
     if (grdStudent.SelectedRows.Count > 0)
     {
         frmAddEditStudent addEditStudentForm = new frmAddEditStudent();
         addEditStudentForm.AddEdit   = StudentOperation.Edit;
         addEditStudentForm.Id        = Convert.ToInt32(grdStudent.Rows[grdStudent.SelectedRows[0].Index].Cells["Id"].Value);
         addEditStudentForm.FirstName = grdStudent.Rows[grdStudent.SelectedRows[0].Index].Cells["First Name"].Value.ToString();
         addEditStudentForm.LastName  = grdStudent.Rows[grdStudent.SelectedRows[0].Index].Cells["Last Name"].Value.ToString();
         addEditStudentForm.ShowDialog();
         LoadStudentGrid();
     }
     else
     {
         MessageBox.Show("You must select a student record to edit.", "Edit Student Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }