Example #1
0
        public static void dodajAngazman(AngazmanBasic a)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Angazman o = new Angazman();
                o.DatumOd   = a.DatumOd;
                o.DatumDo   = a.DatumDo;
                o.Nastavnik = s.Load <NastavnoOsoblje>(a.Nastavnik.Id);
                o.Predmet   = s.Load <Predmet>(a.Predmet.Id);



                s.SaveOrUpdate(o);


                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Example #2
0
        public static void obrisiAngazman(int id)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Angazman o = s.Load <Angazman>(id);
                s.Delete(o);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Example #3
0
        public static AngazmanBasic azurirajAngazman(AngazmanBasic a)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Angazman o = s.Load <Angazman>(a.Id);
                o.DatumOd = a.DatumOd;
                o.DatumDo = a.DatumDo;
                s.Update(o);
                s.Flush();

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

            return(a);
        }
Example #4
0
        public static AngazmanBasic vratiAngazman(int id)
        {
            AngazmanBasic ob = new AngazmanBasic();

            try
            {
                ISession s = DataLayer.GetSession();

                Angazman          o = s.Load <Angazman>(id);
                NastavnoLiceBasic n = DTOManager.vratiNastavnoLice(o.Nastavnik.Id);
                PredmetBasic      p = DTOManager.vratiPredmet(o.Predmet.Id);
                ob = new AngazmanBasic(o.Id, o.DatumOd, o.DatumDo, n, p);

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

            return(ob);
        }