public ViewPrintMoneyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     MoneyAmount    = int.Parse(voting.Argument1);
     CurrencySymbol = Persistent.Countries.GetCountryCurrency(voting.CountryID).Symbol;
     GoldCost       = double.Parse(voting.Argument2);
 }
Beispiel #2
0
        public ViewCreateNationalCompanyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            CompanyName = voting.Argument1;
            int             regionID    = Convert.ToInt32(voting.Argument2);
            ProductTypeEnum productType = (ProductTypeEnum)Convert.ToInt32(voting.Argument3);

            var region = Persistent.Regions.GetById(regionID);

            RegionName = region.Name;


            if (productType == ProductTypeEnum.MedicalSupplies)
            {
                var hospitalService = DependencyResolver.Current.GetService <IHospitalService>();
                CompanyName = hospitalService.GenerateNameForHospital(region);
            }

            switch (productType)
            {
            case ProductTypeEnum.SellingPower:
                ShopDomain = "It will be a shop.";
                break;

            default:
                ShopDomain = $"It will produce {productType.ToHumanReadable()}.";
                break;
            }
        }
Beispiel #3
0
        public ViewChangeGreetingMessageViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            var greetingID   = int.Parse(voting.Argument1);
            var greetingRepo = DependencyResolver.Current.GetService <IVotingGreetingMessageRepository>();

            GreetingMessage = greetingRepo.GetById(greetingID).Message;
        }
Beispiel #4
0
        public ViewRemoveNationalCompanyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            CompanyID   = int.Parse(voting.Argument1);
            CompanyName = voting.Argument2;

            var companyRepository = DependencyResolver.Current.GetService <ICompanyRepository>();

            Exists = companyRepository.Any(c => c.ID == CompanyID);
        }
        public ViewBuildDefenseSystemViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            var defenseSystemService = DependencyResolver.Current.GetService <IDefenseSystemService>();

            RegionID = int.Parse(voting.Argument1);
            Quality  = int.Parse(voting.Argument3);

            RegionName = Persistent.Regions.GetById(RegionID).Name;
            GoldCost   = (double)defenseSystemService.GetGoldCostForStartingConstruction(Quality);
        }
        public ViewAssignManagerToCompanyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            CompanyID = int.Parse(voting.Argument1);
            CitizenID = int.Parse(voting.Argument2);

            var entityRepository = DependencyResolver.Current.GetService <IEntityRepository>();

            var company = entityRepository.GetById(CompanyID);
            var citizen = entityRepository.GetById(CitizenID);

            CompanyName = company.Name;
            CitizenName = citizen.Name;
        }
Beispiel #7
0
        public ViewTransferCashToCompanyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            Amount    = decimal.Parse(voting.Argument1);
            CompanyID = int.Parse(voting.Argument2);
            var currencyID = int.Parse(voting.Argument3);

            CurrencySymbol = Persistent.Currencies.GetById(currencyID).Symbol;

            var companyRepository = DependencyResolver.Current.GetService <ICompanyRepository>();

            CompanyName = companyRepository.Where(c => c.ID == CompanyID)
                          .Select(c => c.Entity.Name).First();
        }
        public ViewChangeProductExportTaxViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting, isPlayerCongressman, canVote)
        {
            ProductName  = ((ProductTypeEnum)int.Parse(voting.Argument1)).ToHumanReadable();
            NewExportTax = double.Parse(voting.Argument2);
            int foreignCountryID = int.Parse(voting.Argument3);

            if (foreignCountryID == -1)
            {
                ForeignCountryName = "all countries";
            }
            else
            {
                ForeignCountryName = Persistent.Countries.GetById(foreignCountryID).Entity.Name;
            }
        }
        public ViewVotingBaseViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
            : base(voting.Country)
        {
            VotingID           = voting.ID;
            CreatorName        = voting.Citizen.Entity.Name;
            CreatorID          = voting.Citizen.ID;
            CommentRestriction = (CommentRestrictionEnum)voting.CommentRestrictionID;
            ApplyCommentRestriction(isPlayerCongressman);
            CreatorMessage = voting.CreatorMessage;

            foreach (var votes in voting.CongressVotes)
            {
                if (votes.VoteTypeID == (int)VoteTypeEnum.Yes)
                {
                    YesVoters.Add(new CongressVotingVoterViewModel(votes.Citizen));
                }
                else if (votes.VoteTypeID == (int)VoteTypeEnum.No)
                {
                    NoVoters.Add(new CongressVotingVoterViewModel(votes.Citizen));
                }
            }

            VotingStatus = (VotingStatusEnum)voting.VotingStatusID;


            MoreNoVotersCount  = NoVoters.Count - 5;
            MoreYesVotersCount = YesVoters.Count - 5;



            var timeLeft = voting.GetTimeLeft(GameHelper.CurrentDay);

            if (timeLeft.TotalSeconds > 0)
            {
                TimeLeft          = string.Format("{0:00}:{1:00}:{2:00}", (int)timeLeft.TotalHours, (int)timeLeft.Minutes, timeLeft.Seconds);
                WaitingForResolve = false;
            }
            else
            {
                TimeLeft          = "00:00:00";
                WaitingForResolve = true;
            }

            CanVote = canVote && WaitingForResolve == false;
        }
 public ViewChangeMinimumMonetaryTaxValueViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     CurrencySymbol = Persistent.Countries.GetCountryCurrency(voting.CountryID).Symbol;
     NewTaxValue    = double.Parse(voting.Argument1);
 }
Beispiel #11
0
 public ViewChangeContractJobMarketFeeViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewJobFee      = double.Parse(voting.Argument1);
     CurrencySymbol = voting.Country.Currency.Symbol;
 }
 public ViewChangeNewspaperCreateCostViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewCreateCost  = double.Parse(voting.Argument1);
     CurrencySymbol = Persistent.Countries.GetCountryCurrency(voting.CountryID).Symbol;
 }
 public ViewChangeCitizenStartingMoneyViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     Fee            = decimal.Parse(voting.Argument1);
     CurrencySymbol = Persistent.Countries.GetCountryCurrency(voting.CountryID).Symbol;
 }
Beispiel #14
0
 public ViewChangeCompanyCreationLawHolderViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     LawHolder = ((LawAllowHolderEnum)Enum.Parse(typeof(LawAllowHolderEnum), voting.Argument1)).ToHumanReadableString().FirstUpper();
 }
Beispiel #15
0
 public ViewChangeHotelTaxViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewTax = decimal.Parse(voting.Argument1);
 }
 public ViewChangeMinimumMonetaryTaxRateViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewTaxRate = double.Parse(voting.Argument1);
 }
Beispiel #17
0
 public ViewChangeProductVATViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     ProductName = ((ProductTypeEnum)int.Parse(voting.Argument1)).ToHumanReadable();
     NewVat      = double.Parse(voting.Argument2);
 }
 public ViewChangeArticleTaxViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewTax = double.Parse(voting.Argument1);
 }
Beispiel #19
0
 public ViewChangeTreasureLawHolderViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     LawHolder = (LawAllowHolderEnum)Enum.Parse(typeof(LawAllowHolderEnum), voting.Argument1);
 }
 public ViewChangeOrganisationCreateCostViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     CreateCost     = double.Parse(voting.Argument1);
     CurrencySymbol = voting.Country.Currency.Symbol;
 }
 public ViewChangeCongressCadenceLengthViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     NewCadenceLength = int.Parse(voting.Argument1);
 }
Beispiel #22
0
 public ViewChangeNormalCongressVotingWinPercentageViewModel(Entities.CongressVoting voting, bool isPlayerCongressman, bool canVote)
     : base(voting, isPlayerCongressman, canVote)
 {
     WinPercentage = double.Parse(voting.Argument1);
 }