internal void AddCountry(Entities.Country country, UrlHelper urlHelper)
        {
            NavigationSectionViewModel countrySection = new NavigationSectionViewModel()
            {
                Name = country.Entity.Name
            };

            countrySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Information",
                Url  = urlHelper.Action("View", "Country", new { countryID = country.ID })
            });

            countrySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Geography",
                Url  = urlHelper.Action("Geography", "Country", new { countryID = country.ID })
            });

            countrySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "President",
                Url  = urlHelper.Action("President", "Country", new { countryID = country.ID })
            });

            countrySection.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Congress",
                Url  = urlHelper.Action("View", "Congress", new { countryID = country.ID })
            });



            MainSections.Add(countrySection);
        }
        public CreateNewspaperViewModel(Entities.Country country, ConfigurationTable configuration)
        {
            CountryName = country.Entity.Name;

            var countryMoney = Persistent.Countries.GetCountryCurrency(country);

            CountryFee = new MoneyViewModel(countryMoney, country.CountryPolicy.NewspaperCreateCost);
            AdminFee   = new MoneyViewModel(GameHelper.Gold, configuration.PartyFoundingFee);

            IsParty = SessionHelper.CurrentEntity.GetEntityType() == Entities.enums.EntityTypeEnum.Party;
        }
Exemple #3
0
        private CongressCandidateVoting CreateNewCongressCandidateVoting(Entities.Country country, int votingDay)
        {
            var voting = new CongressCandidateVoting()
            {
                CountryID      = country.ID,
                VotingDay      = votingDay,
                VotingStatusID = (int)VotingStatusEnum.NotStarted
            };

            congressCandidateVotingRepository.Add(voting);
            congressCandidateVotingRepository.SaveChanges();

            return(voting);
        }
Exemple #4
0
        public PresidentVoting CreateNewPresidentVoting(Entities.Country country, int votingDay)
        {
            var voting = new PresidentVoting()
            {
                CountryID      = country.ID,
                StartDay       = votingDay,
                VotingStatusID = (int)VotingStatusEnum.NotStarted
            };

            presidentVotingRepository.Add(voting);

            presidentVotingRepository.SaveChanges();


            return(voting);
        }
        public DeclareEmbargoViewModel(Entities.Country country, List <Entity> possibleCountries)
        {
            Info = new CountryInfoViewModel(country);


            PossiblEmbargoes.Add(new SelectListItem()
            {
                Value = "null",
                Text  = "-- Select --"
            });

            foreach (var possibleCountry in possibleCountries)
            {
                PossiblEmbargoes.Add(new SelectListItem()
                {
                    Value = possibleCountry.EntityID.ToString(),
                    Text  = possibleCountry.Name
                });
            }
        }
Exemple #6
0
        public CongressVotingsViewModel(Entities.Country country) : base(country)
        {
            CountryName = country.Entity.Name;
            CountryID   = country.ID;

            var citizen = SessionHelper.LoggedCitizen;

            if (citizen.ID == SessionHelper.CurrentEntity.EntityID)
            {
                if (country.Congressmen.Any(c => c.CitizenID == citizen.ID))
                {
                    IsCongressman     = true;
                    CanStartNewVoting = citizen.Congressmen.First(c => c.CountryID == country.ID).LastVotingDay < GameHelper.CurrentDay;
                }
                else
                {
                    IsCongressman = false;
                }
            }
        }
        public void AddMarket(Entities.Country country, UrlHelper urlHelper)
        {
            NavigationSectionViewModel market = new NavigationSectionViewModel()
            {
                Name = "Market"
            };

            market.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Hotels",
                Url  = urlHelper.Action("Index", "Hotel")
            });

            market.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Houses",
                Url  = urlHelper.Action("Houses", "MarketOffer", new { countryID = country.ID })
            });

            market.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Products",
                Url  = urlHelper.Action("MarketOffers", "MarketOffer", new { countryID = country.ID, quality = 0, productID = 0 })
            });

            market.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Resources",
                Url  = urlHelper.Action("ResourceOffers", "MarketOffer", new { countryID = country.ID, quality = 0, productID = 0 })
            });

            market.Children.Add(new NavigationSectionViewModel()
            {
                Name = "Jobs",
                Url  = urlHelper.Action("JobMarket", "JobOffer")
            });

            MainSections.Add(market);
        }
        public CountryMPPListViewModel(Entities.Country country, List <MilitaryProtectionPact> pacts,
                                       List <MilitaryProtectionPactOffer> proposedList, List <MilitaryProtectionPactOffer> proposals)
        {
            Info = new CountryInfoViewModel(country);
            foreach (var pact in pacts)
            {
                MPPs.Add(new MPPViewModel(pact));
            }
            foreach (var proposed in proposedList)
            {
                MPPs.Add(new MPPViewModel(proposed, isProposal: false));
            }
            foreach (var proposal in proposals)
            {
                MPPs.Add(new MPPViewModel(proposal, true));
            }

            var mppService = DependencyResolver.Current.GetService <IMPPService>();

            RuledCountries = mppService.GetListOfCountriesWhereCitizenCanManageMPPs(SessionHelper.LoggedCitizen)
                             .Select(c => c.ID).ToList();

            CanCreateMPPOffers = mppService.CanOfferMPP(SessionHelper.CurrentEntity, country).isSuccess;
        }
Exemple #9
0
 public CountryWalletViewModel(Entities.Country country, List <WalletMoney> money) : base(money)
 {
     Info = new CountryInfoViewModel(country);
 }
Exemple #10
0
 private static bool isPresident(Entities.Country country, int entityID)
 {
     return(entityID == country.PresidentID || entityID == country.ID);
 }
        public CongressStartVotingViewModel(List <VotingType> votingTypes, List <CommentRestriction> commentRestrictions, Entities.Country country)
            : base(country)
        {
            CountryID   = country.ID;
            VotingTypes = CreateSelectList(votingTypes, vt => ((VotingTypeEnum)vt.ID).ToHumanReadable(), vt => vt.ID, true, "Select voting type")
                          .OrderBy(vt => vt.Text)
                          .ToList();

            var countryPolicy = country.CountryPolicy;

            AddMoreVotingTypesBasedOnPolicy(countryPolicy);

            CommentRestrictions = CreateSelectList(commentRestrictions,
                                                   cr => ((CommentRestrictionEnum)cr.ID).ToHumanReadable().FirstUpper(),
                                                   cr => cr.ID,
                                                   false);
        }
Exemple #12
0
 public static ICellPhoneValidator GetCellPhoneValidator(Country country)
 {
     return(CellPhoneValidators.Find(cv => cv.CellPhoneValidatorCountry.ToString() == country.Name));
 }
Exemple #13
0
 public Account(string mobileNumber, Country country, int balance = 0)
 {
     this.AccountCellPhoneNumber = mobileNumber;
     this.AccountCountry         = country;
     this.AccountBalance         = balance;
 }
 public CreateNewspaperViewModel(Entities.Country country, ConfigurationTable config, string prevName) : this(country, config)
 {
     Name = prevName;
 }