private void BtnChangePassword_Click(object sender, EventArgs e) { if (txtCurrentPassword.Text == "") { MessageBox.Show("Current Password can not be empty."); return; } if (!PlayerDataBaseControl.MatchingPassword(txtCurrentPassword.Text)) { MessageBox.Show("Current Password is wrong."); txtCurrentPassword.Text = ""; return; } if (!FormatChecking.Password(txtNewPassword.Text)) { txtNewPassword.Text = ""; txtNewPasswordAgain.Text = ""; return; } if (txtNewPassword.Text != txtNewPasswordAgain.Text) { MessageBox.Show("New password again is not equal to new password."); txtNewPassword.Text = ""; txtNewPasswordAgain.Text = ""; return; } PlayerDataBaseControl.Updata_PlayerPassword(txtNewPassword.Text); Close(); }
private void LuckDraw() { MessageBox.Show("You are correct!\nYou has a lucky draw."); randomNum = rnd.Next(1, 100); double mult = 1; if (randomNum <= 50) { mult = 1.1; MessageBox.Show("Chance of increasing 10 % of topped-up Virtual Gold Coins."); } else if (randomNum <= 50 + 30) { mult = 1.2; MessageBox.Show("Chance of increasing 20 % of topped-up Virtual Gold Coins."); } else if (randomNum <= 50 + 30 + 15) { mult = 1.5; MessageBox.Show("Chance of increasing 50 % of topped-up Virtual Gold Coins."); } else if (randomNum <= 50 + 30 + 15 + 5) { mult = 2; MessageBox.Show("Chance of increasing 100 % of topped-up Virtual Gold Coins."); } PlayerDataBaseControl.playerGoldCoins = (int)(PlayerDataBaseControl.playerGoldCoins * mult); PlayerDataBaseControl.Updata("PlayerGoldCoins", PlayerDataBaseControl.playerGoldCoins.ToString()); PointCardDataBaseControl.Updata("RemainLuckyDrawTimes", (PointCardDataBaseControl.remainLuckyDrawTimes - 1).ToString()); Close(); }
private void BtnChangeLanguage_Click(object sender, EventArgs e) { PlayerDataBaseControl.Updata_isEnglish(!PlayerDataBaseControl.isEnglish); ((PlayerMenu)MdiParent).RefreshPage(); RefreshPage(); }
private void BtnPlayerIDEnter_Click(object sender, EventArgs e) { if (txtPlayerID.Text == "") { MessageBox.Show("Player ID can not be empty."); return; } if (!PlayerDataBaseControl.MatchingOneColumn("PlayerID", txtPlayerID.Text)) { MessageBox.Show("Player ID does not exist."); return; } if (txtPointCardID.Text == "") { MessageBox.Show("Point Card ID can not be empty."); return; } if (!DataBaseControl.MatchingOneColumn_OfTable("PointCard", "PointCardID", txtPointCardID.Text)) { MessageBox.Show("Point Card ID does not exist."); return; } PlayerDataBaseControl.playerID = txtPlayerID.Text; TopUpToPlayer(); }
private void BtnPlayerAccountNameEnter_Click(object sender, EventArgs e) { if (txtPlayerAccountName.Text == "") { MessageBox.Show("Player Account Name can not be empty."); return; } if (!PlayerDataBaseControl.MatchingOneColumn("PlayerAccountName", txtPlayerAccountName.Text)) { MessageBox.Show("Player Account Name does not exist."); return; } PlayerDataBaseControl.playerID = PlayerDataBaseControl.GetData_ByColumn("PlayerAccountName", txtPlayerAccountName.Text, "PlayerID"); PlayerDataBaseControl.Load(); if (StaffDataBaseControl.staffID != "") { ((StaffMenu)MdiParent).ChangeMDIForm_callByOtherForm(StaffMenu.Page.PlayerAccount_inSide); } else if (CSMDataBaseControl.CSMID != "") { ((CSMMenu)MdiParent).ChangeMDIForm_callByOtherForm(CSMMenu.Page.PlayerAccount_inSide); } else { MessageBox.Show("Unexpected flow."); } btnPlayerAccountNameEnter.Enabled = false; }
// It use to make it draggable. // #endregion private void TopUpToPlayer() { PlayerDataBaseControl.Load(); PointCardDataBaseControl.pointCardID = txtPointCardID.Text; PointCardDataBaseControl.Load(); int beforeGoldCoins = int.Parse(PlayerDataBaseControl.GetData("PlayerGoldCoins")); int newGoldCoins = beforeGoldCoins + PointCardDataBaseControl.goldCoins; PlayerDataBaseControl.Updata_PlayerGoldCoins(newGoldCoins); PointCardDataBaseControl.Updata_Status("Actived"); TopUpHistoryDataBaseControl.topUpDate = DateTime.Now.ToString("dd/MM/yyyy"); TopUpHistoryDataBaseControl.Insert(); MessageBox.Show("Top " + txtPointCardID.Text + " to " + PlayerDataBaseControl.playerAccountName + "(" + PlayerDataBaseControl.playerID + ")" + " Success.\n" + "\n" + "The Point Card retail value is " + PointCardDataBaseControl.retailValue + ".\n" + "The Point Card gold coins value is " + PointCardDataBaseControl.goldCoins + ".\n" + "\n" + "The PlayerGoldCoins of " + txtPlayerAccountName.Text + " from " + beforeGoldCoins + " to " + newGoldCoins + "."); txtPlayerID.Text = ""; txtPlayerAccountName.Text = ""; txtPointCardID.Text = ""; }
private void BtnChangeEmail_Click(object sender, EventArgs e) { if (txtNewName.Text == "") { MessageBox.Show("Name should not be empty."); return; } PlayerDataBaseControl.Updata_PlayerName(txtNewName.Text); Close(); }
private void BtnTopUp_Click(object sender, EventArgs e) { if (PointCardDataBaseControl.status != "Actived") { tryTimes++; if (tryTimes == 4) { PointCardDataBaseControl.Updata_Status("Suspended"); MessageBox.Show("Too many password attempts, the point card has been frozen (Suspended)."); RefreshPage(); return; } } if (txtActivePassword.Text == "") { MessageBox.Show("Active Password can not be empty."); return; } if (!DataBaseControl.MatchingPointCardIDActivePwd_InPointCardTable(PointCardDataBaseControl.pointCardID, txtActivePassword.Text)) { MessageBox.Show("Active Password is Incorrect."); return; } if (PointCardDataBaseControl.status == "Actived") { MessageBox.Show("It Point Card have been Actived."); return; } if (PointCardDataBaseControl.status == "Suspended") { MessageBox.Show("It Point Card is Suspended, please contact the staff."); return; } int newGoldCoins = PlayerDataBaseControl.playerGoldCoins + PointCardDataBaseControl.goldCoins; PlayerDataBaseControl.Updata_PlayerGoldCoins(newGoldCoins); PointCardDataBaseControl.Updata_Status("Actived"); TopUpHistoryDataBaseControl.topUpDate = DateTime.Now.ToString("dd/MM/yyyy"); TopUpHistoryDataBaseControl.Insert(); MessageBox.Show("Top Up success."); txtActivePassword.Text = ""; RefreshPage(); }
private void BtnSign_Click(object sender, EventArgs e) { if (txtUserName.Text == "") { MessageBox.Show("User Name can not be empty."); return; } PlayerDataBaseControl.Updata_PlayerName(txtUserName.Text); Close(); }
private void BtnChangeProfile_Click(object sender, EventArgs e) { PlayerDataBaseControl.Updata_PlayerProfile(txtNewProfile.Text); Close(); }
private void BtnChangeEmail_Click(object sender, EventArgs e) { PlayerDataBaseControl.Updata_PlayerGoldCoins(int.Parse(txtGoldCoins.Text)); Close(); }
private void BtnChangeEmail_Click(object sender, EventArgs e) { PlayerDataBaseControl.Updata_PlayerEmail(txtNewEmail.Text); Close(); }