public virtual void MaintainIntersection(ISession session) { foreach (var legalEntity in Orgs()) { Maintainer.MaintainIntersection(session, this, legalEntity); } }
public virtual AuditRecord MoveToAnotherClient(ISession session, Client newOwner, LegalEntity newLegalEntity) { if (!newOwner.Orgs().Any(o => o.Id == newLegalEntity.Id)) { throw new Exception(String.Format("Не могу переместить адрес {0} т.к. юр. лицо {1} не принадлежит клиенту {2}", this, newLegalEntity, newOwner)); } Maintainer.MaintainIntersection(session, newOwner, newLegalEntity); MoveAddressIntersection(session, newOwner, newLegalEntity, Client, LegalEntity); var message = String.Format("Перемещение адреса доставки от {0} к {1}", Client, newOwner); Client = newOwner; Payer = newLegalEntity.Payer; LegalEntity = newLegalEntity; ContactGroup?.MoveTo(newOwner.ContactGroupOwner); AuditRecord.UpdateLogs(newOwner.Id, this); session.Save(this); return(new AuditRecord(message, this)); }