コード例 #1
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            first_form f = new first_form();

            this.Hide();
            f.ShowDialog();
        }
コード例 #2
0
ファイル: backstage.cs プロジェクト: Vlad-Andres/Milionar
        private void back_btn_Click(object sender, EventArgs e)
        {
            first_form f = new first_form();

            this.Hide();
            f.ShowDialog();
        }
コード例 #3
0
ファイル: main_form.cs プロジェクト: Vlad-Andres/Milionar
        private void circle_btn_leave_Click(object sender, EventArgs e)
        {
            string query = "UPDATE games SET canceled = 'YES' WHERE Id = " + Global.game_id;

            using (connetion = new MySqlConnection(con_string))
                using (MySqlCommand write = new MySqlCommand(query, connetion))
                {
                    connetion.Open();
                    write.ExecuteNonQuery();
                }
            first_form f = new first_form();

            this.Hide();
            f.ShowDialog();
            // Database -> Delete session row
        }
コード例 #4
0
ファイル: first_form.cs プロジェクト: Vlad-Andres/Milionar
 private void reg_lbl_Click(object sender, EventArgs e)
 {
     if (reg_lbl.Text == " Log out..")
     {
         Global.Nickname = "undef";
         first_form f = new first_form();
         this.Dispose();
         f.Show();
     }
     else
     {
         register r = new register();
         this.Hide();
         r.ShowDialog();
     }
 }
コード例 #5
0
 private void login_btn_Click(object sender, EventArgs e)
 {
     if (nick_txt.Text.Length > 0 && pass_txt.Text.Length > 0)
     {
         MySqlConnection connection = new MySqlConnection();
         string          con_string = Global.db_connect_prop;
         string          query      = "SELECT COUNT(*),`wallet`,`rank`,`name`,`email` FROM users WHERE Nickname='" + nick_txt.Text + "' AND password='******'";
         using (connection = new MySqlConnection(con_string))
             using (MySqlCommand query_print = new MySqlCommand(query, connection))
             {
                 connection.Open();
                 MySqlDataReader dr = query_print.ExecuteReader(); dr.Read();
                 if (dr["COUNT(*)"].ToString() == "1")
                 {
                     if (Properties.Settings.Default.remember)
                     {
                         Properties.Settings.Default.UserName = nick_txt.Text;
                         Properties.Settings.Default.Password = pass_txt.Text;
                         Properties.Settings.Default.Save();
                     }
                     Global.Nickname          = nick_txt.Text;
                     Global.name              = dr["name"].ToString();
                     Global.rank              = dr["rank"].ToString();
                     Global.wallet            = Convert.ToInt32(dr["wallet"]);
                     acc_recovery.sender_mail = dr["email"].ToString();
                     first_form f = new first_form();
                     this.Hide();
                     f.ShowDialog();
                 }
                 else
                 if (MetroFramework.MetroMessageBox.Show(this, "Wrong Username or Password", "", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel)
                 {
                     first_form f = new first_form();
                     this.Dispose();
                     f.ShowDialog();
                 }
                 connection.Close();
             }
     }
     else
     {
     }
 }
コード例 #6
0
ファイル: main_form.cs プロジェクト: Vlad-Andres/Milionar
        //---------------------------------------------------------------------------------------------- Cazuri de castig si pierdere
        private void result(int id)
        {
            validation_timer.Stop();
            MySqlConnection connection = new MySqlConnection();
            string          con_string = Global.db_connect_prop;

            //UPDATE `milionaire`.`users` SET `wallet`= '1000' WHERE `Id`= '2';


            if (id >= 5 && id < 10)
            {
                Global.wallet += 1000;
                if (MetroFramework.MetroMessageBox.Show(this, "Results", "You earned 1 thousand dollars", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information) == DialogResult.Retry)
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    first_form f = new first_form();
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    Application.Exit();
                }
            }
            else if (id >= 10 && id < 15)
            {
                Global.wallet += 32000;
                if (MetroFramework.MetroMessageBox.Show(this, "Results", "You earned 32 thousands dollars", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information) == DialogResult.Retry)
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    first_form f = new first_form();
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    Application.Exit();
                }
            }
            else if (id == 15)
            {
                Global.wallet += 1000000;

                if (MetroFramework.MetroMessageBox.Show(this, "Congratulations", "You won 1 million dollars", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information) == DialogResult.Retry)
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    first_form f = new first_form();
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    if (Global.Nickname != "undef")
                    {
                        string query = "UPDATE users SET wallet=" + Global.wallet + " WHERE Nickname='" + Global.Nickname + "' ";
                        using (connection = new MySqlConnection(con_string))
                            using (MySqlCommand write = new MySqlCommand(query, connection))
                            { connection.Open(); write.ExecuteNonQuery(); connection.Close(); }
                    }
                    Application.Exit();
                }
            }
            else if (id < 5)
            {
                if (MetroFramework.MetroMessageBox.Show(this, "Results", "You didn't earned anything :(", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry)
                {
                    first_form f = new first_form();
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    Application.Exit();
                }
            }
        }