// 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 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 PlayerProfile_ViewPointCardHistory_Load(object sender, EventArgs e) { TopUpHistoryDataBaseControl.Load(); lblPointCardHistory.Text = ""; for (int i = 0; i < TopUpHistoryDataBaseControl.dataTable.Rows.Count; i++) { lblPointCardHistory.Text += "PointCardID: " + TopUpHistoryDataBaseControl.PointCardIDs[i] + " "; lblPointCardHistory.Text += "RetailValue: " + PointCardDataBaseControl.GetData_ByColumn( "PointCardID", TopUpHistoryDataBaseControl.PointCardIDs[i], "RetailValue") + " "; lblPointCardHistory.Text += "TopUpDate: " + TopUpHistoryDataBaseControl.TopUpDates[i] + Environment.NewLine; } }