Exemplo n.º 1
0
 public static void SaveScore(Database.HighScore hs)
 {
     using (var context = new Database.ALTPContext(ConnectionString))
     {
         context.HighScores.InsertOnSubmit(hs);
         context.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 public ConnectDatabase()
 {
     using (var context = new Database.ALTPContext(ConnectionString))
     {
         if (!context.DatabaseExists())
         {
             context.CreateDatabase();
         }
     }
 }
Exemplo n.º 3
0
        public static IList <Database.Question> GetQuestionLevel(int level)
        {
            IList <Database.Question> quesList = null;

            using (var context = new Database.ALTPContext(ConnectionString))
            {
                IQueryable <Database.Question> t = from ques in context.Questions where ques.QUESTION_NO == level select ques;
                quesList = t.ToList();
            }
            return(quesList);
        }
Exemplo n.º 4
0
        public static ObservableCollection <Database.HighScore> GetHighScore()
        {
            var highList = new ObservableCollection <Database.HighScore>();

            using (var context = new Database.ALTPContext(ConnectionString))
            {
                var t = from h in context.HighScores orderby h.Score descending select h;
                if (t != null)
                {
                    foreach (var item in t)
                    {
                        highList.Add(item as Database.HighScore);
                    }
                }
                else
                {
                    highList = null;
                }
            }
            return(highList);
        }