예제 #1
0
 public static void AddScore(string name, int score)
 {
     try
     {
         var addThis = new tbl_highScore()
         {
             Name = name, Score = score
         };
         db.Insert(addThis);
     }
     catch (Exception e)
     {
         Console.WriteLine("Add Error:" + e.Message);
     }
 }
예제 #2
0
 public static void EditScore(string name, int score, int listid)
 {
     try
     {
         // http://stackoverflow.com/questions/14007891/how-are-sqlite-records-updated
         var EditThis = new tbl_highScore()
         {
             Name  = name,
             Score = score,
             Id    = listid
         };
         db.Update(EditThis);
     }
     catch (Exception e)
     {
         Console.WriteLine("Update Error:" + e.Message);
     }
 }
예제 #3
0
 public static List <tbl_highScore> ViewAll()
 {
     try
     {
         return(db.Query <tbl_highScore>("SELECT * FROM tbl_highScore ORDER BY Score"));
     }
     catch (Exception e)
     {
         Console.WriteLine("Error: " + e.Message);
         //making some fake items to stop the system from crashing when the DB doesn't connect
         var fakeitem = new List <tbl_highScore>();
         //make a single item
         var item = new tbl_highScore
         {
             Id    = 100,
             Score = -3,
             Name  = "Error Reading"
         };
         fakeitem.AddRange(new[] { item }); //add it to the fake item list
         return(fakeitem);
     }
 }