示例#1
0
        public bool SetClassLink(Player player)
        {
            SqlConnection   con             = Database.connection;
            ClassSQLContext classSqlContext = new ClassSQLContext();

            if (classSqlContext.Insert(player.Class) != null)
            {
                return(true);
            }
            return(false);
        }
示例#2
0
        public Player CreatePlayerFromReader(SqlDataReader reader)
        {
            Gender g = (Gender)Enum.Parse(typeof(Gender), Convert.ToString(reader["Gender"]));
            Race   r = (Race)Enum.Parse(typeof(Race), Convert.ToString(reader["Race"]));
            Player p = new Player(
                Convert.ToInt32(reader["pId"]),
                Convert.ToString(reader["Name"]),
                g,
                r,
                Convert.ToInt32(reader["Gold"]),
                Convert.ToInt32(reader["Deaths"]),
                Convert.ToInt32(reader["HighestWave"]));

            Stats s = new StatsSQLContext().GetById(Convert.ToInt32(reader["sId"]));
            Class c = new ClassSQLContext().GetById(Convert.ToInt32(reader["cId"]));

            p.Stats     = s;
            p.Class     = c;
            p.Inventory = new InventorySQLContext().GetInventory(p);
            return(p);
        }