Exemplo n.º 1
0
        public virtual void EndMPP(MilitaryProtectionPact mpp)
        {
            var firstCountry  = Persistent.Countries.GetById(mpp.FirstCountryID);
            var secondCountry = Persistent.Countries.GetById(mpp.SecondCountryID);

            var firstLink  = EntityLinkCreator.Create(firstCountry.Entity);
            var secondLink = EntityLinkCreator.Create(secondCountry.Entity);

            var msg = $"MPP between {firstLink} and {secondLink} has ended.";

            warningService.AddWarning(firstCountry.ID, msg);
            warningService.AddWarning(secondCountry.ID, msg);

            militaryProtectionPactRepository.Remove(mpp);
            ConditionalSaveChanges(militaryProtectionPactRepository);
        }
Exemplo n.º 2
0
        public MPPViewModel(MilitaryProtectionPact mpp)
        {
            IsProposal = IsProposed = false;
            var firstCountry  = Persistent.Countries.GetById(mpp.FirstCountryID);
            var secondCountry = Persistent.Countries.GetById(mpp.SecondCountryID);

            FirstCountryName = firstCountry.Entity.Name;
            FirstCountryID   = firstCountry.ID;

            SecondCountryName = secondCountry.Entity.Name;
            SecondCountryID   = secondCountry.ID;

            StatusTxt = $"Will end at day {mpp.EndDay}";

            ID       = mpp.ID;
            StartDay = mpp.StartDay;
        }
Exemplo n.º 3
0
        public void AcceptMPP(MilitaryProtectionPactOffer offer)
        {
            var otherLink = EntityLinkCreator.Create(offer.SecondCountry.Entity);
            var msg       = $"{otherLink} accepted your MPP offer.";

            warningService.AddWarning(offer.FirstCountryID, msg);

            var pact = new MilitaryProtectionPact()
            {
                Active          = true,
                StartDay        = GameHelper.CurrentDay,
                EndDay          = GameHelper.CurrentDay + offer.Length,
                FirstCountryID  = offer.FirstCountryID,
                SecondCountryID = offer.SecondCountryID
            };

            militaryProtectionPactRepository.Add(pact);
            militaryProtectionPactOfferRepository.Remove(offer);
            militaryProtectionPactOfferRepository.SaveChanges();
        }