asked on
This is the code block :
void barButtonItemSavePatientChages_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
using (this)
{
checkEditShowPatientDetails.Focus();
if (patient.Oid != -1)
{
if (controlExists("pid"))
{
PatientInformationDetails pid = main.Controls["pid"] as PatientInformationDetails;
ArrayList addresses = pid.getPatientAddresses(patient);
foreach (Address address in addresses)
{
patient.Addresses.Add((Address)address);
}
MessageBox.Show("this is pib - calling pid.getEmergencyContact(patient)");
Person emergencyContact = pid.getEmergencyContact(patient);
patient.Persons.Add(emergencyContact);
ArrayList phones = pid.getPatientPhones(patient);
foreach (Phone phone in phones)
{
patient.Phones.Add((Phone)phone);
}
if (pid != null) { pid.Dispose(); }
}
MessageBox.Show("pib - calling patient.Save() when (patient.Oid != -1)");
patient.Save(); //This is the method that is being //called more times then expected
if (this != null)
{
this.Dispose();
}
}
}