예제 #1
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Ekipa        ekipa        = (Ekipa)entity;
            Notification notification = new Notification();
            EkipaDAO     ekipaDAO     = DAOFactoryFactory.DAOFactory.GetEkipaDAO();

            if (ekipaDAO.existsEkipaNaziv(rezTakmicenje.Id, ekipa.Naziv))
            {
                notification.RegisterMessage("Naziv", "Ekipa sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }

            if (ekipaDAO.existsEkipaKod(rezTakmicenje.Id, ekipa.Kod))
            {
                notification.RegisterMessage("Kod", "Ekipa sa datim kodom vec postoji.");
                throw new BusinessException(notification);
            }
        }
예제 #2
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Ekipa        ekipa        = (Ekipa)entity;
            Notification notification = new Notification();
            EkipaDAO     ekipaDAO     = DAOFactoryFactory.DAOFactory.GetEkipaDAO();

            bool nazivChanged = (ekipa.Naziv.ToUpper() != oldNaziv.ToUpper()) ? true : false;

            if (nazivChanged && ekipaDAO.existsEkipaNaziv(rezTakmicenje.Id, ekipa.Naziv))
            {
                notification.RegisterMessage("Naziv", "Ekipa sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }

            bool kodChanged = (ekipa.Kod.ToUpper() != oldKod.ToUpper()) ? true : false;

            if (kodChanged && ekipaDAO.existsEkipaKod(rezTakmicenje.Id, ekipa.Kod))
            {
                notification.RegisterMessage("Kod", "Ekipa sa datim kodom vec postoji.");
                throw new BusinessException(notification);
            }
        }