protected override void checkBusinessRulesOnAdd(DomainObject entity) { Gimnasticar g = (Gimnasticar)entity; Notification notification = new Notification(); GimnasticarDAO gimnasticarDAO = DAOFactoryFactory.DAOFactory.GetGimnasticarDAO(); if (gimnasticarDAO.postojiGimnasticar(g.Ime, g.Prezime)) { notification.RegisterMessage("Ime", "Gimnasticar sa datim imenom i prezimenom vec postoji."); throw new BusinessException(notification); } }
protected override void checkBusinessRulesOnUpdate(DomainObject entity) { Gimnasticar g = (Gimnasticar)entity; Notification notification = new Notification(); GimnasticarDAO gimnasticarDAO = DAOFactoryFactory.DAOFactory.GetGimnasticarDAO(); bool imeChanged = (g.Ime.ToUpper() != oldIme.ToUpper()) ? true : false; bool prezimeChanged = (g.Prezime.ToUpper() != oldPrezime.ToUpper()) ? true : false; if ((imeChanged || prezimeChanged) && gimnasticarDAO.postojiGimnasticar(g.Ime, g.Prezime)) { notification.RegisterMessage("Ime", "Gimnasticar sa datim imenom i prezimenom vec postoji."); throw new BusinessException(notification); } }