Example #1
0
        private void proveraListe()
        {
            baza.OtvoriKonekciju();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = baza.Conn;
            cmd.CommandText = "SELECT * FROM Racun";
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Racun racun = new Racun();
                racun.ID             = int.Parse(reader["id_racun"].ToString());
                racun.UkupnaCena     = float.Parse(reader["cena"].ToString());
                racun.DatumIzdavanja = DateTime.Parse(reader["datum"].ToString());
                racun.VremeIzdavanja = DateTime.Parse(reader["vreme"].ToString());

                lista.Add(racun);
            }

            LSBRacuna.DataSource    = lista;
            LSBRacuna.DisplayMember = ToString();

            baza.ZatvoriKonekciju();
        }
Example #2
0
        private void ucitajLSBGrupa()
        {
            baza.OtvoriKonekciju();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = baza.Conn;
            cmd.CommandText = "SELECT * FROM Grupa";
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Grupa grp = new Grupa();
                grp.ID    = int.Parse(reader["id_grupa"].ToString());
                grp.Naziv = reader["naziv"].ToString();


                grupe.Add(grp);
            }
            baza.ZatvoriKonekciju();
            LSBGrupa.DataSource    = grupe;
            LSBGrupa.DisplayMember = "naziv";
            LSBGrupa.ValueMember   = "id";
        }
Example #3
0
        private void napraviArtikal()
        {
            baza.OtvoriKonekciju();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection = baza.Conn;

            cmd.CommandText = @"INSERT INTO Artikal(naziv,cena,popust)     
                 VALUES (@naziv,@cena,@popust)";
            cmd.Parameters.AddWithValue("naziv", textBox1.Text);
            cmd.Parameters.AddWithValue("cena", float.Parse(textBox2.Text));
            cmd.Parameters.AddWithValue("popust", float.Parse(textBox3.Text));
            int uspesno = cmd.ExecuteNonQuery();

            if (uspesno > 0)
            {
                MessageBox.Show("Artikal dodat");
            }
            else
            {
                MessageBox.Show("Greska");
            }
            baza.ZatvoriKonekciju();
        }