Esempio n. 1
0
 private void btnSpremi_Click(object sender, EventArgs e)
 {
     if (txtKolicina.Text != "")
     {
         try
         {
             decimal temp = Convert.ToDecimal(txtKolicina.Text);
         }
         catch
         {
             MessageBox.Show("Količina sadrži samo brojeve!");
             return;
         }
     }
     if (txtKolicina.Text != "" && txtKolicina.Text.Contains(","))
     {
         MessageBox.Show("Količina se unosi s točkom, a ne zarezom");
         return;
     }
     if (txtNaziv.Text != "" && txtKolicina.Text != "" && (rbKilogram.Checked || rbKomad.Checked || rbLitra.Checked))
     {
         using (var db = new Entities17045_DB())
         {
             var A = db.zalihes.ToList();
             foreach (var item in A)
             {
                 if (item.naziv == txtNaziv.Text)
                 {
                     MessageBox.Show("Zaliha je već unesena!");
                     txtKolicina.Clear();
                     txtNaziv.Clear();
                     rbKilogram.Checked = false;
                     rbKomad.Checked    = false;
                     rbLitra.Checked    = false;
                     return;
                 }
             }
             NoveZalihe noveZalihe = new NoveZalihe();
             noveZalihe.DodajZalihe(txtNaziv.Text, decimal.Parse(txtKolicina.Text), decimal.Parse(txtKriticnaKolicina.Text),
                                    rbKilogram, rbLitra, rbKomad);
         }
         PrikaziZalihe();
         PromjeniBoju();
     }
     else
     {
         MessageBox.Show("Potrebno je unijeti sve podatke!");
     }
     txtKolicina.Clear();
     txtKriticnaKolicina.Clear();
     txtNaziv.Clear();
     rbKilogram.Checked = false;
     rbKomad.Checked    = false;
     rbLitra.Checked    = false;
 }
Esempio n. 2
0
        private void btnObrisi_Click_1(object sender, EventArgs e)
        {
            zalihe odabraneZalihe = zaliheBindingSource.Current as zalihe;

            NoveZalihe noveZalihe = new NoveZalihe();

            noveZalihe.BrisiZalihe(odabraneZalihe);

            txtPretraga.Clear();
            PrikaziZalihe();
            PromjeniBoju();
        }
Esempio n. 3
0
        private void btnSpremiUmanjiti_Click(object sender, EventArgs e)
        {
            if (txtKolicinaUmanjiti.Text != "")
            {
                try
                {
                    decimal temp = Convert.ToDecimal(txtKolicinaUmanjiti.Text);
                }
                catch
                {
                    MessageBox.Show("Količina sadrži samo brojeve!");
                    return;
                }
            }
            if (txtKolicinaUmanjiti.Text != "" && txtKolicinaUmanjiti.Text.Contains(","))
            {
                MessageBox.Show("Količina se unosi s točkom, a ne zarezom");
                return;
            }
            if (txtKolicinaUmanjiti.Text != "")
            {
                zalihe odabranaZaliha = zaliheBindingSource.Current as zalihe;
                if (odabranaZaliha != null)
                {
                    NoveZalihe noveZalihe = new NoveZalihe();
                    noveZalihe.UmanjiKolicinuZaliha(odabranaZaliha, decimal.Parse(txtKolicinaUmanjiti.Text));

                    PrikaziZalihe();
                    PromjeniBoju();
                }
                else
                {
                    MessageBox.Show("Morate odabrati jednu zalihu u datagridview-u!");
                }
            }
            else
            {
                MessageBox.Show("Potrebno je unijeti sve podatke!");
            }
            txtPretraga.Clear();
            txtKolicinaUmanjiti.Clear();
        }