public override void UpdateBusinessEntity(IBeheerContextEntity thema) { BeheerContextEntity found = FindBusinessEntity(m_BusinessEntities, thema as BeheerContextEntity); if (found != null) { found.DataKeyValue = thema.DataKeyValue; } }
public override void DeleteBusinessEntity(IBeheerContextEntity thema) { BeheerContextEntity found = FindBusinessEntity(m_BusinessEntities, thema as BeheerContextEntity); if (found != null) { bool succeeded = m_BusinessEntities.Remove(found); } }
public override void AddBusinessEntity(IBeheerContextEntity thema) { if (thema == null) throw new ArgumentNullException("thema"); thema.Id = m_Id; base.m_BusinessEntities.Add(thema as BeheerContextEntity); m_Id++; }
public override void AddBusinessEntity(IBeheerContextEntity beheerContextEntity) { if (beheerContextEntity == null) throw new ArgumentNullException("beheerContextEntity"); beheerContextEntity.Id = m_Id; base.m_BusinessEntities.Add(beheerContextEntity as BeheerContextEntity); m_Id++; }
public virtual void AddBusinessEntity(IBeheerContextEntity beheerContextEntity) { // <pex> if (beheerContextEntity == null) throw new ArgumentNullException("beheerContextEntity"); // </pex> if (beheerContextEntity.DataKeyValue.Equals("1")) throw new BusinessLayerException("duplicate"); beheerContextEntity.Id = m_Id; m_BusinessEntities.Add(beheerContextEntity as BeheerContextEntity); if (beheerContextEntity.Parent != null) { //Deze entity heeft een parent. //Voeg de detail toe aan de master. if (m_QueueMasters != null && m_QueueMasters.Count > 0 && beheerContextEntity.Parent != null) m_QueueMasters[beheerContextEntity.Parent.Id].Details. Add(beheerContextEntity as BeheerContextEntity); } m_Id++; }
public virtual void UpdateBusinessEntity(IBeheerContextEntity beheerContextEntity) { // <pex> if (beheerContextEntity == null) throw new ArgumentNullException("beheerContextEntity"); // </pex> BeheerContextEntity found = FindBusinessEntity(m_BusinessEntities, beheerContextEntity as BeheerContextEntity); if (found != null) { found.DataKeyValue = beheerContextEntity.DataKeyValue; found.Master = beheerContextEntity.Master; if (beheerContextEntity.Details.Count > 0) { //Voeg details toe die nieuw zijn. int count = beheerContextEntity.Details.Count; for (int i = 0; i < count; i++) { BeheerContextEntity detail = beheerContextEntity.Details[i]; if (detail.Id == -3 ) { detail.Id = m_Id++; found.Details.Add(detail); } } //bijwerk de id's, waarvan de details updates zijn. found.Details. Where(detail => detail.Id == -1 || !detail.DataKeyValue.Equals(" ")). Update(x => { x.Id = m_Id++; //x.DataKeyValue = beheerContextEntity.DataKeyValue; }); } BeheerContextEntity master; int idMaster = beheerContextEntity.Parent.Id; m_QueueMasters.TryGetValue(idMaster, out master); if (master!=null) { //het is een master.Wijzig de master met nieuwe waarden. m_QueueMasters[idMaster].DataKeyValue = beheerContextEntity.Parent.DataKeyValue; //update elke detail met veranderde master waarden. m_BusinessEntities. Where(detail => detail.Parent.Id == idMaster). Update(x => { x.Master = beheerContextEntity.Parent.DataKeyValue; //x.DataKeyValue = beheerContextEntity.DataKeyValue; }); } if (beheerContextEntity.Parent != null) { //het is een detail. if (m_QueueMasters != null && m_QueueMasters.Count > 0 && beheerContextEntity.Parent!=null) m_QueueMasters[beheerContextEntity.Parent.Id].Details. Where(detail => detail.Id == found.Id). Update(detail=> detail.DataKeyValue = found.DataKeyValue); } } }
public virtual void DeleteBusinessEntity(IBeheerContextEntity beheerContextEntity) { IBeheerContextEntity found = FindBusinessEntity(m_BusinessEntities, beheerContextEntity as BeheerContextEntity); if (found != null) { m_BusinessEntities.Remove(found as BeheerContextEntity); //SelectedMaster.Details.Remove(found as BeheerContextEntity); if (beheerContextEntity.Parent != null) { if (m_QueueMasters != null && m_QueueMasters.Count > 0 && beheerContextEntity.Parent != null) m_QueueMasters[beheerContextEntity.Parent.Id].Details. Remove(beheerContextEntity as BeheerContextEntity); } } }