Beispiel #1
0
        public void InsertPlayerAchievement(PlayerAchievement playerAchievement)
        {
            playerAchievementData.Descendants("player_achievement").FirstOrDefault().Add(new XElement("player_achievement",
                                                                                                      new XElement("number", playerAchievement.number), new XElement("playerID"), playerAchievement.playerId),
                                                                                         new XElement("achievementName"), playerAchievement.achievementName);

            playerAchievementData.Save(HttpContext.Current.Server.MapPath("~/App_Data/player_management.xml"));
        }
        public void InsertPlayerAchievement(PlayerAchievement playerAchievement)
        {
            GlobalVariables.XmlData.Descendants("players_achievements").FirstOrDefault().Add(new XElement("player_achievement",
                                                                                                          new XElement("number", playerAchievement.Number),
                                                                                                          new XElement("playerId", playerAchievement.PlayerID),
                                                                                                          new XElement("achievementName", playerAchievement.AchievementName)));

            GlobalVariables.XmlData.Save(HttpContext.Current.Server.MapPath(GlobalVariables.XmlPath));
            GlobalVariables.Update();
        }
        public void EditPlayerAchievement(PlayerAchievement playerAchievement)
        {
            XElement node = GlobalVariables.XmlData.Descendants("players_achievements").Elements("player_achievement")
                            .Where(i => i.Element("playerId").Value.Equals(playerAchievement.PlayerID))
                            .Where(i => i.Element("achievementName").Value.Equals(playerAchievement.AchievementName))
                            .FirstOrDefault();

            node.SetElementValue("number", playerAchievement.Number);
            node.SetElementValue("playerId", playerAchievement.PlayerID);
            node.SetElementValue("achievementName", playerAchievement.AchievementName);
            GlobalVariables.XmlData.Save(HttpContext.Current.Server.MapPath(GlobalVariables.XmlPath));
            GlobalVariables.Update();
        }
Beispiel #4
0
        public void EditPlayerAchievement(PlayerAchievement playerAchievement)
        {
            XElement node = playerAchievementData.Descendants("players_achievements").Elements("player_achievement")
                            .Where(i => i.Element("playerID").Value.Equals(playerAchievement.playerId))
                            .Where(i => i.Element("achievementName").Value.Equals(playerAchievement.achievementName))
                            .FirstOrDefault();

            node.SetElementValue("number", playerAchievement.number);
            node.SetElementValue("playerID", playerAchievement.playerId);
            node.SetElementValue("achievementName", playerAchievement.achievementName);

            playerAchievementData.Save(HttpContext.Current.Server.MapPath("~/App_Data/player_management.xml"));
        }
        public PlayerAchievement GetPlayerAchievement(String playerId, String achievementName)
        {
            PlayerAchievement playerAchievement = null;

            playerAchievement = _allPlayerAchievements.Find(item => (item.AchievementName.Equals(achievementName)) &&
                                                            (item.PlayerID.Equals(playerId)));
            _achievementRepository = new AchievementRepository();

            if (playerAchievement != null)
            {
                Achievement achievement = _achievementRepository.GetAchievementByName(achievementName);

                playerAchievement.Achievement = achievement;

                _playerRepository        = new PlayerRepository();
                playerAchievement.Player = _playerRepository.GetPlayerByID(playerId);

                return(playerAchievement);
            }
            else
            {
                return(null);
            }
        }