Exemplo n.º 1
0
 public static void SavePlatform(PlatformData platform)
 {
     //GetDataBase();
     using (GameDataContext context = new GameDataContext(Constants.DBConnectionString))
     {
         context.Platform.InsertOnSubmit(platform);
         context.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 private void HandlePlatformsCallback(PlatformData results)
 {
     //if (results != null)
     //{
     //    this.NavigationService.Navigate(new Uri("//Views/EditPlatformData.xaml?PlatformID=" + results.Abreviation, UriKind.Relative));
     //}
     //else
     //{
     //    MessageBoxResult result = MessageBox.Show("Are you sure?", "would you like to add " + this.txt_autoComplete.Text + " as a new platform?", MessageBoxButton.OKCancel);
     //    if (result == MessageBoxResult.OK)
     //    {
     //        this.NavigationService.Navigate(new Uri("//Views/EditPlatformData.xaml?PlatformName=" + this.txt_autoComplete.Text, UriKind.Relative));
     //    }
     //}
 }
Exemplo n.º 3
0
        public GameData(GameResponse game, PlatformData platform)
        {
            GameCollections = new EntitySet<GameCollection>();
            GameImages = new EntitySet<GameImage>();

            this.Description = TextUtils.RemoveHTMLTags(game.Description);
            this.UK_Name = game.NameDetails.UK_Name;
            this.US_Name = game.NameDetails.US_Name;
            this.Platform = platform.Abreviation;
            this.Image = game.Thumbnails.Thumbnail;
            this.HasBox = game.HasBox;
            this.HasInstructions = game.HasInstructions;
            this.Condition = game.Condition;
            this.Notes = game.Notes;
        }
Exemplo n.º 4
0
 public void LoadAllGameData(Action callback)
 {
     ObservableCollection<PlatformData> platforms = GetAllPlatforms();
     foreach (var item in platforms)
     {
         this.SelectedPlatform = item;
         XMLReader reader = new XMLReader();
         reader.ReadGameData(item.Abreviation, HandleGameData);
         Debug.WriteLine("Loading games for platform " + item.UK_Name);
     }
     if (callback != null)
     {
         callback();
     }
 }
Exemplo n.º 5
0
        public void FindGameData(string platform, Action<ObservableCollection<GameData>, Exception> callback)
        {
            this.CallBack = callback;

            this.SelectedPlatform = GetSelectedPlatform(platform);

            if (this.SelectedPlatform == null)
            {
                callback(null, new Exception() {});
            }

            ObservableCollection<GameData> gamesList = (ObservableCollection<GameData>)DatabaseFunctions.GetGamesForPlatform(SelectedPlatform.Abreviation);
            if (gamesList.Count > 0)
            {
                CallBack(gamesList, null);
                Debug.WriteLine("-- Using Database data");
            }
            else
            {
                XMLReader reader = new XMLReader();
                reader.ReadGameData(this.SelectedPlatform.Abreviation, HandleGameData);
                Debug.WriteLine("-- Using Database data");
            }
        }
Exemplo n.º 6
0
 public void GetPlatformData(string platformShortName)
 {
     this.SelectedPlatform = this.Data.GetSelectedPlatform(platformShortName);
 }
Exemplo n.º 7
0
        public EditPlatformViewmodel()
        {
            this.SelectedPlatform = new PlatformData();

            PlatformList = this.Data.GetAllPlatforms();
        }
Exemplo n.º 8
0
        public static void UpdatePlatformData(PlatformData platformData)
        {
            //GetDataBase();
            using (GameDataContext context = new GameDataContext(Constants.DBConnectionString))
            {
                IQueryable<PlatformData> query = from p in context.Platform
                                                 where p.ID == platformData.ID
                                                 select p;
                PlatformData platform = query.FirstOrDefault();

                if (platform == null)
                {
                    SavePlatform(platformData);
                    return;
                }

                platform.UK_Name = platformData.UK_Name;
                platform.US_Name = platformData.US_Name;

                context.SubmitChanges();
            }
        }
Exemplo n.º 9
0
 public static PlatformData GetSelectedPlatform(string platformName)
 {
     //GetDataBase();
     PlatformData platformData = new PlatformData();
     using (GameDataContext context = new GameDataContext(Constants.DBConnectionString))
     {
         IQueryable<PlatformData> query = from p in context.Platform
                                          where p.UK_Name == platformName || p.US_Name == platformName || p.Abreviation == platformName
                                          select p;
         platformData = query.FirstOrDefault();
     }
     return platformData;
 }
Exemplo n.º 10
0
 public void SavePlatform(PlatformData platform)
 {
     DatabaseFunctions.SavePlatform(platform);
 }
Exemplo n.º 11
0
 internal void UpdatePlatformData(PlatformData platformData)
 {
     DatabaseFunctions.UpdatePlatformData(platformData);
 }