Ejemplo n.º 1
0
        private void specialVotePostProcess(CongressVoting voting)
        {
            switch (voting.GetVotingType())
            {
            case VotingTypeEnum.CreateNationalCompany:
                reservedEntityNameRepository.Add(voting.Argument1);
                ReserveMoneyForVoting(voting, GetMoneyForCreatingCountryCompany());
                break;

            case VotingTypeEnum.TransferCashToCompany:
                ReserveMoneyForVoting(voting, getMoneyForTrasnferingCashToCompany(voting));
                break;

            case VotingTypeEnum.PrintMoney:
                var money = getMoneyForPrintingMoney(voting);
                ReserveMoneyForVoting(voting, money);
                double amount = (double)money.Amount;
                voting.Argument2 = amount.ToString();
                break;

            case VotingTypeEnum.RemoveNationalCompany:
                var companyID = int.Parse(voting.Argument1);
                var name      = companyRepository.Where(c => c.ID == companyID).Select(c => c.Entity.Name).First();
                voting.Argument2 = name;
                break;

            case VotingTypeEnum.BuildDefenseSystem:
                ReserveMoneyForVoting(voting, getMoneyForCreatingDefenseSystem(int.Parse(voting.Argument3)));
                break;

            default:
                return;
            }
        }
Ejemplo n.º 2
0
        public void RejectVoting(CongressVoting voting, CongressVotingRejectionReasonEnum reason)
        {
            voting.VotingStatusID    = (int)VotingStatusEnum.Rejected;
            voting.RejectionReasonID = (int)reason;

            switch (voting.GetVotingType())
            {
            case VotingTypeEnum.CreateNationalCompany:
                UnreserveMoneyForVoting(voting);
                reservedEntityNameRepository.Remove(voting.Argument1);
                break;

            case VotingTypeEnum.TransferCashToCompany:
                UnreserveMoneyForVoting(voting);
                break;

            default:
                break;
            }

            countryEventService.AddVotingEvent(voting, VotingStatusEnum.Rejected);
        }