private void btnNew_Click(object sender, EventArgs e) { pnlAll.Closed = true; pnlParticipant.Closed = true; pnlNewCoontact.Closed = false; btnAddAddress.Visible = false; if (currentContactId != null && currentContactId.GetType() == typeof(int)) { cr = fmNew.DB.Contact.FindByContactId((int)currentContactId); ar = fmNew.DB.Address.FindByAddressId(cr.AddressCurrentID); cr.RejectChanges(); ar.RejectChanges(); } cr = (lmDatasets.atriumDB.ContactRow)fmNew.GetPerson().Add(null); ar = (lmDatasets.atriumDB.AddressRow)fmNew.GetAddress().Add(cr); cr.ContactClass = "P"; cr.AddressCurrentID = ar.AddressId; contactBindingSource.Filter = "ContactId=" + cr.ContactId.ToString(); addressBindingSource.Filter = "Addressid=" + ar.AddressId.ToString(); //contactBindingSource.DataSource = fmNew.DB.Contact.Select("", "", DataViewRowState.Added); //addressBindingSource.DataSource = fmNew.DB.Address.Select("", "", DataViewRowState.Added); fmNew.GetPerson().Validate(cr); fmNew.GetAddress().Validate(ar); SelectedContactId = cr.ContactId; }
private void btnClose_Click(object sender, EventArgs e) { try { if (cr != null) { cr.RejectChanges(); ar.RejectChanges(); cr = null; ar = null; } SelectedContactId = 0; this.Close(); } catch (Exception x) { UIHelper.HandleUIException(x); } }