Пример #1
0
        void SubmitButton_Click(object sender, EventArgs e)
        {
            if (UsernameTextbox.Text == "" || PasswordTextbox.Text == "" || ConfirmedPasswordTextbox.Text == "")
            {
                StatusLiteral.Text = "Please complete all of the fields";
            }
            else if (PasswordTextbox.Text != ConfirmedPasswordTextbox.Text)
            {
                StatusLiteral.Text = "Passwords do not match";
            }
            else
            {
                string username = UsernameTextbox.Text;
                string password = PasswordTextbox.Text;
                string hashedPassword;

                Database db = new Database();
                db.Connect();

                if (db.UserExists(username))
                {
                    StatusLiteral.Text = "Username already exists";
                    db.Close();
                }
                else
                {
                    hashedPassword = MD5Util.EncodePassword(password);
                    db.AddUser(username, hashedPassword);
                    db.Close();

                    Session["username"] = username;
                    Response.Redirect("SuccessPage.aspx?successCode=signUp");
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            aspSubmitButton.Click += new EventHandler(aspSubmitButton_Click);

            Database db = new Database();
            db.Connect();
            List<Score> scoreList = db.GetTimes("Any%RT");
            db.Close();

            GameTimeRepeater.DataSource = scoreList;
            GameTimeRepeater.DataBind();
        }
Пример #3
0
        void SubmitButton_Click(object sender, EventArgs e)
        {
            if (UsernameTextBox.Text == "" || PasswordTextBox.Text == "")
            {
                StatusLiteral.Text = "Please complete all of the fields";
            }
            else
            {
                string username = UsernameTextBox.Text;
                string password = PasswordTextBox.Text;
                string hashedPassword = MD5Util.EncodePassword(password);

                Database db = new Database();
                db.Connect();

                if (db.UserExists(username) == false)
                {
                    StatusLiteral.Text = "Username does not exist";
                }
                else
                {
                    //check password
                    if (db.PasswordsMatch(username, hashedPassword))
                    {
                        db.Close();

                        Session["username"] = username;
                        string redirectPath = getRedirectPath();
                        Response.Redirect(redirectPath);
                    }
                    else
                    {
                        StatusLiteral.Text = "Incorrect password";
                        db.Close();
                    }
                }
            }
        }
Пример #4
0
        void submitButton_Click(object sender, EventArgs e)
        {
            string realTimeString = realTimeTextBox.Text;
            string gameTimeString = gameTimeTextBox.Text;
            string comment = commentTextBot.Text;
            string videoURL = videoLinkTextBox.Text;
            string player = Session["username"].ToString();

            int realTimeSeconds;
            int gameTimeSeconds;

            if (leaderboardType == "Any%GameTime")
            {
                if (realTimeString == "" || gameTimeString == "")
                {
                    StatusLiteral.Text = "Please fill out the time fields";
                }
                else
                {
                    FormattedTime formattedRealTime = TimeValidator.GetFormattedTime(realTimeString);
                    FormattedTime formattedGameTime = TimeValidator.GetFormattedTime(gameTimeString);

                    if (formattedRealTime.getTimeSeconds() == -1 || formattedGameTime.getTimeSeconds() == -1)
                    {
                        StatusLiteral.Text = "Invalid times";
                    }
                    else
                    {
                        realTimeSeconds = formattedRealTime.getTimeSeconds();
                        gameTimeSeconds = formattedGameTime.getTimeSeconds();
                        realTimeString = formattedRealTime.getTimeString();
                        gameTimeString = formattedGameTime.getTimeString();

                        Score score = new Score(mode, player, realTimeString, realTimeSeconds, gameTimeString, gameTimeSeconds, videoURL, comment);

                        Database db = new Database();
                        db.Connect();
                        db.AddTime(score);
                        db.Close();

                        StatusLiteral.Text = "Successfully added time";

                        Response.Redirect("SuccessPage.aspx?successCode=addGameTime");
                    }
                }
            }
            else if (leaderboardType == "Any%RealTime" || leaderboardType == "100%" || leaderboardType == "Low%Ice" || leaderboardType == "Low%Speed"
                  || leaderboardType == "100%Map" || leaderboardType == "Any%GTCode" || leaderboardType == "RBO" || leaderboardType == "PowerBombsAny%")
            {
                if (realTimeString == "")
                {
                    StatusLiteral.Text = "Please fill out the time field";
                }
                else
                {
                    FormattedTime formattedRealTime = TimeValidator.GetFormattedTime(realTimeString);

                    if (formattedRealTime.getTimeSeconds() == -1)
                    {
                        StatusLiteral.Text = "Invalid time";
                    }
                    else
                    {
                        realTimeSeconds = formattedRealTime.getTimeSeconds();
                        realTimeString = formattedRealTime.getTimeString();

                        Score score = new Score(mode, player, realTimeString, realTimeSeconds, videoURL, comment);

                        Database db = new Database();
                        db.Connect();
                        db.AddTime(score);
                        db.Close();

                        StatusLiteral.Text = "Successfully added time";

                        Response.Redirect("SuccessPage.aspx?successCode=addRealTime");
                    }
                }
            }
        }