Exemple #1
0
        private void buttonIspisNar_Click(object sender, EventArgs e)
        {
            NarIspis ni = new NarIspis();

            ni.Show();
            ni.Refresh();
        }
Exemple #2
0
        private void btnUnos_Click(object sender, EventArgs e)
        {
            int brnar = 0;

            dateNar.Format       = DateTimePickerFormat.Custom;
            dateNar.CustomFormat = "dd-MM-yyyy";
            string constring = "datasource=localhost;port=3306;username=root2;password=madtom54";
            string upit1     = "SELECT brnarudb FROM madjo.narudbenice;";

            MySqlConnection veza    = new MySqlConnection(constring);
            MySqlCommand    naredba = new MySqlCommand(upit1, veza);
            MySqlDataReader citac;

            try
            {
                veza.Open();
                citac = naredba.ExecuteReader();
                while (citac.Read())
                {
                    brnar = citac.GetInt32("brnarudb");
                }
                veza.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            string upit = "insert into madjo.narudbenice (brnarudb, registracija, model, stanjekm, stanjegoriva, napomena, partner, adresa, oib," +
                          "datum, dokumenti, oprema, status, izradio)" +
                          "values('" + (brnar + 1) + "','" + lblReg.Text + "','" + lblModel.Text + "','" + lblStKm.Text + "','" + lblStGor.Text +
                          "','" + txtNapomena.Text + "','" + lblNazPart.Text + "','" + lblAdrPart.Text + "','" + lblOibPar.Text +
                          "','" + dateNar.Text + "','" + txtOprema.Text + "','" + txtDokumenti.Text + "','Otvoreno', '" + korisnik + "');";

            //"update madjo.automobili set status='Servis' where regoznaka='" + lblReg.Text + "';"
            veza    = new MySqlConnection(constring);
            naredba = new MySqlCommand(upit, veza);

            try
            {
                veza.Open();
                citac = naredba.ExecuteReader();
                while (citac.Read())
                {
                }
                veza.Close();
                MessageBox.Show("Unos završen.");
                NarIspis narPrint = new NarIspis();
                narPrint.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }