Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }