コード例 #1
0
        /// <summary>
        /// This function get all players id in a list.
        /// </summary>
        /// <returns>A list of all players id.</returns>
        public List <long> GetAllPlayerIds()
        {
            List <long> ids = new List <long>();

            using (var db = new Database.ucrdbEntities(m_vConnectionString))
            {
                foreach (player p in db.player)
                {
                    ids.Add(p.PlayerId);
                }
            }
            return(ids);
        }
コード例 #2
0
        /// <summary>
        /// This function return all alliances in database, in a list<>.
        /// </summary>
        /// <returns>Return a list<> containing all alliances.</returns>
        public List <Alliance> GetAllAlliances()
        {
            List <Alliance> alliances = new List <Alliance>();

            try
            {
                using (var db = new Database.ucrdbEntities(m_vConnectionString))
                {
                    var a = db.clan;

                    foreach (clan c in a)
                    {
                        Alliance alliance = new Alliance();
                        alliance.LoadFromJSON(c.Data);
                        alliances.Add(alliance);
                    }
                }
            }
            catch (Exception ex)
            {
                Debugger.WriteLine("An exception occured during GetAlliance processing:", ex);
            }
            return(alliances);
        }