Example #1
0
        private void button20_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Vestina v = new Vestina();
                IList <VanredniPolicajac> listaVanrednihPolicajaca = s.QueryOver <VanredniPolicajac>().List();

                VanredniPolicajac pol = listaVanrednihPolicajaca[0];

                v.Naziv            = "Borilacke vestine";
                v.PripadaPolicajcu = pol;

                pol.Vestine.Add(v);


                s.Save(v);
                s.Flush();

                s.Close();
            }

            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
Example #2
0
        public static void DodajVestinu(VestinaView v)
        {
            try
            {
                ISession s       = DataLayer.GetSession();
                var      vestina = new Vestina();

                var policajac = s.Get <VanredniPolicajac>(v.Policajac.PolicajacId);
                if (policajac == null)
                {
                    return;
                }

                vestina.Naziv     = v.Naziv;
                vestina.Policajac = policajac;

                s.Save(vestina);
                s.Flush();
                s.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Example #3
0
        private void button24_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Vestina v = s.Get <Vestina>(2);

                //obrada podataka o odeljenju

                s.Refresh(v);

                s.Close();
            }
            catch (Exception ec)
            {
                MessageBox.Show(ec.Message);
            }
        }
Example #4
0
        private void button15_Click(object sender, EventArgs e)
        {
            try
            {
                ISession s  = DataLayer.GetSession();
                Vestina  ve = s.Load <Vestina>(3);

                MessageBox.Show(ve.Naziv);
                MessageBox.Show((ve.VestinaId).ToString());
                MessageBox.Show(ve.PripadaPolicajcu.Ime);
                MessageBox.Show((ve.PripadaPolicajcu.PolicajacId).ToString());

                s.Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Console.WriteLine(exception);
                throw;
            }
        }
 public VestinaView(Vestina v)
 {
     VestinaId = v.VestinaId;
     Naziv     = v.Naziv;
 }