示例#1
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxUsername.Text == "")
                {
                    MessageBox.Show("Username can't be empty.");
                }
                else if (textBoxServer.Text == "")
                {
                    MessageBox.Show("Server name can't be empty.");
                }
                else if (textBoxDatabase.Text == "")
                {
                    MessageBox.Show("Database name can't be empty.");
                }
                else
                {
                    // Connect to database
                    Connection connection = new Connection(textBoxServer.Text, textBoxDatabase.Text, textBoxUsername.Text, textBoxPassword.Text);

                    // Hide FormLogin
                    this.Hide();

                    // Show FormTournament
                    FormTournament formTournament = new FormTournament();
                    formTournament.ShowDialog();
                }
            }
            // Login credentials invalid
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Fail to connect!");
            }
        }
示例#2
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            // Confirm delete message
            DialogResult konfirmasi = MessageBox.Show("Current tournament will be deleted , Are you sure?", "Konfirmasi", MessageBoxButtons.YesNo);

            // Confirm deletion
            if (konfirmasi == System.Windows.Forms.DialogResult.Yes)
            {
                bool sucess = Tournaments.DeleteTournament(selectedTournament, out string exceptionMessage);

                if (sucess)
                {
                    MessageBox.Show("Tournament has been deleted.", "information");


                    FormTournament form = new FormTournament();
                    form.Owner = this;
                    this.Hide();
                    form.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Fail to delete tournament: " + exceptionMessage);
                }
            }
        }
示例#3
0
        private void buttonTestTournamentLoad_Click(object sender, EventArgs e)
        {
            FormTournament form = new FormTournament();

            form.Owner = this;
            form.ShowDialog();
        }
示例#4
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxUsername.Text == "")
                {
                    MessageBox.Show("Username can't be empty.");
                }
                else if (textBoxServer.Text == "")
                {
                    MessageBox.Show("Server name can't be empty.");
                }
                else if (textBoxDatabase.Text == "")
                {
                    MessageBox.Show("Database name can't be empty.");
                }
                else
                {
                    Connection connection = new Connection(textBoxServer.Text, textBoxDatabase.Text, textBoxUsername.Text, textBoxPassword.Text);

                    this.Hide();

                    FormTournament formTournament = new FormTournament();
                    formTournament.ShowDialog();

                    //FormMenu formMenu = new FormMenu();
                    //formMenu.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Fail to connect!");
            }
        }
示例#5
0
        private void loadAnotherTournamentFromDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormTournament form = new FormTournament();

            form.Owner = this;
            this.Hide();
            form.ShowDialog();
        }
示例#6
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult konfirmasi = MessageBox.Show("Current tournament will be deleted , Are you sure?", "Konfirmasi", MessageBoxButtons.YesNo);

            if (konfirmasi == System.Windows.Forms.DialogResult.Yes)
            {
                string add = Tournaments.DeleteTournament(selectedTournament);
                if (add == "1")
                {
                    MessageBox.Show("Tournament has been deleted.", "information");

                    FormTournament form = new FormTournament();
                    form.Owner = this;
                    this.Hide();
                    form.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Fail to delete tournament. Message error: ", add);
                }
            }
        }