public Table(int g) { InitializeComponent(); if (g == 1) { Table <EScore> users = db.GetTable <EScore>(); foreach (var user in users) { EScore us = user; listBox.Items.Add(us.Name + " " + us.score); } } else if (g == 2) { Table <MScore> users = db.GetTable <MScore>(); foreach (var user in users) { MScore us = user; listBox.Items.Add(us); } } else { Table <HScore> users = db.GetTable <HScore>(); foreach (var user in users) { HScore us = user; listBox.Items.Add(us); } } }
public void win(int d) { MessageBox.Show($"you win\n your score:{d}"); if (gem == 1) { Table <EScore> users = db.GetTable <EScore>(); EScore user1 = new EScore { Name = je, score = d }; db.GetTable <EScore>().InsertOnSubmit(user1); db.SubmitChanges(); Table <Nick> users1 = db.GetTable <Nick>(); foreach (var user in users1) { if (user.Name == je) { user.mid = true; } } db.SubmitChanges(); } if (gem == 2) { Table <MScore> users = db.GetTable <MScore>(); MScore user1 = new MScore { Name = je, score = d }; db.GetTable <MScore>().InsertOnSubmit(user1); db.SubmitChanges(); Table <Nick> users1 = db.GetTable <Nick>(); foreach (var user in users1) { if (user.Name == je) { user.hard = true; if (user.H_Sc < d) { user.H_Sc = d; } } } db.SubmitChanges(); } if (gem == 3) { Table <HScore> users = db.GetTable <HScore>(); HScore user1 = new HScore { Name = je, score = d }; db.GetTable <HScore>().InsertOnSubmit(user1); db.SubmitChanges(); } this.Close(); }