Ejemplo n.º 1
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Confirm Payment?", "ATTENTION", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                //compra
                if (lblOwned.Text != "Owned")
                {
                    int    i        = lbGames.SelectedIndex;
                    string gameName = storeGames[i].GetName();

                    DBSteamDataSet db = new DBSteamDataSet();
                    DBSteamDataSetTableAdapters.GameOfLibraryTableAdapter GameOfLibraryTableAdapter = new DBSteamDataSetTableAdapters.GameOfLibraryTableAdapter();

                    DBSteamDataSet.GameOfLibraryRow newGameOfLibraryRow = db.GameOfLibrary.NewGameOfLibraryRow();


                    DBSteamDataSetTableAdapters.AchievementOfLibraryTableAdapter AchievementOfLibraryTableAdapter = new DBSteamDataSetTableAdapters.AchievementOfLibraryTableAdapter();

                    DBSteamDataSet.GameOfLibraryRow newAchievementOfLibraryRow = db.GameOfLibrary.NewGameOfLibraryRow();
                    GameOfLibraryTableAdapter.Insert(0, userID, storeGames[i].getGameID());

                    int achID;
                    int gameOfLibraryID = 0;
                    int j = 0;

                    SqlDataReader MineReader = DatabaseAccess.getDataFromDB("SELECT ID FROM [GameOfLibrary] WHERE userID ='" + Convert.ToString(userID) + "' AND gameID = '" + storeGames[i].getGameID() + "'");
                    if (MineReader.Read())
                    {
                        gameOfLibraryID = Convert.ToInt32(MineReader["ID"].ToString());
                    }

                    while (true)
                    {
                        try
                        {
                            achID = storeGames[i].achievementsvector[j].ID;
                            AchievementOfLibraryTableAdapter.Insert(gameOfLibraryID, achID, 0);
                            j++;
                        }
                        catch
                        {
                            break;
                        }
                    }

                    MessageBox.Show("Sale succeeded");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("You already have the selected game");
                }
            }
            else
            {
                MessageBox.Show("Sale cancelled");
            }
        }
Ejemplo n.º 2
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Confirm Payment?", "ATTENTION", MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes)
            {
                //compra
                if (lblOwned.Text != "Owned")
                {
                    int i = lbGames.SelectedIndex;
                    string gameName = storeGames[i].GetName();

                    DBSteamDataSet db = new DBSteamDataSet();
                    DBSteamDataSetTableAdapters.GameOfLibraryTableAdapter GameOfLibraryTableAdapter = new DBSteamDataSetTableAdapters.GameOfLibraryTableAdapter();

                    DBSteamDataSet.GameOfLibraryRow newGameOfLibraryRow = db.GameOfLibrary.NewGameOfLibraryRow();

                    DBSteamDataSetTableAdapters.AchievementOfLibraryTableAdapter AchievementOfLibraryTableAdapter = new DBSteamDataSetTableAdapters.AchievementOfLibraryTableAdapter();

                    DBSteamDataSet.GameOfLibraryRow newAchievementOfLibraryRow = db.GameOfLibrary.NewGameOfLibraryRow();
                    GameOfLibraryTableAdapter.Insert(0, userID, storeGames[i].getGameID());

                    int achID;
                    int gameOfLibraryID = 0;
                    int j = 0;

                    SqlDataReader MineReader = DatabaseAccess.getDataFromDB("SELECT ID FROM [GameOfLibrary] WHERE userID ='" + Convert.ToString(userID) + "' AND gameID = '" + storeGames[i].getGameID() + "'");
                    if (MineReader.Read())
                    {
                        gameOfLibraryID = Convert.ToInt32(MineReader["ID"].ToString());
                    }

                    while (true)
                        try
                        {
                            achID = storeGames[i].achievementsvector[j].ID;
                            AchievementOfLibraryTableAdapter.Insert(gameOfLibraryID, achID, 0);
                            j++;
                        }
                        catch
                        {
                            break;
                        }

                    MessageBox.Show("Sale succeeded");
                    this.Close();
                }
                else
                    MessageBox.Show("You already have the selected game");

            }
            else
            {
                MessageBox.Show("Sale cancelled");
            }
        }
Ejemplo n.º 3
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            string errorString = "";
            bool   showMessage = false;

            isFilled = new bool[7];
            if (txtRptPassword.Text != typedPassword)
            {
                errorString += "The given password doesn't match with the previous one.\n";
                isFilled[0]  = false;
                showMessage  = true;
            }
            if (txtCity.Text == "" || txtCountry.Text == "" || txtEmail.Text == "" || txtPhoneNumber.Text == "" || txtState.Text == "" || txtZipCode.Text == "")
            {
                errorString += "All fields must be filled in order to create an account!";
                showMessage  = true;
            }
            if (showMessage)
            {
                MessageBox.Show(errorString);
            }
            else
            {
                DBSteamDataSet db = new DBSteamDataSet();
                DBSteamDataSetTableAdapters.UserTableAdapter userTableAdapter =
                    new DBSteamDataSetTableAdapters.UserTableAdapter();

                DBSteamDataSetTableAdapters.AddressTableAdapter addressTableAdapter =
                    new DBSteamDataSetTableAdapters.AddressTableAdapter();

                DBSteamDataSet.UserRow newUserRow = db.User.NewUserRow();
                userTableAdapter.Insert(txtEmail.Text, 0, typedPassword, txtPhoneNumber.Text, 0, typedUsername);

                SqlDataReader MineReader = DatabaseAccess.getDataFromDB("SELECT ID FROM [User] WHERE userName LIKE '" + typedUsername + "'");
                int           id         = 0;
                if (MineReader.Read())
                {
                    id = Convert.ToInt32(MineReader["ID"].ToString());
                    DBSteamDataSet.AddressRow newAddressRow = db.Address.NewAddressRow();
                    addressTableAdapter.Insert(id, txtCity.Text, txtCountry.Text, txtState.Text, txtZipCode.Text, "default");
                }
                MessageBox.Show("Account successfully created!");
                this.Close();
            }
        }
Ejemplo n.º 4
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            string errorString = "";
            bool showMessage = false;
            isFilled = new bool[7];
            if (txtRptPassword.Text != typedPassword)
            {
                errorString += "The given password doesn't match with the previous one.\n";
                isFilled[0] = false;
                showMessage = true;
            }
            if (txtCity.Text == "" || txtCountry.Text == "" || txtEmail.Text == "" || txtPhoneNumber.Text == "" || txtState.Text == "" || txtZipCode.Text == "")
            {
                errorString += "All fields must be filled in order to create an account!";
                showMessage = true;
            }
            if (showMessage)
                MessageBox.Show(errorString);
            else
            {
                DBSteamDataSet db = new DBSteamDataSet();
                DBSteamDataSetTableAdapters.UserTableAdapter userTableAdapter =
                            new DBSteamDataSetTableAdapters.UserTableAdapter();

                DBSteamDataSetTableAdapters.AddressTableAdapter addressTableAdapter =
                            new DBSteamDataSetTableAdapters.AddressTableAdapter();

                DBSteamDataSet.UserRow newUserRow = db.User.NewUserRow();
                userTableAdapter.Insert(txtEmail.Text, 0, typedPassword, txtPhoneNumber.Text, 0, typedUsername);

                 SqlDataReader MineReader = DatabaseAccess.getDataFromDB("SELECT ID FROM [User] WHERE userName LIKE '" + typedUsername + "'");
                 int id = 0;
                 if (MineReader.Read())
                 {
                     id = Convert.ToInt32(MineReader["ID"].ToString());
                     DBSteamDataSet.AddressRow newAddressRow = db.Address.NewAddressRow();
                     addressTableAdapter.Insert(id,txtCity.Text,txtCountry.Text,txtState.Text,txtZipCode.Text,"default");
                 }
                 MessageBox.Show("Account successfully created!");
                this.Close();
            }
        }