예제 #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string m = marka.Text;

            var a = from t in db.karticas
                    where t.broj == comboBox1.SelectedItem.ToString()
                    select t;
            var aa = from t2 in db.korisniks
                     where t2.ime == (comboBox.SelectedItem as korisnik).ime
                     select t2;
            telefon tel = new telefon();

            tel.marka       = m;
            tel.idKorisnika = aa.First().id;
            tel.idkartice   = a.FirstOrDefault().id;

            try
            {
                db.telefons.InsertOnSubmit(tel);
                db.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            w.ucitaj();
            Close();
        }
예제 #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string  s = broj.Text;
            string  o = operater.Text;
            kartica k = new kartica();

            k.broj     = s;
            k.operater = o;
            try
            {
                db.karticas.InsertOnSubmit(k);
                db.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            w.ucitaj();
            Close();
        }
예제 #3
0
        private void button_Click_1(object sender, RoutedEventArgs e)
        {
            string   i = ime.Text;
            string   a = adresa.Text;
            DateTime d = (DateTime)datum.SelectedDate;
            korisnik k = new korisnik();

            k.ime           = i;
            k.adresa        = a;
            k.datumRodjenja = d;

            try
            {
                db.korisniks.InsertOnSubmit(k);
                db.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            w.ucitaj();
            Close();
        }
예제 #4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string        s    = novSaobracaj.Text;
            korisnik      k    = (comboBox_Korisnik.SelectedItem as korisnik);
            kartica       broj = (comboBox_broj.SelectedItem as kartica);
            tipSaobracaja tip  = (comboBox_saobracaj.SelectedItem as tipSaobracaja);
            saobracaj     novi = new saobracaj();

            novi.idKartice          = k.id;
            novi.ostvareniSaobracaj = int.Parse(s);
            novi.idTipaSaobracaja   = tip.id;
            novi.datum = DateTime.Now;

            try
            {
                db.saobracajs.InsertOnSubmit(novi);
                db.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            osveziListu();
        }