Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: nuisit/rri
        private void Form1_Load(object sender, EventArgs e)
        {
            _worldBankLifespanList = JsonConvert.DeserializeObject <List <WorldBankLifespanModel> >(LoadJson("Data/worldbank-lifespan.json"));

            _criterionNumber    = new CriterionNumberModel();
            _employeeCriteria   = new EmployeeCriteriaModel();
            _policyRateCriteria = new PolicyRateCriteriaModel();

            _policyRateList = GetPolicyRateList(_policyRateCriteria);

            var costMonthlyAmountList = JsonConvert.DeserializeObject <List <ListItemModel> >(LoadJson("Data/costMonthlyAmount.json"));

            cbbCostMonthlyAmount.DataSource    = costMonthlyAmountList;
            cbbCostMonthlyAmount.DisplayMember = "Text";
            cbbCostMonthlyAmount.ValueMember   = "Value";
            cbbCostMonthlyAmount.SelectedIndex = 1;

            var lifespanList = JsonConvert.DeserializeObject <List <ListItemModel> >(LoadJson("Data/lifespan.json"));

            cbbLifespan.DataSource    = lifespanList;
            cbbLifespan.DisplayMember = "Text";
            cbbLifespan.ValueMember   = "Value";
            cbbLifespan.SelectedIndex = 4;

            var automaticEscalationList = JsonConvert.DeserializeObject <List <ListItemModel> >(LoadJson("Data/automaticEscalation.json"));

            cbbAutomaticEscalation.DataSource    = automaticEscalationList;
            cbbAutomaticEscalation.DisplayMember = "Text";
            cbbAutomaticEscalation.ValueMember   = "Value";

            var collectAdjustRateList = JsonConvert.DeserializeObject <List <ListItemModel> >(LoadJson("Data/collectAdjustRates.json"));

            cbbCollectAdjustRate.DataSource    = collectAdjustRateList;
            cbbCollectAdjustRate.DisplayMember = "Text";
            cbbCollectAdjustRate.ValueMember   = "Value";
            cbbCollectAdjustRate.SelectedIndex = 1;

            decimal.TryParse(((ListItemModel)cbbCostMonthlyAmount.SelectedItem).Value, out decimal costMonthlyAmount);
            _employeeCriteria.CostMonthlyAmount = costMonthlyAmount;
            int.TryParse(((ListItemModel)cbbLifespan.SelectedItem).Value, out int lifespan);
            _employeeCriteria.Lifespan = lifespan;
            _employeeCriteria.EmployersRatePercentage      = ntxtEmployersRatePercentage.Value;
            _employeeCriteria.RetirementAge                = decimal.ToInt32(ntxtRetirementAge.Value);
            _employeeCriteria.SalaryIncreaseRatePercentage = ntxtSalaryIncreaseRatePercentage.Value;
            _employeeCriteria.SalaryCap = ntxtSalaryCap.Value;

            _employeeCriteria.IsDoTargetDate = chkIsDoTargetDate.Checked;

            this.ntxtMarketPolicy.Value      = _policyRateCriteria.MarketPolicyPercentage;
            this.ntxtBondPolicy.Value        = _policyRateCriteria.BondPolicyPercentage;
            this.ntxtThaiStockPolicy.Value   = _policyRateCriteria.ThaiStockPolicyPercentage;
            this.ntxtRealEstatePolicy.Value  = _policyRateCriteria.RealEstatePolicyPercentage;
            this.ntxtForeignFundPolicy.Value = _policyRateCriteria.ForeignFundPolicyPercentage;
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: nuisit/rri
        public List <PolicyRateModel> GetPolicyRateList(PolicyRateCriteriaModel criteria)
        {
            List <PolicyRateModel> policyRateList = new List <PolicyRateModel>();

            policyRateList.Add(new PolicyRateModel
            {
                MarketPolicyPercentage      = criteria.MarketPolicyPercentage,
                BondPolicyPercentage        = criteria.BondPolicyPercentage,
                ThaiStockPolicyPercentage   = criteria.ThaiStockPolicyPercentage,
                RealEstatePolicyPercentage  = criteria.RealEstatePolicyPercentage,
                ForeignFundPolicyPercentage = criteria.ForeignFundPolicyPercentage,
                AgeRange = new RangeModel <int> {
                    Start = 20, End = 30
                },
                MMPercentage       = 0,
                EQPercentage       = 50,
                REITsPercentage    = 10,
                GlobalEQPercentage = 10
            });
            policyRateList.Add(new PolicyRateModel
            {
                MarketPolicyPercentage      = criteria.MarketPolicyPercentage,
                BondPolicyPercentage        = criteria.BondPolicyPercentage,
                ThaiStockPolicyPercentage   = criteria.ThaiStockPolicyPercentage,
                RealEstatePolicyPercentage  = criteria.RealEstatePolicyPercentage,
                ForeignFundPolicyPercentage = criteria.ForeignFundPolicyPercentage,
                AgeRange = new RangeModel <int> {
                    Start = 31, End = 40
                },
                MMPercentage       = 0,
                EQPercentage       = 40,
                REITsPercentage    = 10,
                GlobalEQPercentage = 10
            });
            policyRateList.Add(new PolicyRateModel
            {
                MarketPolicyPercentage      = criteria.MarketPolicyPercentage,
                BondPolicyPercentage        = criteria.BondPolicyPercentage,
                ThaiStockPolicyPercentage   = criteria.ThaiStockPolicyPercentage,
                RealEstatePolicyPercentage  = criteria.RealEstatePolicyPercentage,
                ForeignFundPolicyPercentage = criteria.ForeignFundPolicyPercentage,
                AgeRange = new RangeModel <int> {
                    Start = 41, End = 50
                },
                MMPercentage       = 0,
                EQPercentage       = 40,
                REITsPercentage    = 5,
                GlobalEQPercentage = 5
            });
            policyRateList.Add(new PolicyRateModel
            {
                MarketPolicyPercentage      = criteria.MarketPolicyPercentage,
                BondPolicyPercentage        = criteria.BondPolicyPercentage,
                ThaiStockPolicyPercentage   = criteria.ThaiStockPolicyPercentage,
                RealEstatePolicyPercentage  = criteria.RealEstatePolicyPercentage,
                ForeignFundPolicyPercentage = criteria.ForeignFundPolicyPercentage,
                AgeRange = new RangeModel <int> {
                    Start = 51, End = 100
                },
                MMPercentage       = 10,
                EQPercentage       = 15,
                REITsPercentage    = 2.5M,
                GlobalEQPercentage = 2.5M
            });

            return(policyRateList);
        }