Exemplo n.º 1
0
        public void SaveHighScores(DomainModel.PlayerStat player)
        {
            ///ToDo:
            ///parasyt si saugojimo metoda kad iterpinetu ne daugiau nei man reikia, tarkim
            ///top 10 ir i ji kaip nors irasytu
            //IList<PlayerStat> players = database.GetPlayerByType(player.Type);
            IList <PlayerStat> list = database.GetPlayerByType(player.Type);

            if (list.Count == 10)
            {
                IEnumerable <PlayerStat> sortedEnum = list.OrderByDescending(f => f.Point);
                database.RemovePlayerRezultByID(sortedEnum.ElementAt(9).Id);
            }
            database.AddPlayerRezult(player);
        }
Exemplo n.º 2
0
        public bool NewRecord(DomainModel.PlayerStat player)
        {
            IList <PlayerStat> players = database.GetPlayerByType(player.Type);

            if (players.Count < 10)
            {
                return(true);
            }
            foreach (var a in players)
            {
                if (player.Point > a.Point)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 3
0
 public void Remove(DomainModel.PlayerStat entity)
 {
     session.Delete(entity);
     session.Flush();
 }
Exemplo n.º 4
0
 public void Save(DomainModel.PlayerStat entity)
 {
     session.SaveOrUpdate(entity);
     session.Flush();
 }