private void btnPrebaraj_Click(object sender, EventArgs e)
        {
            Filijala  fil = null;
            Avtomobil avt = null;

            if (lbFilijali.Items.Count > 0)
            {
                foreach (Filijala f in lbFilijali.Items)
                {
                    if (f.avto.Count > 0)
                    {
                        Avtomobil max = f.avto[0];
                        foreach (Avtomobil a in f.avto)
                        {
                            if (a.cena <= max.cena)
                            {
                                fil = f;
                                avt = a;
                            }
                        }
                    }
                }
            }
            if (fil != null && avt != null)
            {
                MessageBox.Show(String.Format("Најевтин автомобил: {0}\nОд Филијала: {1}", avt, fil));
            }
        }
 private void btnRezerviraj_Click(object sender, EventArgs e)
 {
     if (lbAvtomobili.SelectedIndex != -1)
     {
         Avtomobil avto = (Avtomobil)lbAvtomobili.Items[lbAvtomobili.SelectedIndex];
         avto.rezerviran = true;
         prikazi();
     }
 }
示例#3
0
 private void btnDodadi_Click(object sender, EventArgs e)
 {
     if (tbMarka.Text == "" || nudCena.Value == 0 || isValid(tbJacina.Text))
     {
         MessageBox.Show("Внесете валидни податоци!");
         return;
     }
     avtomobil    = new Avtomobil(tbMarka.Text, nudCena.Value, Convert.ToInt32(tbJacina.Text));
     DialogResult = DialogResult.OK;
 }