Ejemplo n.º 1
0
        public void deleteGunInDB(Gun delG)
        {
            MySQLDatabase          msd = new MySQLDatabase();
            MySQLDatabaseInterface mdi = msd.getDatabaseInterface();
            string query = delG.getDeleteQuery();

            mdi.open();
            mdi.executeDMQuery(query); //insert update delete
            mdi.close();
        }
Ejemplo n.º 2
0
        public void addGunToDB(Gun editedG)
        {
            MySQLDatabase          msd = new MySQLDatabase();
            MySQLDatabaseInterface mdi = msd.getDatabaseInterface();
            string query = editedG.getInsertQuery();

            mdi.open();
            mdi.executeDMQuery(query); //insert update delete
            mdi.close();
        }
Ejemplo n.º 3
0
        private void buttonNewGep_Click(object sender, EventArgs e)
        {
            Adatbazis ujida = new Adatbazis();
            MySQLDatabaseInterface mdiujid = ujida.kapcsolodas();

            mdiujid.open();
            int Id   = Convert.ToInt32(mdiujid.executeScalarQuery("SELECT MAX(id) FROM gepek"));
            int ujId = Id + 1;

            mdiujid.close();

            string gyarto   = textBoxGyarto.Text;
            string sorozat  = textBoxSorozat.Text;
            string tipus    = textBoxTipus.Text;
            int    tipusId  = Convert.ToInt32(textBoxTipusId.Text);
            double pixel    = Convert.ToDouble(textBoxPixel.Text);
            string szenzor  = textBoxSzenzor.Text;
            string objektiv = textBoxObjektiv.Text;
            int    ar       = Convert.ToInt32(textBoxAr.Text);

            Adatbazis updateDatabase    = new Adatbazis();
            MySQLDatabaseInterface umdi = updateDatabase.kapcsolodas();

            umdi.open(); string query = "";
            query += "INSERT INTO gepek (id,gyarto,sorozat,tipus,tipusId,pixel,szenzor,objektiv,ar) VALUES ";
            query += "(" + ujId + ", ";
            query += "\"" + gyarto + "\", ";
            query += "\"" + sorozat + "\", ";
            query += "\"" + tipus + "\", ";
            query += tipusId + ", ";
            query += pixel + ", ";
            query += "\"" + szenzor + "\", ";
            query += "\"" + objektiv + "\", ";
            query += ar + ")";
            umdi.executeDMQuery(query);

            MessageBox.Show(query);

            MessageBox.Show("Sikeres Adatfelvétel");
            umdi.close();

            int sor = dataGridViewGepek.Rows.Count - 1;

            dataGridViewGepek.Rows[sor].Cells["id"].Value       = ujId;
            dataGridViewGepek.Rows[sor].Cells["gyarto"].Value   = gyarto;
            dataGridViewGepek.Rows[sor].Cells["sorozat"].Value  = sorozat;
            dataGridViewGepek.Rows[sor].Cells["tipus"].Value    = tipus;
            dataGridViewGepek.Rows[sor].Cells["tipusId"].Value  = tipusId;
            dataGridViewGepek.Rows[sor].Cells["pixel"].Value    = pixel;
            dataGridViewGepek.Rows[sor].Cells["szenzor"].Value  = szenzor;
            dataGridViewGepek.Rows[sor].Cells["objektiv"].Value = objektiv;
            dataGridViewGepek.Rows[sor].Cells["ar"].Value       = ar;

            feltoltVezerlotAdatbazisbolMindenAdattal();
        }
Ejemplo n.º 4
0
        private void dataGridViewGepek_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int sor   = dataGridViewGepek.SelectedRows[0].Index;
            int gepid = Convert.ToInt32(dataGridViewGepek.Rows[sor].Cells["id"].Value);

            ClassGepek g = new ClassGepek(
                Convert.ToInt32(dataGridViewGepek.SelectedRows[0].Cells["id"].Value),
                dataGridViewGepek.SelectedRows[0].Cells["gyarto"].Value.ToString(),
                dataGridViewGepek.SelectedRows[0].Cells["sorozat"].Value.ToString(),
                dataGridViewGepek.SelectedRows[0].Cells["tipus"].Value.ToString(),
                Convert.ToInt32(dataGridViewGepek.SelectedRows[0].Cells["tipusId"].Value),
                Convert.ToDouble(dataGridViewGepek.SelectedRows[0].Cells["pixel"].Value),
                dataGridViewGepek.SelectedRows[0].Cells["szenzor"].Value.ToString(),
                dataGridViewGepek.SelectedRows[0].Cells["objektiv"].Value.ToString(),
                Convert.ToInt32(dataGridViewGepek.SelectedRows[0].Cells["ar"].Value));


            FormModosit fm = new FormModosit(g);

            if (fm.ShowDialog(this) == DialogResult.OK)
            {
                MessageBox.Show("Sikeres módosítás!");
                ClassGepek modositottGepek = fm.getModositottGepek();

                Adatbazis updateDatabase     = new Adatbazis();
                MySQLDatabaseInterface umdi  = updateDatabase.kapcsolodas();
                umdi.open(); string    query = "";
                query += "UPDATE gepek ";
                query += "SET gyarto=\"" + modositottGepek.getGyarto() + "\"";
                query += ", sorozat=\"" + modositottGepek.getSorozat() + "\"";
                query += ", tipus=\"" + modositottGepek.getTipus() + "\"";
                query += ", tipusId=\"" + modositottGepek.getTipusId() + "\"";
                query += ", pixel=" + modositottGepek.getPixel();
                query += ", szenzor=\"" + modositottGepek.getSzenzor() + "\"";
                query += ", objektiv=\"" + modositottGepek.getObjektiv() + "\"";
                query += ", ar=" + modositottGepek.getAr();
                query += " WHERE id=" + modositottGepek.getId();


                umdi.executeDMQuery(query);

                MessageBox.Show("Sikeres módosítás:" + modositottGepek.ToString()); umdi.close();

                dataGridViewGepek.Rows[sor].Cells["gyarto"].Value   = modositottGepek.getGyarto();
                dataGridViewGepek.Rows[sor].Cells["sorozat"].Value  = modositottGepek.getSorozat();
                dataGridViewGepek.Rows[sor].Cells["tipus"].Value    = modositottGepek.getTipus();
                dataGridViewGepek.Rows[sor].Cells["tipusId"].Value  = modositottGepek.getTipusId();
                dataGridViewGepek.Rows[sor].Cells["pixel"].Value    = modositottGepek.getPixel();
                dataGridViewGepek.Rows[sor].Cells["szenzor"].Value  = modositottGepek.getSzenzor();
                dataGridViewGepek.Rows[sor].Cells["objektiv"].Value = modositottGepek.getObjektiv();
                dataGridViewGepek.Rows[sor].Cells["ar"].Value       = modositottGepek.getAr();
            }
        }
Ejemplo n.º 5
0
        public void addcustomerToDatabase(Customer customer)
        {
            MySQLDatabase          msd = new MySQLDatabase();
            MySQLDatabaseInterface mdi = msd.getDatabaseInterface();
            string query = customer.getInsertQuery();

            mdi.open();

            mdi.executeDMQuery(query);
            System.Windows.Forms.MessageBox.Show(query);

            mdi.close();
        }
Ejemplo n.º 6
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int             ujId = 0;
            GepekOperations go   = new GepekOperations(ujId);

            ujId = go.getUjId();

            string gyarto   = textBoxGyarto.Text;
            string sorozat  = textBoxSorozat.Text;
            string tipus    = textBoxTipus.Text;
            double pixel    = Convert.ToDouble(textBoxPixel.Text);
            string szenzor  = textBoxSzenzor.Text;
            string objektiv = textBoxObjektiv.Text;
            int    ar       = Convert.ToInt32(textBoxAr.Text);

            Database update = new Database();

            mdi = update.kapcsolodas();
            mdi.open(); string query = "";
            query += "INSERT INTO gepek (id,gyarto,sorozat,tipus,pixel,szenzor,objektiv,ar) VALUES ";
            query += "(" + ujId + ", ";
            query += "\"" + gyarto + "\", ";
            query += "\"" + sorozat + "\", ";
            query += "\"" + tipus + "\", ";
            query += pixel + ", ";
            query += "\"" + szenzor + "\", ";
            query += "\"" + objektiv + "\", ";
            query += ar + ")";
            mdi.executeDMQuery(query);
            mdi.close();

            int sor = dataGridViewGepek.Rows.Count - 1;

            dataGridViewGepek.Rows[sor].Cells["id"].Value       = ujId;
            dataGridViewGepek.Rows[sor].Cells["gyarto"].Value   = gyarto;
            dataGridViewGepek.Rows[sor].Cells["sorozat"].Value  = sorozat;
            dataGridViewGepek.Rows[sor].Cells["tipus"].Value    = tipus;
            dataGridViewGepek.Rows[sor].Cells["pixel"].Value    = pixel;
            dataGridViewGepek.Rows[sor].Cells["szenzor"].Value  = szenzor;
            dataGridViewGepek.Rows[sor].Cells["objektiv"].Value = objektiv;
            dataGridViewGepek.Rows[sor].Cells["ar"].Value       = ar;

            textBoxGyarto.Clear();
            textBoxSorozat.Clear();
            textBoxTipus.Clear();
            textBoxPixel.Clear();
            textBoxSzenzor.Clear();
            textBoxObjektiv.Clear();
            textBoxAr.Clear();
        }
        public void modositPizza(Pizza ujPizza, int modositandoPizzaAzonosito)
        {
            string query = ujPizza.getSQLUpdate();

            query += " WHERE pazon=" + modositandoPizzaAzonosito;
            Debug.WriteLine(query);
            Adatbazis a = new Adatbazis();
            MySQLDatabaseInterface mdi = new MySQLDatabaseInterface();

            mdi = a.kapcsolodas();
            if (mdi.open())
            {
                mdi.executeDMQuery(query);
                mdi.close();
            }
            else
            {
                throw new Exception("Pizza adatbázis megnyitása nem sikerült");
            }
        }
Ejemplo n.º 8
0
        private void buttonAddO_Click(object sender, EventArgs e)
        {
            int ujObjektivId      = 0;
            ObjektivOperations oo = new ObjektivOperations(ujObjektivId);

            ujObjektivId = oo.getUjObjektivId();

            bool stabil = false;

            if (radioButtonVan.Checked)
            {
                stabil = true;
            }
            else
            {
                stabil = false;
            }

            string tipus     = textBoxTipusO.Text;
            string gyarto    = textBoxGyartoO.Text;
            string nev       = textBoxNev.Text;
            int    gyujtotav = Convert.ToInt32(textBoxGyujto.Text);
            double minblende = Convert.ToDouble(textBoxMinB.Text);
            double maxblende = Convert.ToDouble(textBoxMaxB.Text);
            int    hossz     = Convert.ToInt32(textBoxHossz.Text);
            int    suly      = Convert.ToInt32(textBoxSuly.Text);
            int    ar        = Convert.ToInt32(textBoxArO.Text);

            Database update = new Database();

            mdi = update.kapcsolodas();
            mdi.open(); string query = "";
            query += "INSERT INTO objektiv (id, tipus, gyarto, nev, gyujtotav, stabil, minblende, maxblende, hossz, suly, ar) VALUES ";
            query += "(" + ujObjektivId + ", ";
            query += "\"" + tipus + "\", ";
            query += "\"" + gyarto + "\", ";
            query += "\"" + nev + "\", ";
            query += gyujtotav + ", ";
            query += stabil + ", ";
            query += minblende + ", ";
            query += maxblende + ", ";
            query += hossz + ", ";
            query += suly + ", ";
            query += ar + ")";
            mdi.executeDMQuery(query);
            mdi.close();

            int sor = dataGridViewObjektiv.Rows.Count - 1;

            dataGridViewObjektiv.Rows[sor].Cells["id"].Value        = ujObjektivId;
            dataGridViewObjektiv.Rows[sor].Cells["tipus"].Value     = tipus;
            dataGridViewObjektiv.Rows[sor].Cells["gyarto"].Value    = gyarto;
            dataGridViewObjektiv.Rows[sor].Cells["nev"].Value       = nev;
            dataGridViewObjektiv.Rows[sor].Cells["gyujtotav"].Value = gyujtotav;
            dataGridViewObjektiv.Rows[sor].Cells["stabil"].Value    = stabil;
            dataGridViewObjektiv.Rows[sor].Cells["minblende"].Value = minblende;
            dataGridViewObjektiv.Rows[sor].Cells["maxblende"].Value = maxblende;
            dataGridViewObjektiv.Rows[sor].Cells["hossz"].Value     = hossz;
            dataGridViewObjektiv.Rows[sor].Cells["suly"].Value      = suly;
            dataGridViewObjektiv.Rows[sor].Cells["ar"].Value        = ar;

            textBoxTipusO.Clear();
            textBoxGyartoO.Clear();
            textBoxNev.Clear();
            textBoxGyujto.Clear();
            textBoxMinB.Clear();
            textBoxMaxB.Clear();
            textBoxHossz.Clear();
            textBoxSuly.Clear();
            textBoxArO.Clear();
        }