private void btnAddPrevoznik_Click(object sender, EventArgs e)
        {
            this.prevoznik = new Prevoznik(txtImePrevoznik.Text, txtLogoUrl.Text, txtWebStrana.Text, new List <Linija>());

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 public void LiniiRefresh()
 {
     lstLinii.Items.Clear();
     tekoven = lstPrevoznici.SelectedItem as Prevoznik;
     if (tekoven != null)
     {
         foreach (Linija linija in tekoven.Linii)
         {
             lstLinii.Items.Add(linija);
         }
     }
 }
Beispiel #3
0
        private void btnAddPrevoznik_Click(object sender, EventArgs e)
        {
            DodadiPrevoznik_Admin dodadi = new DodadiPrevoznik_Admin();

            if (dodadi.ShowDialog() == DialogResult.OK)
            {
                Prevoznik a = dodadi.prevoznik;
                LogIn.Prevoznici.Add(a);
                lstPrevoznici.Items.Clear();
                PrevozniciRefresh();
            }
            LogIn.objekt = new Ser(LogIn.Prevoznici);
            System.Runtime.Serialization.IFormatter fmt = new
                                                          System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
            FileStream strm = new FileStream("avtobuska.db", FileMode.Create,
                                             FileAccess.Write, FileShare.None);

            fmt.Serialize(strm, LogIn.objekt);
            strm.Close();

            VkupnoRefresh();
        }
Beispiel #4
0
        private void btnRemoveLinija_Click(object sender, EventArgs e)
        {
            Potvrda potvrda = new Potvrda();

            if (potvrda.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Prevoznik s = lstPrevoznici.SelectedItem as Prevoznik;
                s.Linii.Remove(lstLinii.SelectedItem as Linija);
                LiniiRefresh();


                LogIn.objekt = new Ser(LogIn.Prevoznici);
                System.Runtime.Serialization.IFormatter fmt = new
                                                              System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                FileStream strm = new FileStream("avtobuska.db", FileMode.Create,
                                                 FileAccess.Write, FileShare.None);
                fmt.Serialize(strm, LogIn.objekt);
                strm.Close();
            }

            VkupnoRefresh();
        }
 private void lstPrevoznici_SelectedIndexChanged(object sender, EventArgs e)
 {
     tekoven = lstPrevoznici.SelectedItem as Prevoznik;
     LiniiRefresh();
     btnKupiGuest.Enabled = false;
 }