コード例 #1
0
        private void Go_Click(object sender, EventArgs e)
        {
            if (wus.Text == "" || wps.Text == "")
            {
                MessageBox.Show("Pls enter information");
            }
            else
            {
                int lcResult = Convert.ToInt32(clsDbConnection.DbFunction("checksignin", new Dictionary <string, object>

                {
                    ["us"] = wus.Text, ["ps"] = wps.Text
                }));
                admin  ad  = new admin();
                signin sg  = new signin();
                member mem = new member(wus.Text);
                switch (lcResult)
                {
                case 0:
                {
                    MessageBox.Show("You enntered incorrect info"); sg.Show(); this.Hide();
                    int lcattempt = Convert.ToInt32(clsDbConnection.DbFunction("attemptincrease", new Dictionary <string, object>
                        {
                            ["prUserName"] = wus.Text
                        }));
                    break;
                }

                case 1:
                {
                    DataTable dtResetAttempt = clsDbConnection.SProcTable("resetSigninAttempt", new Dictionary <string, object>

                        {
                            ["prUserName"] = wus.Text
                        });
                    MessageBox.Show("You logged in");
                    this.Hide();
                    mem.Show();
                    break;
                }

                case 2:
                {
                    MessageBox.Show("You registered successfully");

                    mem.Show();

                    this.Hide();
                    break;
                }

                case 3:
                {
                    ad.Show();
                    this.Hide();
                    break;
                }

                case 4:
                {
                    MessageBox.Show("You have failed so many times!!! Contact admin"); sg.Show(); this.Hide();
                    break;
                }

                case 5:
                {
                    MessageBox.Show("You already sign in!!"); sg.Show(); this.Hide();
                    break;
                }
                }
            }
        }
コード例 #2
0
        private void gametimer_Tick(object sender, EventArgs e)
        {
            //RUN NORMAL GAME
            if (_gameStatus == 2)
            {
                count = count + 1;
                nextscreeninfo();
                countquestion.Text = Convert.ToString(count);
                Go.Enabled         = true;

                DataTable _resetGameStart = clsDbConnection.SProcTable("resetgamestatus", new Dictionary <string, object>

                {
                    ["prUserName"] = player.Text, ["prGameStatus"] = 0
                });
            }


            {
                _gameStatus = Convert.ToInt32(clsDbConnection.DbFunction("gamestatus", new Dictionary <string, object>

                {
                    ["prUserName"] = player.Text
                }));
            }


            // END GAME
            if (_gameStatus == 3)
            {
                end();
                member mem1 = new member(player.Text);
                this.Hide();
                mem1.Show();
            }



            // check game status when  TURN NUMBER=> if either of player reach max turn, then set gamestatus to end(3).
            {
                DataTable _exitgame = clsDbConnection.SProcTable("endgame", new Dictionary <string, object>

                {
                    ["prUserName"] = player.Text
                });
            }

            //check online status to close forms if ONLINE STATUS is OFFLINE
            int lcOnline = Convert.ToInt32(clsDbConnection.DbFunction("OnlineStatus", new Dictionary <string, object>

            {
                ["prUserName"] = player.Text
            }));

            if (lcOnline == 0)
            {
                DataTable _setGameEnd = clsDbConnection.SProcTable("resetgamestatus", new Dictionary <string, object>

                {
                    ["prUserName"] = player.Text, ["prGameStatus"] = 3
                });

                end();


                DataTable ldlistcompetitor = clsDbConnection.SProcTable("resetOnlineStatus", new Dictionary <string, object>

                {
                    ["prUsername"] = player.Text
                });


                member mem1 = new member(player.Text);
                this.Hide();
                mem1.Show();
            }
        }