Пример #1
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);
            }
        }
Пример #2
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();
        }
Пример #3
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();
        }
Пример #4
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();
        }
Пример #5
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);
        }
Пример #6
0
        private void fillCustomersListFromDatabase()
        {
            MySQLDatabase md = new MySQLDatabase();
            MySQLDatabaseInterface mdi = md.getDatabaseInterface();
            mdi.open();
            string query = "SELECT * FROM pvevo ";
            DataTable dtCustomer = mdi.getToDataTable(query);
            mdi.close();

            foreach(DataRow row in dtCustomer.Rows)
            {
                int customerID = Convert.ToInt32(row["vazon"].ToString());
                string customerName = row["vnev"].ToString();
                string customerAddress = row["vcim"].ToString();
                Customer c = new Customer(customerID, customerName, customerAddress);
                customers.Add(c);
            }
        }