示例#1
0
 public CountryController(ICountryRepository countryRepository, ICountryService countryService, IPresidentVotingRepository presidentVotingRepository, IWarService warService,
                          ITransactionsService transactionService, IWarRepository warRepository, IRegionService regionService, IRegionRepository regionRepository, IEmbargoService embargoService,
                          IEmbargoRepository embargoRepository, IWalletRepository walletRepository, IPopupService popupService, ICountryTreasureService countryTreasureService,
                          IWalletService walletService, ICompanyService companyService, IMPPService mppService, IMilitaryProtectionPactRepository mppRepository,
                          IMilitaryProtectionPactOfferRepository mppOfferRepository, ITransactionScopeProvider transactionScopeProvider, IConstructionRepository constructionRepository,
                          IConstructionService constructionService) : base(popupService)
 {
     this.countryRepository         = countryRepository;
     this.countryService            = countryService;
     this.presidentVotingRepository = presidentVotingRepository;
     this.warService               = warService;
     this.transactionService       = transactionService;
     this.warRepository            = warRepository;
     this.regionService            = regionService;
     this.regionRepository         = regionRepository;
     this.embargoService           = embargoService;
     this.embargoRepository        = embargoRepository;
     this.walletRepository         = walletRepository;
     this.countryTreasureService   = countryTreasureService;
     this.walletService            = walletService;
     this.companyService           = companyService;
     this.mppService               = mppService;
     this.mppRepository            = mppRepository;
     this.mppOfferRepository       = mppOfferRepository;
     this.transactionScopeProvider = transactionScopeProvider;
     this.constructionRepository   = constructionRepository;
     this.constructionService      = constructionService;
 }
        public ConstructCompanyViewModel(Entities.Country country, IRegionRepository regionRepository, IWalletService walletService, ICountryTreasureService countryTreasuryService)
        {
            Info      = new CountryInfoViewModel(country);
            CountryID = country.ID;
            var regions = regionRepository.Where(r => r.CountryID == country.ID).
                          Select(r => new
            {
                Name = r.Name,
                ID   = r.ID
            }).ToList();

            Regions   = CreateSelectList(regions, r => r.Name, r => r.ID, true);
            Functions = ProductTypeEnumUtils.GetFunctionsList();

            GoldNeeded = new MoneyViewModel(GameHelper.Gold, ConfigurationHelper.Configuration.CompanyCountryFee);
            var walletID = Persistent.Countries.GetById(country.ID).Entity.WalletID;

            TreasureGold = new MoneyViewModel(walletService.GetWalletMoney(walletID, GameHelper.Gold.ID));

            CanSeeTreasury = countryTreasuryService.CanSeeCountryTreasure(country, SessionHelper.CurrentEntity).isSuccess;
        }