Beispiel #1
0
        private static void UpdateNotifications(GameContext context, Injuries injury)
        {
            context.Lineups
            .Where(x => x.Date.Equals(NextGame.NEXT_GAME) &&
                   x.PlayerID == injury.PlayerID)
            .ToList()
            .ForEach(s =>
            {
                var inj = new InjuryNotification
                {
                    UserID            = s.UserID,
                    ReadStatus        = false,
                    DateCreated       = DateTime.UtcNow,
                    PlayerID          = s.PlayerID,
                    InjuryStatus      = injury.Status,
                    InjuryDescription = injury.Injury
                };

                if (!context.InjuryNotifications
                    .Any(x => x.InjuryStatus.Equals(inj.InjuryStatus) &&
                         x.PlayerID == inj.PlayerID))
                {
                    context.InjuryNotifications.Add(inj);
                }
            });
        }
Beispiel #2
0
        private static void AddToDatabase(GameContext context, JToken injury)
        {
            var injuryObj = new Injuries
            {
                Title       = (string)injury["Title"],
                Status      = (string)injury["PlayerStatus"],
                Injury      = (string)injury["Injury"],
                Description = (string)injury["News"],
                Date        = DateTime.Parse(injury["CreatedDate"].ToString()).ToUniversalTime(),
                Link        = (string)injury["Link"]
            };

            injuryObj.Player = context.Players.Where(x => x.NbaID == (int)injury["PrimarySourceKey"]).FirstOrDefault();

            if (injuryObj.Player == null)
            {
                return;
            }
            context.Injuries.Add(injuryObj);
            context.Players
            .Where(p => p.NbaID == injuryObj.Player.NbaID)
            .FirstOrDefault()
            .Status = injuryObj.Status;
            context.Players
            .Where(p => p.NbaID == injuryObj.Player.NbaID)
            .FirstOrDefault()
            .StatusDate = DateTime.Parse(injury["CreatedDate"].ToString()).ToUniversalTime();
            UpdateNotifications(context, injuryObj);
        }
Beispiel #3
0
 protected virtual InjuryBlueprint GetBlueprintFor(double intensity)
 {
     return(Injuries
            .OrderBy(a =>
                     //find the closest intensity injury to what is desired
                     Math.Abs(intensity - a.Severity))
            .FirstOrDefault());
 }
        public WarriorViewModel(IWarrior warrior)
        {
            if (warrior == null)
            {
                throw new ArgumentNullException("Warrior is null");
            }
            Warrior = warrior;
            Warrior.PropertiesChanged      += Warrior_PropertiesChanged;
            ShowWeaponsPickerCommand        = new ShowWeaponsPicker(this);
            BuyWarriorCommand               = new BuyWarrior(this);
            RemoveWarriorCommand            = new RemoveWarrior(this);
            IncreaseWarriorBuyAmountCommand = new IncreaseBuyAmount(this);
            DecreaseWarriorBuyAmountCommand = new DecreaseBuyAmount(this);
            ShowSkillSelectorCommand        = new ShowSkillSelector(this);

            foreach (IEquipment item in warrior.Equipment)
            {
                EquippedWeapons.Add(new EquipmentSummaryViewModel(item));
            }

            foreach (var item in warrior.AllowedSkills)
            {
                //if (!warrior.Skills.Contains(item))
                //{
                AllowedSkills.Add(new SkillViewModel(item));
                //}
            }

            IWizard wizard = warrior as IWizard;

            if (wizard != null)
            {
                foreach (var item in wizard.DrawnSpells)
                {
                    Spells.Add(new SpellViewModel(item));
                }
            }

            IHero hero = warrior as IHero;

            if (hero != null)
            {
                foreach (var item in hero.Injuries)
                {
                    InjuryViewModel injuryModel = new InjuryViewModel(item);

                    Injuries.Add(injuryModel);
                    InjuriesSimple.Add(injuryModel);
                }

                foreach (var item in hero.Skills)
                {
                    Skills.Add(new SkillViewModel(item));
                    SkillsSimple.Add(new SkillViewModelSimple(item));
                }
            }
        }
        public void ResetData()
        {
            SelectedIndex1 = 0;
            SelectedIndex2 = 0;
            SelectedIndex3 = 0;
            SelectedIndex4 = 0;
            SelectedIndex5 = 0;
            SelectedIndex6 = 0;
            SelectedIndex7 = 0;

            for (int i = 0; i < InjuredPlayers.Count; i++)
            {
                InjuredPlayers[i] = new Injuries();
            }
        }
        public AddInjury(Injuries injury)
        {
            InitializeComponent();
            CmbInjury.ItemsSource       = context.Injury.ToList();
            CmbInjury.DisplayMemberPath = "InjuryName";

            CmbPlayer.ItemsSource       = context.ViewAllInfo.ToList();
            CmbPlayer.DisplayMemberPath = "FullName";

            TxtTreatment.Text       = injury.Treatment.ToString();
            TxtDescription.Text     = injury.Description.ToString();
            CmbInjury.SelectedIndex = injury.IdInjury - 1;
            CmbPlayer.SelectedIndex = injury.IdPlayer - 1;
            DpInjury.SelectedDate   = injury.DateOfInjury;
        }
Beispiel #7
0
        public Injuries GetTeamData(string tricode)
        {
            Injuries injured = new Injuries();

            try
            {
                using (DtvRedZoneEntities db = new DtvRedZoneEntities())
                {
                    var t = db.Teams.Where(n => n.DtvTricode.Equals(tricode));
                    foreach (var team1 in t)
                    {
                        injured.Logo = team1.DtvTricode;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(injured);
        }
Beispiel #8
0
        public void InjuryResourceTest()
        {
            var injury = Injuries.Injury();

            Assert.NotEqual(string.Empty, injury);
        }