Exemplo n.º 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
            }
        }
Exemplo n.º 2
0
        private void VratiListuTelefona_Click(object sender, EventArgs e)
        {
            ISession s = DataLayer.GetSession();

            Staratelj r = s.Load <Staratelj>(7);

            foreach (Telefoni t in r.ListaTelefona)
            {
                MessageBox.Show(r.Ime + " " + r.Prezime + " broj telefona: " + t.BrojTelefona + ".");
            }
            s.Close();
        }
Exemplo n.º 3
0
        private void VratiListuDece_Click(object sender, EventArgs e)
        {
            ISession s = DataLayer.GetSession();

            Staratelj r = s.Load <Staratelj>(1);

            foreach (Ucenik u in r.ListaDece)
            {
                MessageBox.Show(u.Ime + " " + u.Prezime + " - staratelj: " + r.Ime + " " + r.Prezime);
            }
            s.Close();
        }
Exemplo n.º 4
0
        public static void obrisiTelefon(int idTelefona)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Telefoni  o         = s.Load <Telefoni>(idTelefona);
                Staratelj staratelj = new Staratelj();
                staratelj = o.Staratelj_Id;
                staratelj.ListaTelefona.Remove(o);
                s.Delete(o);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Exemplo n.º 5
0
        public static void azurirajStaratelja(StarateljPregled n)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Staratelj o = s.Load <Staratelj>(n.Id);
                o.Ime        = n.Ime;
                o.Prezime    = n.Prezime;
                o.ClanSaveta = n.clanSaveta;

                s.Update(o);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Exemplo n.º 6
0
        public static StarateljPregled vratiStaratelja(int id)
        {
            StarateljPregled st = new StarateljPregled();

            try
            {
                ISession s = DataLayer.GetSession();

                Staratelj o = s.Load <Staratelj>(id);
                st.Ime        = o.Ime;
                st.Prezime    = o.Prezime;
                st.clanSaveta = o.ClanSaveta;
                st.Id         = o.Id;

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
            return(st);
        }
Exemplo n.º 7
0
        public static void obrisiStaratelja(int id)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Staratelj o     = s.Load <Staratelj>(id);
                int       count = o.ListaDece.Count;
                for (int i = 0; i < count; i++)
                {
                    o.ListaDece.RemoveAt(i);
                }
                s.Delete(o);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }