Пример #1
0
        public static void dodajStaratelja(UcenikBasic u, StarateljBasic staratelj)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Staratelj o = new Staratelj();
                o.Ime        = staratelj.Ime;
                o.Prezime    = staratelj.Prezime;
                o.ClanSaveta = staratelj.clanSaveta;
                Ucenik ucenik = s.Load <Ucenik>(u.Id);
                o.ListaDece.Add(ucenik);
                s.SaveOrUpdate(o);
                //ucenik.ListaStaratelja.Add(o);


                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Пример #2
0
        private void btnSacuvaj_Click(object sender, EventArgs e)
        {
            if (!validacija())
            {
                return;
            }
            String ime     = txbIme.Text;
            String prezime = txbPrezime.Text;
            int    clan    = 0;

            if (chBClanRodSaveta.Checked == true)
            {
                clan = 1;
            }
            StarateljBasic    s       = new StarateljBasic(ime, prezime, clan);
            string            poruka  = "Da li zelite da dodate staratelja?";
            string            title   = "Pitanje";
            MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
            DialogResult      result  = MessageBox.Show(poruka, title, buttons);

            if (result == DialogResult.OK)
            {
                DTOManager.dodajStaratelja(ucenik, s);
            }
            else
            {
            }
            this.popuniPodacima();
            txbIme.ResetText();
            txbPrezime.ResetText();
        }