示例#1
0
        private void increaseScorePoint(int p)
        {
            long point = dbc.Score.First().Total.Value + p;

            dbc.Score.First().Total = point;
            lblMsg.Text = "You have unlocked " + p.ToString() + " points.";
            dbc.SubmitChanges();
            Util.UpdateUnlockCategories();
        }
示例#2
0
        public static bool UpdateUnlockCategories()
        {
            bool hasUnlocked               = false;
            Moviadb1DataContext dbc        = App.CurrentApp.DB;
            List <Categories>   lockedCats = dbc.Categories.Where(c => c.IsUnlocked == 0).ToList();

            foreach (Categories cat in lockedCats)
            {
                Score    s   = dbc.Score.First();
                string[] con = cat.UnlockCode.Split('_');
                if (con[1] == "P")
                {
                    int rpoint;
                    int.TryParse(con[0], out rpoint);
                    if (rpoint <= s.Total)
                    {
                        cat.IsUnlocked = 1;
                        hasUnlocked    = true;
                    }
                }
                else if (con[1] == "G")
                {
                    int rgames;
                    int.TryParse(con[0], out rgames);
                    if (rgames <= s.TotalGames)
                    {
                        cat.IsUnlocked = 1;
                        hasUnlocked    = true;
                    }
                }
            }
            dbc.SubmitChanges();
            return(hasUnlocked);
        }
示例#3
0
 /// <summary>
 /// Saves data of the updated question
 /// </summary>
 ///
 public void Save()
 {
     dbcontext.SubmitChanges();
 }