예제 #1
0
 public static void SaveScore(Database.HighScore hs)
 {
     using (var context = new Database.ALTPContext(ConnectionString))
     {
         context.HighScores.InsertOnSubmit(hs);
         context.SubmitChanges();
     }
 }
예제 #2
0
 public ConnectDatabase()
 {
     using (var context = new Database.ALTPContext(ConnectionString))
     {
         if (!context.DatabaseExists())
         {
             context.CreateDatabase();
         }
     }
 }
예제 #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);
        }
예제 #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);
        }