protected override bool beforePersistDlg(DomainObject entity)
 {
     string naslov = "Potvrda uplate";
     string pitanje = "Da li zelite da unesete ovu uplatu? Unos uplate je nepovratna operacija.";
     PotvrdaDialog dlg = new PotvrdaDialog(naslov, pitanje);
     dlg.StartPosition = FormStartPosition.Manual;
     Point location = new Point(txtNapomena.Location.X, txtNapomena.Location.Y);
     dlg.Location = this.PointToScreen(location);
     return dlg.ShowDialog() == DialogResult.Yes;
 }
        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);
            }
        }
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            MesecnaClanarina mc = (MesecnaClanarina)entity;
            Notification notification = new Notification();

            MesecnaClanarinaDAO mcDAO = DAOFactoryFactory.DAOFactory.GetMesecnaClanarinaDAO();
            if (mcDAO.findForGrupaVaziOd(mc.Grupa, mc.VaziOd) != null)
            {
                notification.RegisterMessage("Grupa", "Vec postoji clanarina za izabranu grupu i datum.");
                throw new BusinessException(notification);
            }
        }
Exemple #4
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Mesto m = (Mesto)entity;
            Notification notification = new Notification();

            MestoDAO mestoDAO = DAOFactoryFactory.DAOFactory.GetMestoDAO();
            if (mestoDAO.existsMestoNaziv(m.Naziv))
            {
                notification.RegisterMessage("Naziv", "Mesto sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Exemple #5
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Kategorija k = (Kategorija)entity;
            Notification notification = new Notification();

            KategorijaDAO katDAO = DAOFactoryFactory.DAOFactory.GetKategorijaDAO();
            if (katDAO.existsKategorijaNaziv(k.Naziv))
            {
                notification.RegisterMessage("Naziv", "Kategorija sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Exemple #6
0
        protected override void checkBusinessRulesOnAdd(DomainObject entity)
        {
            Clan clan = (Clan)entity;
            Notification notification = new Notification();

            ClanDAO clanDAO = DAOFactoryFactory.DAOFactory.GetClanDAO();
            if (clanDAO.existsClanImePrezimeDatumRodjenja(clan))
            {
                notification.RegisterMessage("Ime",
                    "Clan sa datim imenom, prezimenom i datumom rodjenja vec postoji.");
                throw new BusinessException(notification);
            }
        }
        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);
            }
        }
Exemple #8
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Mesto m = (Mesto)entity;
            Notification notification = new Notification();

            MestoDAO mestoDAO = DAOFactoryFactory.DAOFactory.GetMestoDAO();
            bool nazivChanged = (m.Naziv.ToUpper() != oldNaziv.ToUpper()) ? true : false;
            if (nazivChanged && mestoDAO.existsMestoNaziv(m.Naziv))
            {
                notification.RegisterMessage("Naziv", "Mesto sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Exemple #9
0
        protected override void checkBusinessRulesOnUpdate(DomainObject entity)
        {
            Kategorija k = (Kategorija)entity;
            Notification notification = new Notification();

            KategorijaDAO katDAO = DAOFactoryFactory.DAOFactory.GetKategorijaDAO();
            bool nazivChanged = (k.Naziv.ToUpper() != oldNaziv.ToUpper()) ? true : false;
            if (nazivChanged && katDAO.existsKategorijaNaziv(k.Naziv))
            {
                notification.RegisterMessage("Naziv", "Kategorija sa datim nazivom vec postoji.");
                throw new BusinessException(notification);
            }
        }
Exemple #10
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);
            }
        }
Exemple #11
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);
            }
        }
Exemple #12
0
        protected override bool refIntegrityDeleteDlg(DomainObject entity)
        {
            Kategorija k = (Kategorija)entity;
            GrupaDAO grupaDao = DAOFactoryFactory.DAOFactory.GetGrupaDAO();

            if (grupaDao.existsGrupa(k))
            {
                string msg = "Kategoriju '{0}' nije moguce izbrisati zato sto postoje " +
                    "grupe za datu kategoriju. \n\nDa bi neka kategorija mogla da se " +
                    "izbrise, uslov je da ne postoje grupe za tu kategoriju. To " +
                    "znaci da morate najpre da pronadjete sve grupe za datu " +
                    "kategoriju, i da zatim, u prozoru u kome " +
                    "se menjaju podaci o grupi, polje za kategoriju ostavite prazno. " +
                    "Nakon sto ste ovo uradili za sve " +
                    "grupe za datu kategoriju, moci cete da izbrisete kategoriju. ";
                MessageDialogs.showMessage(String.Format(msg, k), this.Text);
                return false;
            }
            return true;
        }
Exemple #13
0
 protected override string deleteErrorMessage(DomainObject entity)
 {
     return "Greska prilikom brisanja grupe.";
 }
Exemple #14
0
 protected override string deleteConfirmationMessage(DomainObject entity)
 {
     return String.Format("Da li zelite da izbrisete grupu \"{0}\"?", entity);
 }
Exemple #15
0
 protected override void delete(DomainObject entity)
 {
     DAOFactoryFactory.DAOFactory.GetGrupaDAO().MakeTransient((Grupa)entity);
 }
Exemple #16
0
 protected virtual bool refIntegrityDeleteDlg(DomainObject entity)
 {
     throw new Exception("Derived class should implement this method.");
 }
Exemple #17
0
 protected virtual void onEntityUpdated(DomainObject entity)
 {
     entities[getSelectedRowIndex()] = entity;
     if (sortProperty != String.Empty)
         sort(sortProperty);
     else
         refreshView();
     setSelectedEntity(entity);
 }
Exemple #18
0
 protected virtual void onEntityDeleted(DomainObject entity)
 {
     int row = getSelectedRowIndex();
     entities.Remove(entity);
     refreshView();
     if (row < entities.Count)
         setSelectedEntity(entities[row]);
     else if (entities.Count > 0)
         setSelectedEntity(entities[entities.Count - 1]);
 }
Exemple #19
0
 protected virtual bool beforePersistDlg(DomainObject entity)
 {
     return true;
 }
Exemple #20
0
 protected virtual void updateUIFromEntity(DomainObject entity)
 {
     throw new Exception("Derived class should implement this method.");
 }
Exemple #21
0
 protected virtual void initUpdateMode(int entityId)
 {
     // Najpre se ucitava objekt, zatim ostali podaci potrebni za UI,
     // i tek nakon toga se inicijalizuje UI. Razlog za ovakav redosled je
     // slucaj kada neko svojstvo objekta utice na UI (npr. koje ce
     // opcije prisutne u combo box-u.)
     entity = getEntityById(entityId);
     saveOriginalData(entity);
     loadData();
     initUI();
     updateUIFromEntity(entity);
 }
Exemple #22
0
        protected override bool refIntegrityDeleteDlg(DomainObject entity)
        {
            Grupa g = (Grupa)entity;
            UplataClanarineDAO uplataDao = DAOFactoryFactory.DAOFactory.GetUplataClanarineDAO();
            MesecnaClanarinaDAO mesecnaClanarinaDao = DAOFactoryFactory.DAOFactory.GetMesecnaClanarinaDAO();

            if (uplataDao.existsUplataGrupa(g))
            {
                string msg = "Grupu '{0}' nije moguce izbrisati zato sto postoje " +
                    "podaci o uplatama za datu grupu.";
                MessageDialogs.showMessage(String.Format(msg, g), this.Text);
                return false;
            }
            else if (mesecnaClanarinaDao.existsClanarinaGrupa(g))
            {
                string msg = "Grupu '{0}' nije moguce izbrisati zato sto postoji " +
                    "cenovnik za datu grupu. \n\nDa bi mogli da izbrisete neku grupu, " +
                    "morate najpre da izbrisete cenovnik za tu grupu. ";
                MessageDialogs.showMessage(String.Format(msg, g), this.Text);
                return false;
            }
            return true;
        }
Exemple #23
0
 protected virtual void initAddMode()
 {
     entity = createNewEntity();
     loadData();
     initUI();
 }
Exemple #24
0
 protected override void insertEntity(DomainObject entity)
 {
     DAOFactoryFactory.DAOFactory.GetMestoDAO().MakePersistent((Mesto)entity);
 }
Exemple #25
0
 protected virtual void saveOriginalData(DomainObject entity)
 {
     // Empty
 }
Exemple #26
0
 protected virtual void delete(DomainObject entity)
 {
     throw new Exception("Derived class should implement this method.");
 }
Exemple #27
0
 protected virtual void validateEntity(DomainObject entity)
 {
     Notification notification = new Notification();
     entity.validate(notification);
     if (!notification.IsValid())
         throw new BusinessException(notification);
 }
Exemple #28
0
 protected virtual string deleteErrorMessage(DomainObject entity)
 {
     throw new Exception("Derived class should implement this method.");
 }
Exemple #29
0
 protected virtual void checkBusinessRulesOnUpdate(DomainObject entity)
 {
     // Empty
 }
Exemple #30
0
 protected virtual void onEntityAdded(DomainObject entity)
 {
     entities.Add(entity);
     if (entities.Count == 1)
     {
         // Lista je bila prazna, sto znaci da mora ponovo da se uradi data
         // binding da bi grid znao tipove objekata
         setEntities(entities);
     }
     if (sortProperty != String.Empty)
         sort(sortProperty);
     else
         refreshView();
     setSelectedEntity(entity);
 }