Esempio n. 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());
            }
        }
Esempio n. 2
0
 private void txtWifeDiedDate_Leave(object sender, EventArgs e)
 {
     if (wifeId == -1)
     {
         MessageBox.Show("Please enter name first");
     }
     else
     {
         DBAccessStatic.UpdateIndividualDiedDate(wifeId, txtWifeDiedDate.Text);
     }
 }