private void button1_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         int             id       = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
         MySqlConnection konekcij = ConnectionPool.checkOutConnection();
         MySqlCommand    cm       = konekcij.CreateCommand();
         cm.CommandText = "update ski_obuca set Nedostupan=1 where IdObuce=" + id + ";";
         cm.ExecuteNonQuery();
         MessageBox.Show("Uspješno ste obrisali stavku!");
     }
 }
Beispiel #2
0
        public void provjera()
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    c         = konekcija.CreateCommand();

            c.CommandText = "select * from iznajmljivanjaSvihKorisnikaKojaNisuVracena;";
            MySqlDataReader read      = c.ExecuteReader();
            var             dataTable = new DataTable();

            dataTable.Load(read);
            dataGridView1.DataSource         = dataTable;
            dataGridView1.Columns[0].Visible = false;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    cmd       = konekcija.CreateCommand();

            cmd.CommandText = "insert into servisiranje (DatumServisiranja,IdOpreme,JMBGZaposleni,Opis) values(current_date()," + id + "," + idservisera + ",'" + textBox1.Text.ToString() + "');";
            if (cmd.ExecuteNonQuery().ToString().Equals("1"))
            {
                MessageBox.Show("Uspješno ste dodali servis !");
            }
            konekcija.Close();
            //forma.Show();
            this.Dispose();
        }
        public void provjera()
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    cmddd     = konekcija.CreateCommand();

            cmddd.CommandText = "call listaSvihRezervacijaKorisnikBuducnost('" + jmbgkorisnik + "');";
            MySqlDataReader readdd    = cmddd.ExecuteReader();
            var             dataTable = new DataTable();

            dataTable.Load(readdd);
            dataGridView1.DataSource         = dataTable;
            dataGridView1.Columns[0].Visible = false;
            konekcija.Close();
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            MySqlConnection connection      = ConnectionPool.checkOutConnection();
            MySqlCommand    command         = connection.CreateCommand();
            int             id_proizvodjaca = Int32.Parse(comboBox1.SelectedValue.ToString());
            int             id_tipa         = Int32.Parse(comboBox2.SelectedValue.ToString());

            command.CommandText = "insert into ski_obuca (Naziv, Boja, Cijena,Broj,IdProizvodjaca,IdTipa,Nedostupan) " +
                                  "values" +
                                  "('" + textBox1.Text + "', '" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "', " + id_proizvodjaca + "," + id_tipa + ",0);";
            command.ExecuteNonQuery();
            connection.Close();
            MessageBox.Show("Uspjesno ste dodali novu obuću!");
            this.Dispose();
        }
Beispiel #6
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         MySqlConnection konekcija = ConnectionPool.checkOutConnection();
         MySqlCommand    cmdd      = konekcija.CreateCommand();
         cmdd.CommandText = "update iznajmljivanje set DatumVracanja=current_date() where IdIznajmljivanja=" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ";";
         cmdd.ExecuteNonQuery();
         MessageBox.Show("Uspješno ste izvršili upit! ");
     }
     else
     {
         MessageBox.Show("Niste izabrali nijednu rezervaciju! ");
     }
 }
        private void ServiserForma_Load(object sender, EventArgs e)
        {
            radioButton1.Checked = true;
            radioButton4.Checked = true;
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    cmd       = konekcija.CreateCommand();

            cmd.CommandText = "SELECT Ime from OSOBA where jmbg=" + jmbgserviser;
            MySqlDataReader read = cmd.ExecuteReader();

            while (read.Read())
            {
                label6.Text = read["Ime"].ToString();
            }
            konekcija.Close();
            provjera();
        }
        private void button8_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                MySqlConnection konekcija = ConnectionPool.checkOutConnection();
                MySqlCommand    cmd       = konekcija.CreateCommand();
                DateTime        aa        = DateTime.Today;
                cmd.CommandText = "update rezervacija set Otkazano=1 where IdRezervacije=" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ";";
                cmd.ExecuteNonQuery();
                MessageBox.Show("Uspjesno ste otkazali rezervaciju!");
            }

            else
            {
                MessageBox.Show("Niste izabrali nijednu rezervaciju !");
            }
        }
Beispiel #9
0
        public void provjera()
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    cmd       = konekcija.CreateCommand();

            if (radioButton5.Checked)
            {
                if (radioButton1.Checked)
                {
                    cmd.CommandText = "SELECT * FROM dostupneSkijeRezervacijaDanas";
                }
                else if (radioButton2.Checked)
                {
                    cmd.CommandText = "SELECT * FROM skijeNaServisuDanas";
                }
                else
                {
                    cmd.CommandText = "SELECT * FROM iznajmljeneSkijeDanas";
                }
            }
            else
            {
                if (radioButton1.Checked)
                {
                    cmd.CommandText = "SELECT * FROM dostupniSnowboardiRezervacijaDanas";
                }
                else if (radioButton2.Checked)
                {
                    cmd.CommandText = "SELECT * FROM snowboardnaservisuDanas";
                }
                else
                {
                    cmd.CommandText = "SELECT * FROM iznajmljeniSnowboardDanas";
                }
            }
            MySqlDataAdapter myAdapter = new MySqlDataAdapter(cmd); // Adapter
            DataSet          ds        = new DataSet();

            myAdapter.Fill(ds); // DataSet <- Adapter
            dataGridView1.DataSource         = ds.Tables[0];
            dataGridView1.Columns[0].Visible = false;
        }
Beispiel #10
0
        public void provjera()
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    cmdd      = konekcija.CreateCommand();

            if (radioButton4.Checked) //obuca
            {
                cmdd.CommandText = "call listaRezervisaneObuceId(" + id + "); ";
            }
            else
            {
                cmdd.CommandText = "call listaRezervisaneOpremeId(" + id + "); ";
            }
            MySqlDataReader readd     = cmdd.ExecuteReader();
            var             dataTable = new DataTable();

            dataTable.Load(readd);
            dataGridView1.DataSource         = dataTable;
            dataGridView1.Columns[0].Visible = false;
        }
Beispiel #11
0
        public void provjera()
        {
            MySqlConnection konekcija = ConnectionPool.checkOutConnection();
            MySqlCommand    c         = konekcija.CreateCommand();

            if (radioButton1.Checked) //REZERVACIJE
            {
                c.CommandText = "select * from rezervacijeBuduceSvihKorisnika;";
            }
            else   //IZNAJMLJIVANJA
            {
                c.CommandText = "select * from iznajmljivanjaDanasSvihKorisnika;";
            }

            MySqlDataReader read      = c.ExecuteReader();
            var             dataTable = new DataTable();

            dataTable.Load(read);
            dataGridView1.DataSource         = dataTable;
            dataGridView1.Columns[0].Visible = false;
        }
Beispiel #12
0
        private void DodajObucu_Load(object sender, EventArgs e)
        {
            MySqlConnection connection = ConnectionPool.checkOutConnection();
            MySqlCommand    command    = connection.CreateCommand();

            command.CommandText = "select IdProizvodjaca,Naziv from Proizvodjac;";
            MySqlDataReader          reader       = command.ExecuteReader();
            Dictionary <int, String> proizvodjaci = new Dictionary <int, string>();

            proizvodjaci.Add(0, "Izaberi proizvođaca");
            while (reader.Read())
            {
                proizvodjaci.Add(Int32.Parse(reader["IdProizvodjaca"].ToString()), reader["Naziv"].ToString());
            }
            comboBox1.DataSource    = new BindingSource(proizvodjaci, null);
            comboBox1.DisplayMember = "Value";
            comboBox1.ValueMember   = "Key";
            comboBox1.SelectedIndex = 0;
            reader.Close();
            MySqlCommand commandd = connection.CreateCommand();

            commandd.CommandText = "select IdTipa,Naziv from Tip;";
            MySqlDataReader          readerr = commandd.ExecuteReader();
            Dictionary <int, String> tipovi  = new Dictionary <int, string>();

            tipovi.Add(0, "Izaberi tip");
            while (readerr.Read())
            {
                tipovi.Add(Int32.Parse(readerr["IdTipa"].ToString()), readerr["Naziv"].ToString());
            }
            comboBox2.DataSource    = new BindingSource(tipovi, null);
            comboBox2.DisplayMember = "Value";
            comboBox2.ValueMember   = "Key";
            comboBox2.SelectedIndex = 0;
            connection.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int ukupanBroj = rezObuca.Count + rezOprema.Count;

            if (ukupanBroj != 0)
            {
                DateTime aa   = DateTime.Now;
                String   dat  = datumPocetkaDateTimePicker.Value.Date.ToString("yyyy-MM-dd");
                long     idPK = 0;

                if (!(izna) && dat.Equals(aa.Date.ToString("yyyy-MM-dd")) && int.Parse(aa.Hour.ToString()) > 11)
                {
                    MessageBox.Show("U ovom terminu nije moguće rezervisati stavku!");
                }
                else
                {
                    MySqlConnection konekcija = ConnectionPool.checkOutConnection();
                    MySqlCommand    cmd       = konekcija.CreateCommand();

                    if (izna)
                    {
                        cmd.CommandText = "insert into iznajmljivanje (JMBGZaposleni,JMBG,IznajmljenoOdDatuma,CijenaIznajmljivanja) values('" + jmbgradnik + "','" + jmbgkorisnik + "','" + aa.Date.ToString("yyyy.MM.dd") + "',0);";
                    }
                    else
                    {
                        cmd.CommandText = "insert into rezervacija (JMBGZaposleni,JMBG,RezervisanoZaDan,DatumRezervacije,Otkazano) values('" + jmbgradnik + "','" + jmbgkorisnik + "','" + dat + "','" + aa.Date.ToString("yyyy.MM.dd") + "',0);";
                    }
                    cmd.ExecuteNonQuery();
                    idPK = cmd.LastInsertedId;
                    for (int i = 0; i < rezObuca.Count; i++)
                    {
                        MySqlCommand cmdd = konekcija.CreateCommand();
                        if (izna)
                        {
                            cmdd.CommandText = "insert into i_obuca (IdIznajmljivanja,IdObuce) values(" + idPK + "," + rezObuca.ElementAt(i) + ");";
                        }
                        else
                        {
                            cmdd.CommandText = "insert into r_obuca (IdRezervacije,IdObuce) values(" + idPK + "," + rezObuca.ElementAt(i) + ");";
                        }
                        cmdd.ExecuteNonQuery();
                    }
                    for (int j = 0; j < rezOprema.Count; j++)
                    {
                        MySqlCommand cmdd = konekcija.CreateCommand();
                        if (izna)
                        {
                            cmdd.CommandText = "insert into i_oprema (IdIznajmljivanja,IdOpreme) values(" + idPK + "," + rezOprema.ElementAt(j) + ");";
                        }
                        else
                        {
                            cmdd.CommandText = "insert into r_oprema (IdRezervacije,IdOpreme) values(" + idPK + "," + rezOprema.ElementAt(j) + ");";
                        }
                        cmdd.ExecuteNonQuery();
                    }
                    MessageBox.Show("Uspješno !");
                    rezOprema.Clear();
                    rezObuca.Clear();
                    label4.Text = rezObuca.Count + rezOprema.Count + "";
                    provjera();
                }
            }
            else
            {
                MessageBox.Show("Niste izabrali nijednu stavku!");
            }
        }
Beispiel #14
0
        private void button7_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                if (radioButton1.Checked)
                {
                    string          jmbgz     = "";
                    MySqlConnection konekcija = ConnectionPool.checkOutConnection();
                    MySqlCommand    cmd       = konekcija.CreateCommand();
                    cmd.CommandText = "call provjeraCijaJeRezervacija(" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ");";
                    MySqlDataReader read = cmd.ExecuteReader();
                    string          dat  = "";
                    DateTime        aa   = DateTime.Today;
                    while (read.Read())
                    {
                        dat   = read["RezervisanoZaDan"].ToString();
                        jmbgz = read["JMBG"].ToString();
                    }
                    read.Close();
                    if (jmbgz.Equals(jmbgkorisnik) && dat.Substring(0, 9).Equals(aa.Date.ToString("M/d/yyyy")))
                    {
                        long         idPK = 0;
                        MySqlCommand cmdd = konekcija.CreateCommand();
                        cmdd.CommandText = "update rezervacija set Otkazano=1 where IdRezervacije=" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ";";
                        cmdd.ExecuteNonQuery();
                        MySqlCommand c = konekcija.CreateCommand();
                        c.CommandText = "insert into iznajmljivanje (JMBGZaposleni,JMBG,IznajmljenoOdDatuma,CijenaIznajmljivanja) values('" + jmbgradnik + "','" + jmbgkorisnik + "','" + aa.Date.ToString("yyyy-MM-dd") + "',999);";
                        c.ExecuteNonQuery();
                        idPK = c.LastInsertedId;
                        MySqlCommand cmddd = konekcija.CreateCommand();
                        cmddd.CommandText = "call svaRezervisanaObucaId(" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ");";
                        MySqlDataReader readd = cmddd.ExecuteReader();
                        int             idOb;
                        double          cije;
                        while (readd.Read())
                        {
                            idOb = int.Parse(readd["IdObuce"].ToString());
                            cije = double.Parse(readd["Cijena"].ToString());
                            MySqlConnection konekcijaa = ConnectionPool.checkOutConnection();
                            MySqlCommand    cm         = konekcijaa.CreateCommand();
                            cm.CommandText = "insert into i_obuca values(" + idPK + "," + idOb + "," + cije + ");";
                            cm.ExecuteNonQuery();
                        }
                        readd.Close();
                        MySqlCommand cmde = konekcija.CreateCommand();
                        cmde.CommandText = "call svaRezervisanaOpremaId(" + int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString()) + ");";
                        MySqlDataReader readder = cmde.ExecuteReader();

                        while (readder.Read())
                        {
                            idOb = int.Parse(readder["IdOpreme"].ToString());
                            cije = double.Parse(readder["Cijena"].ToString());
                            MySqlConnection konekcij = ConnectionPool.checkOutConnection();
                            MySqlCommand    cm       = konekcij.CreateCommand();
                            cm.CommandText = "insert into i_oprema values(" + idPK + "," + idOb + "," + cije + ");";
                            cm.ExecuteNonQuery();
                        }
                        readder.Close();

                        MessageBox.Show("Vasa rezervacija je prosla !");
                        //provjera();
                    }
                    else
                    {
                        MessageBox.Show("Nije moguce preuzeti rezervaciju");
                    }
                }

                else
                {
                    MessageBox.Show("Niste izabrali nijednu rezervaciju !");
                }
            }
            else
            {
                MessageBox.Show("Niste izabrali nijednu rezervaciju !");
            }
        }