private void btnAddNew_Click(object sender, EventArgs e)
        {
            if (dtStudentDetails.Rows.Count == 0)
            {
                commonFunctions comF = new commonFunctions();
                comF.callSelectIdFromRegistration();
                currentId = comF.currentId;
                newId=calNewId(currentId);
            }
            else {
                newId=calNewId(currentId, dtStudentDetails.Rows.Count);
            }

            frmStudentRegistration frm = new frmStudentRegistration(newId);
            frm.MdiParent = ActiveForm.MdiParent;
            frm.ShowDialog();

            if (frm.IsSaved == true) {
               DataRow dr= dtStudentDetails.NewRow();
               dr["StudentId"] = frm.stuId;
               dr["Name"] = frm.stuName;
               dr["DOB"] = frm.stuDob;
               dr["GPA"] = frm.stuGpa;
               dr["Status"] = frm.stuStatus;

               dtStudentDetails.Rows.Add(dr);
               dgvStudentDetails.DataSource = dtStudentDetails;
               btnSave.Enabled = true;
               formatGrid();
            }
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     commonFunctions comF = new commonFunctions();
     if (dtStudentDetails.Rows.Count > 0)
     {
         foreach (DataRow rec in dtStudentDetails.Rows) {
             comF.callInsertUpdateDeleteRegistration(rec["StudentId"].ToString(), rec["Name"].ToString(), rec["DOB"].ToString(), Convert.ToDecimal(rec["GPA"].ToString()), rec["Status"].ToString(), "Insert");
         }
     }
 }