コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
        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
                });
            }
        }
コード例 #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;
                }
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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;
        }
コード例 #9
0
 public CountryWalletViewModel(Entities.Country country, List <WalletMoney> money) : base(money)
 {
     Info = new CountryInfoViewModel(country);
 }
コード例 #10
0
 private static bool isPresident(Entities.Country country, int entityID)
 {
     return(entityID == country.PresidentID || entityID == country.ID);
 }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: Account.cs プロジェクト: ORT-DA1/Galisteo-Pina
 public static ICellPhoneValidator GetCellPhoneValidator(Country country)
 {
     return(CellPhoneValidators.Find(cv => cv.CellPhoneValidatorCountry.ToString() == country.Name));
 }
コード例 #13
0
ファイル: Account.cs プロジェクト: ORT-DA1/Galisteo-Pina
 public Account(string mobileNumber, Country country, int balance = 0)
 {
     this.AccountCellPhoneNumber = mobileNumber;
     this.AccountCountry         = country;
     this.AccountBalance         = balance;
 }
コード例 #14
0
 public CreateNewspaperViewModel(Entities.Country country, ConfigurationTable config, string prevName) : this(country, config)
 {
     Name = prevName;
 }