コード例 #1
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Grupa        g            = (Grupa)entity;
            Notification notification = new Notification();

            GrupaDAO grupaDAO = DAOFactoryFactory.DAOFactory.GetGrupaDAO();

            if (grupaDAO.existsGrupaSifra(g.Sifra))
            {
                notification.RegisterMessage("Sifra", "Grupa sa datom sifrom vec postoji.");
                throw new BusinessException(notification);
            }
            if (grupaDAO.existsGrupaNaziv(g.Naziv))
            {
                notification.RegisterMessage("Naziv", "Grupa sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
コード例 #2
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Grupa        g            = (Grupa)entity;
            Notification notification = new Notification();

            GrupaDAO grupaDAO     = DAOFactoryFactory.DAOFactory.GetGrupaDAO();
            bool     sifraChanged = (g.Sifra != oldSifra) ? true : false;

            if (sifraChanged && grupaDAO.existsGrupaSifra(g.Sifra))
            {
                notification.RegisterMessage("Sifra", "Grupa sa datom sifrom vec postoji.");
                throw new BusinessException(notification);
            }

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

            if (nazivChanged && grupaDAO.existsGrupaNaziv(g.Naziv))
            {
                notification.RegisterMessage("Naziv", "Grupa sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }