protected override void PrePersistHandler(CRBAccountBatch newInstance, ICollection <CRBAccountBatch> deletingInstances) { if (deletingInstances.Count > 0) { // Location RefItemsCorrectorBase <CRBAccountBatch, Location> locationHelper = new RefItemsCorrector <CRBAccountBatch, Location, Location.bAccountID>(this, GetBAccountID); locationHelper.Correct(newInstance, deletingInstances); // Address RefItemsCorrectorBase <CRBAccountBatch, Address> addressHelper = new RefItemsCorrector <CRBAccountBatch, Address, Address.bAccountID>(this, GetBAccountID); addressHelper.Correct(newInstance, deletingInstances); // Contact RefItemsCorrectorBase <CRBAccountBatch, Contact> contactHelper = new RefItemsCorrector <CRBAccountBatch, Contact, Contact.bAccountID>(this, GetBAccountID); contactHelper.Correct(newInstance, deletingInstances); // Opportunity RefItemsCorrectorBase <CRBAccountBatch, CROpportunity> opportunityHelper = new RefItemsCorrector <CRBAccountBatch, CROpportunity, CROpportunity.bAccountID>(this, GetBAccountID); opportunityHelper.Correct(newInstance, deletingInstances); // Commit changes CRHelper.SafetyPersist(locations.Cache, locationHelper.SaveOperations); locations.Cache.IsDirty = false; CRHelper.SafetyPersist(addresses.Cache, addressHelper.SaveOperations); addresses.Cache.IsDirty = false; CRHelper.SafetyPersist(contact.Cache, contactHelper.SaveOperations); addresses.Cache.IsDirty = false; CRHelper.SafetyPersist(opportunity.Cache, opportunityHelper.SaveOperations); addresses.Cache.IsDirty = false; } base.PrePersistHandler(newInstance, deletingInstances); }
protected override void PrePersistHandler(CRContactBatch newInstance, ICollection <CRContactBatch> deletingInstances) { if (deletingInstances.Count > 0) { // CROpportunityContacts RefItemsCorrector <CRContactBatch, CROpportunityContacts, CROpportunityContacts.contactID> opportunityContactsHelper = new RefItemsCorrector <CRContactBatch, CROpportunityContacts, CROpportunityContacts.contactID>(this, GetContactID); opportunityContactsHelper.Correct(newInstance, deletingInstances); // Commit changes CRHelper.SafetyPersist(opprotunityContacts.Cache, opportunityContactsHelper.SaveOperations); } base.PrePersistHandler(newInstance, deletingInstances); }