Exemplo n.º 1
0
        /// <summary>
        /// Returns true/false depending on if there are any matches today for the specified team
        /// </summary>
        /// <param name="TeamID"></param>
        /// <returns></returns>
        public bool IsTodayAMatchDay(int TeamID)
        {
            DateTime today = new WorldAdapter().CurrentDate;

            DateTime Found = (from f in World.Fixtures
                              where f.Date == today && (f.TeamIDs[0] == TeamID || f.TeamIDs[1] == TeamID)
                              orderby f.Date
                              select f.Date).FirstOrDefault();

            return(Found.Year > 1);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns an age based on the given DOB, and the current game date.
        /// </summary>
        /// <param name="dob">Date of Birth</param>
        /// <returns>Age</returns>
        public int CalculateAgeInGame(DateTime dob)
        {
            WorldAdapter wa = new WorldAdapter();

            DateTime today = wa.CurrentDate;
            int      age   = today.Year - dob.Year;

            if (dob.Date > today.AddYears(0 - age))
            {
                age--;
            }

            return(age);
        }
Exemplo n.º 3
0
        private void SendEmailWorker(int ToManagerID, EmailType Type, EmailFrom FromEntity, string FromName, List <int> PlaceholderIDs)
        {
            WorldAdapter wa = new WorldAdapter();

            Email e = new Email();

            e.From          = FromEntity;
            e.FromOtherName = (FromEntity == EmailFrom.Other ? FromName : "");
            e.UniqueID      = wa.GetNextEmailID();
            e.Date          = wa.CurrentDate;
            e.Read          = false;
            e.TemplateID    = GetRandomEmailTemplateForType(Type).UniqueID;
            e.Data          = PlaceholderIDs;

            if (!World.Emails.ContainsKey(ToManagerID))
            {
                World.Emails[ToManagerID] = new List <Email>();
            }

            World.Emails[ToManagerID].Add(e);
        }