Ejemplo n.º 1
0
        private void fillProductListFromDataTable()
        {
            ops = new DBOperation();
            Adatbazis a = new Adatbazis();
            MySQLDatabaseInterface mdi = a.kapcsolodas();

            mdi.open();
            string    query      = "SELECT * FROM regitermekek ";
            DataTable dtCustomer = mdi.getToDataTable(query);

            mdi.close();

            foreach (DataRow row in dtCustomer.Rows)
            {
                int    Tkod    = Convert.ToInt32(row["Tkod"].ToString());
                string Tnev    = row["Tnev"].ToString();
                int    Tar     = Convert.ToInt32(row["Tar"].ToString());
                int    Tkeszl  = Convert.ToInt32(row["Tkeszl"].ToString());
                string Tmert   = row["Tmert"].ToString();
                int    Tkatkod = Convert.ToInt32(row["Tkatkod"].ToString());
                int    Tvonkod = Convert.ToInt32(row["Tvonkod"].ToString());

                DateTime Tszavido = Convert.ToDateTime(row["Tszavido"].ToString());


                bool         Tegalizalte = Convert.ToBoolean(row["Tegalizalte"].ToString());
                Regitermekek c           = new Regitermekek(Tkod, Tnev, Tar, Tkeszl, Tmert, Tkatkod, Tvonkod, Tszavido, Tegalizalte);
                oldProductsList.Add(c);
            }
        }
Ejemplo n.º 2
0
        private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
        {
            Adatbazis a = new Adatbazis();

            mdi = a.kapcsolodas();
            mdi.open();
            string selectedIntAzon = "";

            string where = "";
            /*dataGridView1.Columns.RemoveAt(1);*/


            selectedIntAzon = comboBox1.SelectedItem.ToString();


            if (selectedIntAzon != "összes")
            {
                where = " WHERE partnerek.IntAzon=" + selectedIntAzon;
                /*dataGridView1.Columns.RemoveAt(2);*/

                dataGridView1.DataSource = null;
                dataTableGyakorisag      = mdi.getToDataTable("SELECT * FROM partnerek" + where);
                dataGridView1.DataSource = dataTableGyakorisag;
                dataGridView1.Columns[0].DisplayIndex = 2;
            }
            else if (selectedIntAzon == "összes")
            {
                dataGridView1.DataSource = null;
                dataTableGyakorisag      = mdi.getToDataTable("select * from partnerek");
                dataGridView1.DataSource = dataTableGyakorisag;
                dataGridView1.Columns[0].DisplayIndex = 2;
            }
        }
Ejemplo n.º 3
0
        private void fillGunsList()
        {
            MySQLDatabase          md  = new MySQLDatabase();
            MySQLDatabaseInterface mdi = md.getDatabaseInterface();

            mdi.open();
            string    query  = "SELECT * FROM fegyverek";
            DataTable dTGuns = mdi.getToDataTable(query);

            mdi.close();

            foreach (DataRow row in dTGuns.Rows)
            {
                int    gunID       = Convert.ToInt32(row["FID"].ToString());
                string gunManufact = row["gyarto"].ToString();
                string gunName     = row["nev"].ToString();
                int    gunType     = Convert.ToInt32(row["tipus"].ToString());
                int    gunFps      = Convert.ToInt32(row["FPS"].ToString());
                int    gunWeight   = Convert.ToInt32(row["suly"].ToString());
                string gunMaterial = row["anyag"].ToString();
                int    gunPrice    = Convert.ToInt32(row["ar"].ToString());
                int    gunVariant  = Convert.ToInt32(row["varians"].ToString());
                Gun    g           = new Gun(gunID, gunManufact, gunName, gunType, gunFps, gunWeight, gunMaterial, gunPrice, gunVariant);
                guns.Add(g);
            }
        }
Ejemplo n.º 4
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            Database d = new Database();

            mdi = d.kapcsolodas();
            mdi.open();
            string username = textBoxUsername.Text;
            string password = textBoxPassword.Text;

            userDT = mdi.getToDataTable("SELECT username,password FROM user WHERE username = '******'");
            if (userDT.Rows.Count != 0)
            {
                foreach (DataRow row in userDT.Rows)
                {
                    if (Crypter.CheckPassword(password, row["password"].ToString()))
                    {
                        //sikeres belépés
                        this.Hide();
                        FormGepek fg = new FormGepek();//átvezetjük a felhasználót a FormGepek-re
                        fg.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Helytelen Jelszó!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Helytelen Felhasználónév!");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// A DataGridView új adatfelvitelekor lehetőség van alapértelmezett értékeke megadására
        /// Ezt a lehetőséget használjuk ki az új azonosító meghatározására
        /// </summary>
        private void dataGridViewHalfaj_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            //A checkbox mezőknek meg kell adni kezdőértéket
            e.Row.Cells[4].Value = false;
            e.Row.Cells[5].Value = false;

            //Készítünk egy új kapcsolatot az adatbázishoz
            Adatbazis ujida = new Adatbazis();
            MySQLDatabaseInterface mdiujid = ujida.kapcsolodas();

            mdiujid.open();

            //Készítünk egy lekérdezést az új halid meghatározására
            int  max;
            bool siker = int.TryParse(mdiujid.executeScalarQuery("SELECT MAX(halid) FROM halfaj"), out max);

            if (!siker)
            {
                MessageBox.Show(
                    "Nem lehet megállapítani a következő rekord kulcsát. Adatbázis lekérdezési hiba. Új adat felvitele nem lehetséges",
                    "Hiba...",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }
            mdiujid.close();
            e.Row.Cells[0].Value = max + 1;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Az adatábzis kapcsolat segítségével feltölti a DataGridView-t az adattábla minden adatával
        /// </summary>
        private void feltoltVezerlotAdatbazisbolMindenAdattal()
        {
            Adatbazis a = new Adatbazis();

            mdi = a.kapcsolodas();
            mdi.open();
            halfajokDT = mdi.getToDataTable("SELECT * FROM halfaj");
            dataGridViewHalfaj.DataSource = halfajokDT;
        }
Ejemplo n.º 7
0
        private void loadGun()
        {
            Adatbazis a = new Adatbazis();

            mdi = a.kapcsolodas();
            mdi.open();
            tableGun         = mdi.getToDataTable("SELECT * FROM fegyverek");
            dTGVF.DataSource = tableGun;
        }
Ejemplo n.º 8
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.º 9
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.º 10
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.º 11
0
        private void feltolt()
        {
            Adatbazis a = new Adatbazis();

            mdi      = a.kapcsolodas(); mdi.open();
            termekek = mdi.getToDataTable("SELECT * FROM termekek");

            dataGridView1.DataSource = termekek;
            szerkesztés.Visible      = false;
            buttonMod.Visible        = true;
        }
Ejemplo n.º 12
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();
            }
        }
        internal string getLastChatDate(string lastChatDate)
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query_datum = "SELECT datum FROM chat ORDER BY datum DESC LIMIT 1;";

            lastChatDate = mdi.executeScalarQuery(query_datum);

            return(lastChatDate);
        }
        internal string getLastPicDate(string lastPic)
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT feltolt_datum FROM kepek ORDER BY feltolt_datum DESC LIMIT 1;";

            lastPic = mdi.executeScalarQuery(query);

            return(lastPic);
        }
        public string getKepekNumber(string kepekNumber)
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT COUNT(id) FROM kepek;";

            kepekNumber = mdi.executeScalarQuery(query);

            return(kepekNumber);
        }
        internal string getLastUserReg(string userReg)
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT regdatum FROM user ORDER BY regdatum DESC LIMIT 1;";

            userReg = mdi.executeScalarQuery(query);

            return(userReg);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Feltölti a gépek táblát adatbázisból
        /// </summary>
        private void AdatokFeltoltese()
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT * FROM gepek;";

            DTG = mdi.getToDataTable(query);
            mdi.close();
            dataGridViewGepek.DataSource = DTG;
        }
Ejemplo n.º 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            betoltesutaniAllapot();
            dataGridViewEdzesek.ReadOnly              = true;
            dataGridViewEdzesek.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
            dataGridViewEdzesek.AllowUserToDeleteRows = false;
            Adatbazis a = new Adatbazis(); mdi = a.kapcsolodas();

            mdi.open();
            edzesekdt = mdi.getToDataTable("SELECT * FROM edzes");
            dataGridViewEdzesek.DataSource = edzesekdt;
        }
        public string getUserNumber(string userNumber)
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT COUNT(id) FROM user;";

            userNumber = mdi.executeScalarQuery(query);

            return(userNumber);
        }
Ejemplo n.º 20
0
        public MySQLDatabaseInterface kapcsolodas()
        {
            MySQLDatabaseInterface mdi = new MySQLDatabaseInterface();

            mdi.setErrorToUserInterface(true);
            mdi.setErrorToGraphicalUserInterface(false);
            mdi.setConnectionServerData("localhost", "fotosseged", "3306");
            mdi.setConnectionUserData("root", "");
            mdi.makeConnectionToDatabase();

            return(mdi);
        }
Ejemplo n.º 21
0
        private void UserAdatokFeltoltese()
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT id, username, neme, email, admin FROM user;";

            DTU = mdi.getToDataTable(query);
            mdi.close();
            dataGridViewUsers.DataSource = DTU;
        }
Ejemplo n.º 22
0
        private void ObjektivAdatokFeltoltese()
        {
            Database md = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query = "SELECT * FROM objektiv;";

            DTO = mdi.getToDataTable(query);
            mdi.close();
            dataGridViewObjektiv.DataSource = DTO;
        }
Ejemplo n.º 23
0
        public int getUjId()
        {
            Database d = new Database();

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

            umdi.close();

            return(ujId);
        }
Ejemplo n.º 24
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.º 25
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();
        }
Ejemplo n.º 26
0
        private void fillCustomerListFromDataBase()
        {
            MySQLDatabaseInterface mdi = new MySQLDatabaseInterface();
            Adatbazis a = new Adatbazis();

            mdi = a.kapcsolodas();
            mdi.open();
            string    query = "select * from pvevo";
            DataTable dt    = mdi.getToDataTable(query);

            mdi.close();
            foreach (DataRow rw in dt.Rows)
            {
            }
        }
Ejemplo n.º 27
0
        public int getFID()
        {
            MySQLDatabase          ujID   = new MySQLDatabase();
            MySQLDatabaseInterface mdujid = ujID.getDatabaseInterface();

            mdujid.open();
            int  max;
            bool siker = int.TryParse(mdujid.executeScalarQuery("SELECT MAX(FID) FROM fegyverek"), out max);

            if (!siker)
            {
                //MessageBox.Show("Nem lehet megállapítani a következő rekord kulcsát. Adatbázis lekérdezési hiba.", "Hiba...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            mdujid.close();
            return(max + 1);
        }
        internal string getLastChatUser(string lastChatUser)
        {
            string   lastChatUid = "";
            Database md          = new Database();

            mdi = md.kapcsolodas();
            mdi.open();
            string query_uid = "SELECT user_id FROM chat ORDER BY datum DESC LIMIT 1;";

            lastChatUid = mdi.executeScalarQuery(query_uid);
            string query_user = "******" + lastChatUid;

            lastChatUser = mdi.executeScalarQuery(query_user);

            return(lastChatUser);
        }
Ejemplo n.º 29
0
        private void dTGVF_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            Adatbazis ujID = new Adatbazis();
            MySQLDatabaseInterface mdujid = ujID.kapcsolodas();

            mdujid.open();
            int  max;
            bool siker = int.TryParse(mdujid.executeScalarQuery("SELECT MAX(FID) FROM fegyverek"), out max);

            if (!siker)
            {
                MessageBox.Show("Nem lehet megállapítani a következő rekord kulcsát. Adatbázis lekérdezési hiba.", "Hiba...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            mdujid.close();
            e.Row.Cells[0].Value = max + 1;
        }
Ejemplo n.º 30
0
        private void fillCustomersListFromDatabase()
        {
            Adatbazis a = new Adatbazis();
            MySQLDatabaseInterface mdi = a.kapcsolodas();
            mdi.open();
            string query = "SELECT * FROM besz ";
            DataTable dtCustomer = mdi.getToDataTable(query);
            mdi.close();

            foreach (DataRow row in dtCustomer.Rows)
            {

                MDBesz c = new MDBesz(Convert.ToInt32(row["azon"].ToString()),row["nev"].ToString(),Convert.ToInt32(row["tel"].ToString()),row["email"].ToString(), row["kapcsnev"].ToString());

                b.Add(c);
            }
        }