Esempio n. 1
0
        // TODO: Insert code to perform custom authentication using the provided username and password
        // (See http://go.microsoft.com/fwlink/?LinkId=35339).
        // The custom principal can then be attached to the current thread's principal as follows:
        //     My.User.CurrentPrincipal = CustomPrincipal
        // where CustomPrincipal is the IPrincipal implementation used to perform authentication.
        // Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
        // such as the username, display name, etc.
        private void loginButton_Click(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            Dictionary<string, int> userDictionary = new Dictionary<string, int>();
            userDictionary = fb.getUsersAndIds();

            string username = usernameTextBox.Text.ToLower();
            userId = -1;

            if (string.IsNullOrEmpty(username)) {
                Interaction.MsgBox("Please enter your username");

            } else {
                if (userDictionary.ContainsKey(username)) {
                    userDictionary.TryGetValue(username, out userId);
                    My.MyProject.Forms.FixturesForm.currentUser = userId;
                    My.MyProject.Forms.MenuForm.Show();
                    this.Close();
                } else {
                    Interaction.MsgBox("Username not recognised");
                    usernameTextBox.Clear();
                }

            }
        }
Esempio n. 2
0
        private void ReviewForm_Load(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            fixtures = fb.getBet();

            this.ReviewBetsFlowLayoutPanel.Enabled = true;
            this.ReviewBetsFlowLayoutPanel.Visible = true;
            this.FinishReviewGroupBox.Visible      = true;
            this.MainMenuButton.Visible            = true;

            foreach (Fixture fixture in fixtures)
            {
                FixtureReviewUserControl review = new FixtureReviewUserControl(fixture.Home_Team, fixture.Away_Team);
                this.ReviewBetsFlowLayoutPanel.Controls.Add(review);

                if (fixture.Prediction == 1)
                {
                    review.homeFixtureLabel.BackColor = Color.LightGreen;
                }
                if (fixture.Prediction == 2)
                {
                    review.awayFixtureLabel.BackColor = Color.LightGreen;
                }
                if (fixture.Prediction == 3)
                {
                    review.drawLabel.BackColor = Color.LightGreen;
                }
            }
        }
Esempio n. 3
0
        private void betSlipButton_Click_1(System.Object sender, System.EventArgs e)
        {
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();

            fixtures = fb.getBet();

            this.submitGroupBox.Visible = false;

            try {
                foreach (Fixture fixture in fixtures)
                {
                    FixtureReviewUserControl review = new FixtureReviewUserControl(fixture.Home_Team, fixture.Away_Team);
                    this.MainFlowLayoutPanel.Controls.Add(review);

                    if (fixture.Prediction == 1)
                    {
                        review.homeFixtureLabel.BackColor = Color.LightGreen;
                    }
                    if (fixture.Prediction == 2)
                    {
                        review.awayFixtureLabel.BackColor = Color.LightGreen;
                    }
                    if (fixture.Prediction == 3)
                    {
                        review.drawLabel.BackColor = Color.LightGreen;
                    }
                }
            } catch (NullReferenceException ex) {
                Interaction.MsgBox("Not enough users have entered their predictions yet. Please try later");
            }
        }
Esempio n. 4
0
        private void registerButton_Click(System.Object sender, System.EventArgs e)
        {
            var fb = new FixtureBuilder();
            var userList = new List<string>();
            string username = null;
            userList = fb.getPRUsers();
            username = this.usernameTextBox.Text;
            string urlBase = "http://www.predictresults.co.uk/API/PYBMembers.php?user='******'";

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream receiveStream = response.GetResponseStream();
                StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);

                response.Close();
                readStream.Close();

                Interaction.MsgBox("User '" + username + "' " + "registered as Place Your Bets user");
                My.MyProject.Forms.ContainerForm.Show();
                LoginUserControl fLoginUserControl = new LoginUserControl();
                My.MyProject.Forms.ContainerForm.MainFlowLayoutPanel.Controls.Add(fLoginUserControl);
                My.MyProject.Forms.ContainerForm.AcceptButton = fLoginUserControl.loginButton;
                this.Close();

            } else {
                Interaction.MsgBox("Username not recognised");
            }
        }
Esempio n. 5
0
        // TODO: Insert code to perform custom authentication using the provided username and password
        // (See http://go.microsoft.com/fwlink/?LinkId=35339).
        // The custom principal can then be attached to the current thread's principal as follows:
        //     My.User.CurrentPrincipal = CustomPrincipal
        // where CustomPrincipal is the IPrincipal implementation used to perform authentication.
        // Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
        // such as the username, display name, etc.


        private void loginButton_Click(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            Dictionary <string, int> userDictionary = new Dictionary <string, int>();

            userDictionary = fb.getUsersAndIds();

            string username = usernameTextBox.Text.ToLower();

            userId = -1;

            if (string.IsNullOrEmpty(username))
            {
                Interaction.MsgBox("Please enter your username");
            }
            else
            {
                if (userDictionary.ContainsKey(username))
                {
                    userDictionary.TryGetValue(username, out userId);
                    My.MyProject.Forms.FixturesForm.currentUser = userId;
                    My.MyProject.Forms.MenuForm.Show();
                    this.Close();
                }
                else
                {
                    Interaction.MsgBox("Username not recognised");
                    usernameTextBox.Clear();
                }
            }
        }
        private void PredictionLeagueTableForm_Load(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();
            userResultList = fb.getScores();

            this.PredictionsLeagueFlowLayoutPanel.Enabled = true;
            this.PredictionsLeagueFlowLayoutPanel.Visible = true;
            this.NavigationGroupBox.Visible = true;
            this.MainMenuButton.Visible = true;

            foreach (Users user in userResultList) {
                PredictionLeagueUserControl review = new PredictionLeagueUserControl(user.user, user.correct);
                this.PredictionsLeagueFlowLayoutPanel.Controls.Add(review);

            }
        }
Esempio n. 7
0
        // TODO: Insert code to perform custom authentication using the provided username and password
        // (See http://go.microsoft.com/fwlink/?LinkId=35339).
        // The custom principal can then be attached to the current thread's principal as follows:
        //     My.User.CurrentPrincipal = CustomPrincipal
        // where CustomPrincipal is the IPrincipal implementation used to perform authentication.
        // Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
        // such as the username, display name, etc.


        private void loginButton_Click(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            Dictionary <string, int> userDictionary = new Dictionary <string, int>();

            userDictionary = fb.getUsersAndIds();

            string username = usernameTextBox.Text.ToLower();

            userId = -1;

            if (string.IsNullOrEmpty(username))
            {
                Interaction.MsgBox("Please enter your username");
            }
            else
            {
                if (userDictionary.ContainsKey(username))
                {
                    userDictionary.TryGetValue(username, out userId);
                    My.MyProject.Forms.ContainerForm.currentUser = userId;
                    My.MyProject.Forms.ContainerForm.enterPredictionsButton.Text = "Enter Predictions";
                    My.MyProject.Forms.ContainerForm.betSlipButton.Text          = "Bet Slip";
                    My.MyProject.Forms.ContainerForm.whoBetButton.Text           = "Who's Bet";
                    My.MyProject.Forms.ContainerForm.predictionLeagueButton.Text = "Prediction League";
                    My.MyProject.Forms.ContainerForm.myAccountButton.Text        = "My Account";
                    My.MyProject.Forms.ContainerForm.logOutButton.Text           = "Log Off";

                    My.MyProject.Forms.ContainerForm.logOutButton.Visible           = true;
                    My.MyProject.Forms.ContainerForm.enterPredictionsButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.betSlipButton.Enabled          = true;
                    My.MyProject.Forms.ContainerForm.whoBetButton.Enabled           = true;
                    My.MyProject.Forms.ContainerForm.predictionLeagueButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.myAccountButton.Enabled        = true;
                    My.MyProject.Forms.ContainerForm.logOutButton.Enabled           = true;
                    My.MyProject.Forms.ContainerForm.coverTitleLabel.Visible        = true;
                    this.Visible = false;
                }
                else
                {
                    Interaction.MsgBox("Username not recognised");
                    usernameTextBox.Clear();
                }
            }
        }
Esempio n. 8
0
        private void PredictionLeagueTableForm_Load(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            userResultList = fb.getScores();

            this.PredictionsLeagueFlowLayoutPanel.Enabled = true;
            this.PredictionsLeagueFlowLayoutPanel.Visible = true;
            this.NavigationGroupBox.Visible = true;
            this.MainMenuButton.Visible     = true;

            foreach (Users user in userResultList)
            {
                PredictionLeagueUserControl review = new PredictionLeagueUserControl(user.user, user.correct);
                this.PredictionsLeagueFlowLayoutPanel.Controls.Add(review);
            }
        }
Esempio n. 9
0
        // TODO: Insert code to perform custom authentication using the provided username and password
        // (See http://go.microsoft.com/fwlink/?LinkId=35339).
        // The custom principal can then be attached to the current thread's principal as follows:
        //     My.User.CurrentPrincipal = CustomPrincipal
        // where CustomPrincipal is the IPrincipal implementation used to perform authentication.
        // Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object
        // such as the username, display name, etc.
        private void loginButton_Click(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            Dictionary<string, int> userDictionary = new Dictionary<string, int>();
            userDictionary = fb.getUsersAndIds();

            string username = usernameTextBox.Text.ToLower();
            userId = -1;

            if (string.IsNullOrEmpty(username)) {
                Interaction.MsgBox("Please enter your username");

            } else {
                if (userDictionary.ContainsKey(username)) {
                    userDictionary.TryGetValue(username, out userId);
                    My.MyProject.Forms.ContainerForm.currentUser = userId;
                    My.MyProject.Forms.ContainerForm.enterPredictionsButton.Text = "Enter Predictions";
                    My.MyProject.Forms.ContainerForm.betSlipButton.Text = "Bet Slip";
                    My.MyProject.Forms.ContainerForm.whoBetButton.Text = "Who's Bet";
                    My.MyProject.Forms.ContainerForm.predictionLeagueButton.Text = "Prediction League";
                    My.MyProject.Forms.ContainerForm.myAccountButton.Text = "My Account";
                    My.MyProject.Forms.ContainerForm.logOutButton.Text = "Log Off";

                    My.MyProject.Forms.ContainerForm.logOutButton.Visible = true;
                    My.MyProject.Forms.ContainerForm.enterPredictionsButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.betSlipButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.whoBetButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.predictionLeagueButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.myAccountButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.logOutButton.Enabled = true;
                    My.MyProject.Forms.ContainerForm.coverTitleLabel.Visible = true;
                    this.Visible = false;

                } else {
                    Interaction.MsgBox("Username not recognised");
                    usernameTextBox.Clear();
                }

            }
        }
Esempio n. 10
0
        private void ReviewForm_Load(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();
            userList = fb.getUsers();
            submittedList = fb.usersSubmitted();

            this.UserPredictionsFlowLayoutPanel.Enabled = true;
            this.UserPredictionsFlowLayoutPanel.Visible = true;
            this.NavigationGroupBox.Visible = true;
            this.MainMenuButton.Visible = true;

            foreach (string user in userList) {
                UserPredictionsUserControl review = new UserPredictionsUserControl(user);
                this.UserPredictionsFlowLayoutPanel.Controls.Add(review);

                if (submittedList.Contains(user)) {
                    review.submittedLabel.BackColor = Color.LightGreen;
                    review.submittedLabel.Text = "Submitted";
                }

            }
        }
Esempio n. 11
0
        private void predictionLeagueButton_Click(System.Object sender, System.EventArgs e)
        {
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();

            userResultList = fb.getScores();
            Dictionary <int, string> userDictionary = new Dictionary <int, string>();

            userDictionary = fb.getIdsandUsers();

            this.MainFlowLayoutPanel.Enabled = true;
            this.MainFlowLayoutPanel.Visible = true;
            this.submitGroupBox.Visible      = false;

            string name = "";

            foreach (Users user in userResultList)
            {
                userDictionary.TryGetValue(user.UserID, out name);
                PredictionLeagueUserControl review = new PredictionLeagueUserControl(name, user.correct);
                this.MainFlowLayoutPanel.Controls.Add(review);
            }
        }
Esempio n. 12
0
        private void enterPredictionsButton_Click(System.Object sender, System.EventArgs e)
        {
            fixtureBoxList.Clear();
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();

            fixtures = fb.getFixtures();
            fix      = 0;


            try {
                foreach (Fixture Fixture in fixtures)
                {
                    FixtureBox usercontrol = new FixtureBox(Fixture.Home_Team, Fixture.Away_Team, Fixture.Date, getTeamBadge(fixtures[fix].Home_Team), getTeamBadge(fixtures[fix].Away_Team));
                    MainFlowLayoutPanel.Controls.Add(usercontrol);
                    usercontrol.Dock    = DockStyle.Fill;
                    usercontrol.Visible = false;
                    fixtureBoxList.Add(usercontrol);
                    fix = fix + 1;
                }

                fixtureBoxList[0].Visible            = true;
                fixtureBoxList[0].backButton.Enabled = false;
                this.submitButton.Visible            = false;
                this.editButton.Visible = false;
            } catch (NullReferenceException ex) {
                Interaction.MsgBox("No fixtures available");
            }

            if (fix != 10)
            {
                this.MainFlowLayoutPanel.Controls.Clear();
                fixtureBoxList.Clear();
                Interaction.MsgBox("There are currently no fixtures to display");
            }
        }
Esempio n. 13
0
        private void ReviewForm_Load(System.Object sender, System.EventArgs e)
        {
            FixtureBuilder fb = new FixtureBuilder();

            userList      = fb.getUsers();
            submittedList = fb.usersSubmitted();

            this.UserPredictionsFlowLayoutPanel.Enabled = true;
            this.UserPredictionsFlowLayoutPanel.Visible = true;
            this.NavigationGroupBox.Visible             = true;
            this.MainMenuButton.Visible = true;

            foreach (string user in userList)
            {
                UserPredictionsUserControl review = new UserPredictionsUserControl(user);
                this.UserPredictionsFlowLayoutPanel.Controls.Add(review);

                if (submittedList.Contains(user))
                {
                    review.submittedLabel.BackColor = Color.LightGreen;
                    review.submittedLabel.Text      = "Submitted";
                }
            }
        }
Esempio n. 14
0
        private void registerButton_Click(System.Object sender, System.EventArgs e)
        {
            var    fb       = new FixtureBuilder();
            var    userList = new List <string>();
            string username = null;

            userList = fb.getPRUsers();
            username = this.usernameTextBox.Text;
            string urlBase = "http://www.predictresults.co.uk/API/PYBMembers.php?user='******'";

                HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream       receiveStream = response.GetResponseStream();
                StreamReader readStream    = new StreamReader(receiveStream, Encoding.UTF8);

                response.Close();
                readStream.Close();

                Interaction.MsgBox("User '" + username + "' " + "registered as Place Your Bets user");
                My.MyProject.Forms.ContainerForm.Show();
                LoginUserControl fLoginUserControl = new LoginUserControl();
                My.MyProject.Forms.ContainerForm.MainFlowLayoutPanel.Controls.Add(fLoginUserControl);
                My.MyProject.Forms.ContainerForm.AcceptButton = fLoginUserControl.loginButton;
                this.Close();
            }
            else
            {
                Interaction.MsgBox("Username not recognised");
            }
        }
Esempio n. 15
0
        private void enterPredictionsButton_Click(System.Object sender, System.EventArgs e)
        {
            fixtureBoxList.Clear();
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();
            fixtures = fb.getFixtures();
            fix = 0;

            try {
                foreach (Fixture Fixture in fixtures) {
                    FixtureBox usercontrol = new FixtureBox(Fixture.Home_Team, Fixture.Away_Team, Fixture.Date, getTeamBadge(fixtures[fix].Home_Team), getTeamBadge(fixtures[fix].Away_Team));
                    MainFlowLayoutPanel.Controls.Add(usercontrol);
                    usercontrol.Dock = DockStyle.Fill;
                    usercontrol.Visible = false;
                    fixtureBoxList.Add(usercontrol);
                    fix = fix + 1;

                }

                fixtureBoxList[0].Visible = true;
                fixtureBoxList[0].backButton.Enabled = false;
                this.submitButton.Visible = false;
                this.editButton.Visible = false;

            } catch (NullReferenceException ex) {
                Interaction.MsgBox("No fixtures available");
            }

            if (fix != 10) {
                this.MainFlowLayoutPanel.Controls.Clear();
                fixtureBoxList.Clear();
                Interaction.MsgBox("There are currently no fixtures to display");
            }
        }
Esempio n. 16
0
        private void betSlipButton_Click_1(System.Object sender, System.EventArgs e)
        {
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();
            fixtures = fb.getBet();

            this.submitGroupBox.Visible = false;

            try {
                foreach (Fixture fixture in fixtures) {
                    FixtureReviewUserControl review = new FixtureReviewUserControl(fixture.Home_Team, fixture.Away_Team);
                    this.MainFlowLayoutPanel.Controls.Add(review);

                    if (fixture.Prediction == 1) {
                        review.homeFixtureLabel.BackColor = Color.LightGreen;
                    }
                    if (fixture.Prediction == 2) {
                        review.awayFixtureLabel.BackColor = Color.LightGreen;
                    }
                    if (fixture.Prediction == 3) {
                        review.drawLabel.BackColor = Color.LightGreen;
                    }
                }

            } catch (NullReferenceException ex) {
                Interaction.MsgBox("Not enough users have entered their predictions yet. Please try later");
            }
        }
Esempio n. 17
0
        private void predictionLeagueButton_Click(System.Object sender, System.EventArgs e)
        {
            this.MainFlowLayoutPanel.Controls.Clear();
            FixtureBuilder fb = new FixtureBuilder();
            userResultList = fb.getScores();
            Dictionary<int, string> userDictionary = new Dictionary<int, string>();
            userDictionary = fb.getIdsandUsers();

            this.MainFlowLayoutPanel.Enabled = true;
            this.MainFlowLayoutPanel.Visible = true;
            this.submitGroupBox.Visible = false;

            string name = "";

            foreach (Users user in userResultList) {
                userDictionary.TryGetValue(user.UserID, out name);
                PredictionLeagueUserControl review = new PredictionLeagueUserControl(name, user.correct);
                this.MainFlowLayoutPanel.Controls.Add(review);

            }
        }