public void InsertUserPrediction(MatchP mp, int bs1, int bs2, int bs3, int w1, int w2, int w3) { UserPrediction up = new UserPrediction(); up.MatchId = mp.MatchId; up.Username = mp.Username; up.Win = mp.Win; up.Hero1 = mp.Hero1; up.Hero2 = mp.Hero2; up.Hero3 = mp.Hero3; up.Hero4 = mp.Hero4; up.Hero5 = mp.Hero5; up.Hero6 = mp.Hero6; up.Hero7 = mp.Hero7; up.Hero8 = mp.Hero8; up.Hero9 = mp.Hero9; up.Hero10 = mp.Hero10; up.RadientScore = Convert.ToInt32(mp.RadientScore); up.DireScore = Convert.ToInt32(mp.DireScore); up.S1_Bet_Won = bs1.ToString() + "-" + w1.ToString(); up.S2_Bet_Won = bs2.ToString() + "-" + w2.ToString(); up.S3_Bet_Won = bs3.ToString() + "-" + w3.ToString(); cntx.UserPredictions.InsertOnSubmit(up); cntx.SubmitChanges(); }
public void DeletePred(string x, int y) { var str = from a in cntx.MatchPs where a.Username == x && a.MatchId == y select a; MatchP mp = str.First(); cntx.MatchPs.DeleteOnSubmit(mp); cntx.SubmitChanges(); }
public MatchP getMatchPred(int x, string y) { var str = from a in cntx.MatchPs where a.MatchId == x && a.Username == y select a; MatchP mp = new MatchP(); mp = str.First(); return(mp); }
public bool detetcPred(string x, int y) { bool b; try { var str = from a in cntx.MatchPs where a.Username == x && a.MatchId == y select a; MatchP mp = str.First(); b = true; } catch { b = false; } return(b); }
public MatchResult(Form obj, Userinfo ui, MResult mr, MatchP mp, int w1, int w2, int w3, int bs1, int bs2, int bs3, int bx) { InitializeComponent(); this.obj = obj; this.ui = ui; this.mp = mp; this.mr = mr; this.bs1 = bs1; this.bs2 = bs2; this.bs3 = bs3; this.w1 = w1; this.w2 = w2; this.w3 = w3; textBox1.Text = bs1.ToString(); textBox2.Text = bs2.ToString(); textBox3.Text = bs3.ToString(); textBox4.Text = w1.ToString(); textBox5.Text = w2.ToString(); textBox6.Text = w3.ToString(); textBox7.Text = bx.ToString(); textBox8.Text = ui.Igc.ToString(); }
public void InsertPrediction(string u, int m, string w, string[] h, int r, int d) { MatchP mp = new MatchP(); mp.Username = u; mp.MatchId = m; mp.Hero1 = h[0]; mp.Hero2 = h[1]; mp.Hero3 = h[2]; mp.Hero4 = h[3]; mp.Hero5 = h[4]; mp.Hero6 = h[5]; mp.Hero7 = h[6]; mp.Hero8 = h[7]; mp.Hero9 = h[8]; mp.Hero10 = h[9]; mp.Win = w; mp.RadientScore = r; mp.DireScore = d; cntx.MatchPs.InsertOnSubmit(mp); cntx.SubmitChanges(); }
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"); } }