예제 #1
0
        private void grdChildren_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (familyId == -1)
            {
                familyId = DBAccessStatic.InsertFamily(husbandId, wifeId, txtMarriedDate.Text, txtMariedPlace.Text);
            }

            if (grdChildren[0, e.RowIndex].Value == null)
            {
                int childID = DBAccessStatic.InsertIndividual("", "", "", "", "", "", familyId, "");
                grdChildren[0, e.RowIndex].Value = childID;
                DBAccessStatic.InsertFamilyChild(familyId, childID);
            }

            if (e.ColumnIndex == 1)
            {
                string surname   = GenValidation.GetSurname(grdChildren["ChildName", e.RowIndex].Value.ToString());
                string firstname = GenValidation.GetFirstname(grdChildren["ChildName", e.RowIndex].Value.ToString());

                DBAccessStatic.UpdateIndividualFirstname((int)grdChildren[0, e.RowIndex].Value, firstname);
                DBAccessStatic.UpdateIndividualSurname((int)grdChildren[0, e.RowIndex].Value, surname);
            }
            else if (e.ColumnIndex == 2)
            {
                DBAccessStatic.UpdateIndividualGender((int)grdChildren[0, e.RowIndex].Value, grdChildren[2, e.RowIndex].Value.ToString());
            }
            else if (e.ColumnIndex == 3)
            {
                DBAccessStatic.UpdateIndividualBornDate((int)grdChildren[0, e.RowIndex].Value, grdChildren[3, e.RowIndex].Value.ToString());
            }
            else if (e.ColumnIndex == 4)
            {
                DBAccessStatic.UpdateIndividualDiedDate((int)grdChildren[0, e.RowIndex].Value, grdChildren[4, e.RowIndex].Value.ToString());
            }
        }
예제 #2
0
 private void grdChildren_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (grdChildren[0, e.RowIndex].Value == null)
     {
         MessageBox.Show("Please enter some information for the child before moving to their record");
     }
     else
     {
         if (grdChildren[2, e.RowIndex].Value == null)
         {
             DBAccessStatic.UpdateIndividualGender((int)grdChildren[0, e.RowIndex].Value, "M");
         }
         LoadFamily((int)grdChildren[0, e.RowIndex].Value);
     }
 }