Example #1
0
        protected override bool refIntegrityDeleteDlg(DomainObject entity)
        {
            Mesto          m       = (Mesto)entity;
            ClanDAO        clanDao = DAOFactoryFactory.DAOFactory.GetClanDAO();
            InstitucijaDAO instDao = DAOFactoryFactory.DAOFactory.GetInstitucijaDAO();

            if (clanDao.existsClanMesto(m))
            {
                string msg = "Mesto '{0}' nije moguce izbrisati zato sto postoje " +
                             "clanovi iz datog mesta. \n\nDa bi neko mesto moglo da se izbrise, " +
                             "uslov je da ne postoje clanovi iz datog mesta. To znaci da morate " +
                             "najpre da pronadjete sve clanove iz datog mesta, i da zatim, u " +
                             "prozoru u kome " +
                             "se menjaju podaci o clanu, polje za mesto ostavite prazno. " +
                             "Nakon sto ste ovo uradili za sve " +
                             "clanove iz datog mesta, moci cete da izbrisete mesto. ";
                MessageDialogs.showMessage(String.Format(msg, m), this.Text);
                return(false);
            }
            else if (instDao.existsInstitucijaMesto(m))
            {
                string msg = "Mesto '{0}' nije moguce izbrisati zato sto postoje " +
                             "institucije iz datog mesta. \n\nDa bi neko mesto moglo da se izbrise, " +
                             "uslov je da ne postoje institucije iz datog mesta. To znaci da morate " +
                             "najpre da pronadjete sve institucije iz datog mesta, i da zatim, u " +
                             "prozoru u kome " +
                             "se menjaju podaci o instituciji, polje za mesto ostavite prazno. " +
                             "Nakon sto ste ovo uradili za sve " +
                             "institucije iz datog mesta, moci cete da izbrisete mesto. ";
                MessageDialogs.showMessage(String.Format(msg, m), this.Text);
                return(false);
            }
            return(true);
        }
Example #2
0
        protected override List <object> loadEntities()
        {
            InstitucijaDAO institucijaDAO = DAOFactoryFactory.DAOFactory.GetInstitucijaDAO();

            return(new List <Institucija>(institucijaDAO.FindAll()).ConvertAll <object>(
                       delegate(Institucija i)
            {
                return i;
            }));
        }
Example #3
0
 public object Get(DataSourceLoadOptions loadOptions)
 {
     try
     {
         var institutions = InstitucijaDAO.GetAllInstitutions();
         return(DataSourceLoader.Load(institutions, loadOptions));
     }
     catch (Exception)
     {
         return(DataSourceLoader.Load(new List <InstitucijaModel>(), loadOptions));
     }
 }
Example #4
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Institucija  inst         = (Institucija)entity;
            Notification notification = new Notification();

            InstitucijaDAO instDAO = DAOFactoryFactory.DAOFactory.GetInstitucijaDAO();

            if (instDAO.existsInstitucijaNaziv(inst.Naziv))
            {
                notification.RegisterMessage("Naziv", "Institucija sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Example #5
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Institucija    inst         = (Institucija)entity;
            Notification   notification = new Notification();
            InstitucijaDAO instDAO      = DAOFactoryFactory.DAOFactory.GetInstitucijaDAO();

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

            if (nazivChanged && instDAO.existsInstitucijaNaziv(inst.Naziv))
            {
                notification.RegisterMessage("Naziv", "Institucija sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }