コード例 #1
0
        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");
            }
        }