Esempio n. 1
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            MongoManager mongo = new MongoManager();

            string user = txtUser.Text;
            string pass = txtPass.Text;

            if (user == "" || pass == "")
            {
                System.Windows.Forms.MessageBox.Show("Enter username and password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (mongo.ProfileExistsInDB(user))
            {
                if (mongo.ProfileAuthentication(user, pass))
                {
                    Profile profile = mongo.GetProfileData(user);

                    Main nextForm = new Main(profile);
                    this.Hide();
                    nextForm.ShowDialog();
                    this.Show();
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Password is incorrect.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Username is incorrect or doesn't exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to delete this character?", "Warning", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                mongo.DeleteCharacter((Character)listCharacters.SelectedItem);  //TO DO: fix entry parameter
                profile = mongo.GetProfileData(profile.Username);
                RefreshList();
            }
        }