Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (numericUpDown1.Value != ui.IGC)
     {
         ul.UpdateIGC(ui.UserName, Convert.ToInt32(numericUpDown1.Value));
         MessageBox.Show("Updated");
     }
 }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int flag = 0;

            if (ul.detetcPred(ui.UName, MatchID))
            {
                MessageBox.Show("You Already Have a Pending Result");
            }
            else
            {
                if (Convert.ToInt32(numericUpDown2.Value) != 0)
                {
                    if (comboBox1.SelectedIndex == comboBox2.SelectedIndex || comboBox1.SelectedIndex == comboBox3.SelectedIndex || comboBox1.SelectedIndex == comboBox4.SelectedIndex || comboBox1.SelectedIndex == comboBox5.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox2.SelectedIndex == comboBox3.SelectedIndex || comboBox2.SelectedIndex == comboBox4.SelectedIndex || comboBox2.SelectedIndex == comboBox5.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox3.SelectedIndex == comboBox4.SelectedIndex || comboBox3.SelectedIndex == comboBox5.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox4.SelectedIndex == comboBox5.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox6.SelectedIndex == comboBox7.SelectedIndex || comboBox6.SelectedIndex == comboBox8.SelectedIndex || comboBox6.SelectedIndex == comboBox9.SelectedIndex || comboBox6.SelectedIndex == comboBox10.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox7.SelectedIndex == comboBox8.SelectedIndex || comboBox7.SelectedIndex == comboBox9.SelectedIndex || comboBox7.SelectedIndex == comboBox10.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox8.SelectedIndex == comboBox9.SelectedIndex || comboBox8.SelectedIndex == comboBox10.SelectedIndex)
                    {
                        flag = 1;
                    }
                    else if (comboBox9.SelectedIndex == comboBox10.SelectedIndex)
                    {
                        flag = 1;
                    }
                }
                else
                {
                    flag = 0;
                }

                if (flag == 0)
                {
                    int n1 = Convert.ToInt32(numericUpDown1.Value);
                    int n2 = Convert.ToInt32(numericUpDown2.Value);
                    int n3 = Convert.ToInt32(numericUpDown5.Value);

                    int r = Convert.ToInt32(numericUpDown3.Value);
                    int d = Convert.ToInt32(numericUpDown4.Value);

                    ul.InsertBet(ui.UName, MatchID, n1, n2, n3);
                    string[] h = new string[10];



                    h[0] = comboBox1.Text;
                    h[1] = comboBox2.Text;
                    h[2] = comboBox3.Text;
                    h[3] = comboBox4.Text;
                    h[4] = comboBox5.Text;
                    h[5] = comboBox6.Text;
                    h[6] = comboBox7.Text;
                    h[7] = comboBox8.Text;
                    h[8] = comboBox9.Text;
                    h[9] = comboBox10.Text;

                    if (radioButton1.Checked == true)
                    {
                        w = "Radient";
                    }
                    else if (radioButton2.Checked == true)
                    {
                        w = "Dire";
                    }

                    ul.InsertPrediction(ui.UName, MatchID, w, h, r, d);
                    MessageBox.Show("Your Prediction's are Submitted");
                    ui.Igc -= (n1 + n2 + n3);
                    ul.UpdateIGC(ui.UName, ui.Igc);

                    this.Close();
                    HomeUser hu = new HomeUser(ui);
                    hu.Show();
                }
                else
                {
                    MessageBox.Show("Cant Select Same Hero More than once For same Team");
                }
            }
        }
        private void button_Click(object sender, EventArgs e)
        {
            var         button = sender as Button;
            UpdateDBLin ul     = new UpdateDBLin();
            int         bx     = ui.Igc;
            int         mid    = Convert.ToInt32(button.Name);

            int flag = 0, w1 = 0, w2 = 0, w3 = 0;

            if (DateTime.Now >= ul.getMatchTime(Convert.ToInt32(button.Name)))
            {
                MResult mr = ul.getResult(Convert.ToInt32(button.Name));
                MatchP  mp = ul.getMatchPred(Convert.ToInt32(button.Name), ui.UName);
                Bet     b  = ul.getBets(Convert.ToInt32(button.Name), ui.UName);


                if (mr.Win == mp.Win)
                {
                    ui.Igc += Convert.ToInt32((b.Section1 * 2));
                    w1      = Convert.ToInt32((b.Section1 * 2));
                    flag    = 1;
                }

                if (mr.DireScore == mp.DireScore)
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 3));
                    w3     += Convert.ToInt32((b.Section3 * 3));
                    flag    = 1;
                }

                if (mr.RadientScore == mp.RadientScore)
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 3));
                    w3     += Convert.ToInt32((b.Section3 * 3));
                    flag    = 1;
                }



                if (ul.HeroMatchRad(mp.Hero1, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section2 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchRad(mp.Hero2, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section2 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchRad(mp.Hero3, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section2 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchRad(mp.Hero4, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section2 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchRad(mp.Hero5, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section2 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchDir(mp.Hero6, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchDir(mp.Hero7, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchDir(mp.Hero8, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchDir(mp.Hero9, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }
                if (ul.HeroMatchDir(mp.Hero10, mid))
                {
                    ui.Igc += Convert.ToInt32((b.Section3 * 1));
                    w2     += Convert.ToInt32((b.Section2 * 1));
                    flag    = 1;
                }


                ul.UpdateIGC(ui.UName, ui.Igc);


                if (flag == 1)
                {
                    MessageBox.Show("Congrats ! You won.Your In Game Credit Has Been Updated");
                }
                else
                {
                    MessageBox.Show("Sorry ! You Didn't Win.Better Luck Next Time");
                }
                MatchResult mat = new MatchResult(obj, ui, mr, mp, w1, w2, w3, Convert.ToInt32(b.Section1), Convert.ToInt32(b.Section2), Convert.ToInt32(b.Section3), bx);
                this.Close();
                mat.Show();
            }
            else
            {
                MessageBox.Show("Results not Ready");
            }
        }