コード例 #1
0
        public void DeleteItem(int uid)
        {
            var item = Galleria.RetrieveByUId(uid);

            if (item == null)
            {
                throw new BONotFoundException <Galleria>(uid);
            }
            if (item.AggregationMostra.Count > 0)
            {
                throw new BOException <Galleria>("Impossibile eliminare. Mostre collegate.");
            }

            item.Remove();
            item.Commit();
        }
コード例 #2
0
        public void SaveItem(int uid, string titolo, string sede, string persona, string indirizzo, string indirizzo2, string citta, string cap, string provincia, string telefono, string fax, string note, int categoriauid, int nazioneuid)
        {
            var item = Galleria.RetrieveByUId(uid);

            if (item == null)
            {
                throw new BONotFoundException <Galleria>(uid);
            }
            var categoria = GalleriaCategoria.RetrieveByUId(categoriauid);

            if (categoria == null)
            {
                throw new BONotFoundException <GalleriaCategoria>(categoriauid);
            }
            var nazione = Nazione.RetrieveByUId(nazioneuid);

            if (nazione == null)
            {
                throw new BONotFoundException <Nazione>(nazioneuid);
            }

            item.Titolo     = titolo;
            item.Sede       = sede;
            item.Persona    = persona;
            item.Indirizzo  = indirizzo;
            item.Indirizzo2 = indirizzo2;
            item.Citta      = citta;
            item.CAP        = cap;
            item.Provincia  = provincia;
            item.Telefono   = telefono;
            item.Fax        = fax;
            item.Note       = note;
            item.Commit();

            categoria.AggregationGalleria.Add(item);
            nazione.AggregationGalleria.Add(item);
            item.Commit();

            _view.DataObject = item;
        }
コード例 #3
0
 public void Fill(int uid)
 {
     _view.DataObject = Galleria.RetrieveByUId(uid);
 }