private void btnLoginLogin_Click(object sender, EventArgs e) { string username = tbUsernameLogin.Text.Trim(); string password = tbPasswordLogin.Text.Trim(); if (username == "") { MessageBox.Show("Please, input an username!", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (password == "") { MessageBox.Show("Please, input a password!", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (pm.PlayerLogin(username, password) == null) { MessageBox.Show("Wrong credentials!", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { pm.PlayerLogin(username, password); MessageBox.Show($"Welcome to WallStreet Game, {PlayerManager.currentPlayerUsername}!"); var frmPr = new FormProfile(); frmPr.FormClosed += FormProfile_Closed; Hide(); frmPr.Show(); } }
private void btnExitBank_Click(object sender, EventArgs e) { var frmPr = new FormProfile(); frmPr.FormClosed += FormProfile_Closed; Hide(); frmPr.Show(); }
private void btnSaveGame_Click(object sender, EventArgs e) { using (var db = new PlayerEntities()) { var player = db.Players.SingleOrDefault(p => p.Username == PlayerManager.currentPlayerUsername); player.Money = decimal.Parse(lblMoneyGame.Text); player.Gold = long.Parse(lblGoldGame.Text); player.Petrol = long.Parse(lblPetrolGame.Text); player.Bitcoin = long.Parse(lblBitcoinGame.Text); player.Technologies = long.Parse(lblTechnologiesGame.Text); player.Antiques = long.Parse(lblAntiquesGame.Text); player.Shares = long.Parse(lblSharesGame.Text); db.SaveChanges(); FormGame.ActiveForm.Dispose(); FormProfile frmP = new FormProfile(); frmP.ShowDialog(); } }