예제 #1
0
        private void populateSavingGoal(savinggoal savingGoal, assumption assmptn, string caseid)
        {
            double shortfallSurplus = 0;

            savingGoalNeeded2.Selected = true;

            if (savingGoal != null)
            {
                savingGoalNeeded.SelectedValue = savingGoal.savingGoalNeeded.ToString();

                goal.Text = savingGoal.goal;
                yrstoAccumulate.Text = savingGoal.yrstoaccumulate;

                if(savingGoal.amtneededfv!=null && savingGoal.amtneededfv!="")
                {
                    futureValue.Text = savingGoal.amtneededfv;
                }
                else
                {
                    futureValue.Text = "0";
                }

                if(savingGoal.maturityvalue!=null && savingGoal.maturityvalue!="")
                {
                    maturityValue.Text = savingGoal.maturityvalue;
                }
                else
                {
                    maturityValue.Text = "0";
                }

                assetList.DataSource = savingGoal.existingassetsgs;
                assetList.DataBind();

                if (savingGoal.existingassetsgs != null)
                {
                    ViewState["noofassets"] = savingGoal.existingassetsgs.Count;

                    if (savingGoal.existingassetstotal != null && savingGoal.existingassetstotal != "")
                    {
                        existingAssets.Text = savingGoal.existingassetstotal;
                    }
                    else
                    {
                        existingAssets.Text = "0";
                    }

                }

                shortfallSurplus = (double.Parse(existingAssets.Text) + double.Parse(maturityValue.Text)) - double.Parse(futureValue.Text);
                totalShortfallSurplus.Text = Math.Abs(shortfallSurplus).ToString();

            }

            if (shortfallSurplus < 0)
            {
                ttlSS.Text = "Shortfall";
                ttlSS.Style.Add("color", "red");
            }
            else if (shortfallSurplus > 0)
            {
                ttlSS.Text = "Surplus";
                ttlSS.Style.Add("color", "black");
            }
            else
            {
                ttlSS.Text = "Shortfall / Surplus";
                ttlSS.Style.Add("color", "black");
            }

            activityId.Value = caseid;
        }
        private void populateRetirementGoal(retirementgoal retirementGoalSelf, assumption inflationAdjustedReturnAsmptn, assumption annualInflationReturn, string caseid)
        {
            double shortfallSurplusSelf = 0;
            int iIntendedRetirementAge = 0;

            PersonalDetailsDAO dao = new PersonalDetailsDAO();
            personaldetail detail = dao.getPersonalDetail(caseid);

            int yrDob = 0;
            int currentYr = DateTime.Now.Year;
            int agePolicyOwner = 0;
            int iYrstoRetirement = 0;

            try
            {
                DateTime dt2 = DateTime.ParseExact(detail.datepicker, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                yrDob = dt2.Year;

                if (DateTime.Now.Month < dt2.Month)
                {
                    agePolicyOwner = currentYr - yrDob - 1;
                }
                else if (DateTime.Now.Month > dt2.Month)
                {
                    agePolicyOwner = currentYr - yrDob;
                }
                else
                {
                    if (DateTime.Now.Day < dt2.Day)
                    {
                        agePolicyOwner = currentYr - yrDob - 1;
                    }
                    else if ((DateTime.Now.Day > dt2.Day) || (DateTime.Now.Day == dt2.Day))
                    {
                        agePolicyOwner = currentYr - yrDob;
                    }
                }

                iYrstoRetirement = iIntendedRetirementAge - agePolicyOwner;
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ShowRetirementGoals Method: populateRetirementGoal setting yrs to retirement";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                activityStatusDao.logException(exLog);
            }
            pownerdob.Value = agePolicyOwner.ToString();

            if (detail != null)
            {
                pownergender.Value = detail.gender;
            }

            IncomeExpenseDAO iedao = new IncomeExpenseDAO();
            incomeExpense iedetail = iedao.getIncomeExpenseForCase(caseid);

            retirementGoalNeeded2.Selected = true;

            //populate self retirement goals
            if (retirementGoalSelf != null)
            {
                retirementGoalNeeded.SelectedValue = retirementGoalSelf.retirementGoalNeeded.ToString();

                if (retirementGoalSelf.intendedretirementage != null && retirementGoalSelf.intendedretirementage != "")
                {
                    intendedRetirementAge.Text = retirementGoalSelf.intendedretirementage;
                }
                else
                {
                    intendedRetirementAge.Text = "62";
                }
                iIntendedRetirementAge = Int32.Parse(intendedRetirementAge.Text);

                //expectedRetirementAgelbl.Text = intendedRetirementAge.Text;

                if (retirementGoalSelf.incomerequired != null && retirementGoalSelf.incomerequired != "")
                {
                    incomeRequiredUponRetirement.Text = retirementGoalSelf.incomerequired;
                }
                else
                {
                    double dincomeReq = 0;
                    if (iedetail!=null && iedetail.netMonthlyIncomeAfterCpf != null && iedetail.netMonthlyIncomeAfterCpf != "")
                    {
                        dincomeReq = 0.7 * 12 * double.Parse(iedetail.netMonthlyIncomeAfterCpf);
                    }

                    incomeRequiredUponRetirement.Text = Math.Round(dincomeReq, 2).ToString();
                }

                //presentIncomeNeededlbl.Text = incomeRequiredUponRetirement.Text;

                if (retirementGoalSelf.yrstoretirement != null && retirementGoalSelf.yrstoretirement != "")
                {
                    yearsToRetirement.Text = retirementGoalSelf.yrstoretirement;
                }
                else
                {
                    yearsToRetirement.Text = iYrstoRetirement.ToString();
                }

                //currentAgelbl.Text = (double.Parse(intendedRetirementAge.Text) - double.Parse(yearsToRetirement.Text)).ToString();

                if (retirementGoalSelf.inflationrate == null || retirementGoalSelf.inflationrate == "")
                {
                    if (annualInflationReturn != null)
                    {
                        annualInflationRate.Text = annualInflationReturn.percentage.Value.ToString();
                    }
                    else
                    {
                        annualInflationRate.Text = "0";
                    }
                }
                else
                {
                    annualInflationRate.Text = retirementGoalSelf.inflationrate;
                }

                //inflationRatelbl.Text = annualInflationRate.Text;

                if (retirementGoalSelf.futureincome != null && retirementGoalSelf.futureincome != "")
                {
                    futureIncomeNeeded.Text = retirementGoalSelf.futureincome;
                }
                else
                {
                    futureIncomeNeeded.Text = "0";
                }

                //futureIncomeNeededChartlbl.Text = futureIncomeNeeded.Text;

                if (retirementGoalSelf.sourcesofincome != null && retirementGoalSelf.sourcesofincome != "")
                {
                    sourcesOfIncome.Text = retirementGoalSelf.sourcesofincome;
                }
                else
                {
                    sourcesOfIncome.Text = "0";
                }

                if (retirementGoalSelf.totalfirstyrincome != null && retirementGoalSelf.totalfirstyrincome != "")
                {
                    totalFirstYearIncomeNeeded.Text = retirementGoalSelf.totalfirstyrincome;
                }
                else
                {
                    totalFirstYearIncomeNeeded.Text = "0";
                }

                //annualAmountlbl.Text = totalFirstYearIncomeNeeded.Text;

                if (retirementGoalSelf.inflationreturnrate == null || retirementGoalSelf.inflationreturnrate == "")
                {
                    if (inflationAdjustedReturnAsmptn != null)
                    {
                        inflationAdjustedReturn.Text = inflationAdjustedReturnAsmptn.percentage.Value.ToString();
                    }
                    else
                    {
                        inflationAdjustedReturn.Text = "0";
                    }
                }
                else
                {
                    inflationAdjustedReturn.Text = retirementGoalSelf.inflationreturnrate;
                }

                //inflationAdjustedReturnslbl.Text = inflationAdjustedReturn.Text;

                if (retirementGoalSelf.durationretirement != null && retirementGoalSelf.durationretirement != "")
                {
                    durationOfRetirement.Text = retirementGoalSelf.durationretirement;
                }
                else
                {
                    int iDurationofRetirement = 0;

                    if (detail.gender == "Male")
                    {
                        iDurationofRetirement = 83 - iIntendedRetirementAge;
                    }
                    else if (detail.gender == "Female")
                    {
                        iDurationofRetirement = 88 - iIntendedRetirementAge;
                    }

                    durationOfRetirement.Text = iDurationofRetirement.ToString();
                }

                //durationOfRetirementValuelbl.Text = durationOfRetirement.Text;
                //ageAtEndOfRetirementlbl.Text = (double.Parse(durationOfRetirement.Text) + double.Parse(intendedRetirementAge.Text)).ToString();

                if (retirementGoalSelf.lumpsumrequired != null && retirementGoalSelf.lumpsumrequired != "")
                {
                    lumpSumRequiredAtRetirement.Text = retirementGoalSelf.lumpsumrequired;
                }
                else
                {
                    lumpSumRequiredAtRetirement.Text = "0";
                }

                if (retirementGoalSelf.maturityvalue != null && retirementGoalSelf.maturityvalue != "")
                {
                    maturityValue2.Text = retirementGoalSelf.maturityvalue;
                }
                else
                {
                    maturityValue2.Text = "0";
                }

                assetListSelf.DataSource = retirementGoalSelf.existingassetrgs;
                assetListSelf.DataBind();

                if (retirementGoalSelf.existingassetrgs != null)
                {
                    ViewState["noofassets"] = retirementGoalSelf.existingassetrgs.Count;
                    if (retirementGoalSelf.existingassetstotal != null && retirementGoalSelf.existingassetstotal != "")
                    existingAssets2.Text = retirementGoalSelf.existingassetstotal;
                    else
                        existingAssets2.Text = "0";

                }

                shortfallSurplusSelf = double.Parse(existingAssets2.Text) + double.Parse(maturityValue2.Text) - double.Parse(lumpSumRequiredAtRetirement.Text);
                if (shortfallSurplusSelf < 0)
                {
                    ttlSSSelf.Text = "Shortfall";
                    ttlSSSelf.Style.Add("color", "red");
                }
                else if (shortfallSurplusSelf > 0)
                {
                    ttlSSSelf.Text = "Surplus";
                    ttlSSSelf.Style.Add("color", "black");
                }
                else
                {
                    ttlSSSelf.Text = "Total (Shortfall / Surplus)";
                    ttlSSSelf.Style.Add("color", "black");
                }

                totalShortfallSurplus2.Text = Math.Abs(shortfallSurplusSelf).ToString();
            }

            activityId.Value = caseid;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            assmptn = assumptionDao.getAssumptionById(2);

            activity = activityStatusDao.getActivity(6);
            ViewState["activity"] = activity;

            lblSavingGoalFailed.Visible = false;
            lblSavingGoalSuccess.Visible = false;
            lblStatusSubmissionFailed.Visible = false;
            lblStatusSubmitted.Visible = false;
            lblSavingGoalDelFailed.Visible = false;
            lblSavingGoalDelSuccess.Visible = false;

            int sgid = 0;
            if (savinggoalid.Value != null && savinggoalid.Value!="")
            {
                sgid = Int32.Parse(savinggoalid.Value);
            }

            ViewState["sgid"] = sgid;

            if (sgid != 0)
            {
                ViewState["casetype"] = "update";

                if (saveclicked.Value == "0" && addclicked.Value == "0" && delclicked.Value == "0")
                {
                    if (ViewState["caseid"] != null)
                    {
                        savingGoal = savingGoalsDao.getSavingGoal(ViewState["caseid"].ToString());
                    }

                    savinggoal displaysg = null;
                    if (savingGoal != null && savingGoal.Count > 0)
                    {
                        displaysg = savingGoal[0];
                        foreach (savinggoal s in savingGoal)
                        {
                            if (sgid == s.id)
                            {
                                displaysg = s;
                            }
                        }
                    }
                    populateSavingGoal(displaysg, assmptn, ViewState["caseid"].ToString());
                    saveclicked.Value = "1";
                }
                if (delclicked.Value == "1")
                {
                    deleteSavingGoal(sgid);
                }
                saveclicked.Value = "1";
            }
            else
            {
                ViewState["casetype"] = "new";
            }

            string cid = "";
            if (Session["fnacaseid"] != null)
            {
                cid = Session["fnacaseid"].ToString();
            }
            else if (ViewState["caseid"] != null)
            {
                cid = ViewState["caseid"].ToString();
            }

            if (cid != null && cid != "" && (saveclicked.Value == "0" || saveclicked.Value == "") && (addclicked.Value == "0" || addclicked.Value == "") && (delclicked.Value == "0" || delclicked.Value == ""))
            {
                savingGoal = savingGoalsDao.getSavingGoal(cid);

                savinggoal displaysg = null;
                if (savingGoal != null && savingGoal.Count > 0)
                {
                    displaysg = savingGoal[0];
                    if (displaysg.existingassetsgs != null)
                    {
                        ViewState["noofassets"] = displaysg.existingassetsgs.Count;
                        noofmembers.Value = displaysg.existingassetsgs.Count.ToString();
                    }
                }
                saveclicked.Value = "1";
            }

            if (addclicked.Value == "1")
            {
                refreshSavingGoal();
                //addclicked.Value = "0";
                saveclicked.Value = "1";
            }

            if (!IsPostBack)
            {
                /*string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseid = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseid = menuCaseId;
                }*/

                if (Session["fnacaseid"] != null)
                {
                    caseid = Session["fnacaseid"].ToString();
                }

                ViewState["caseid"] = caseid;
                activityId.Value = caseid;

                string url = "popitup('/_layouts/Zurich/AssetAndLiabilityPopUp.aspx',900,1200);return false;";
                eaAssetLiability.Attributes.Add("onClick", url);

                url = "popitup('/_layouts/Zurich/IncomeExpensePopUp.aspx',900,1200);return false;";
                mvalueLink.Attributes.Add("onClick", url);

                url = "/_layouts/Zurich/SavingGoals/ShowSavingGoals.aspx?caseid=" + caseid;
                addsggoal.Attributes.Add("PostBackUrl", url);

                if (caseid != null)
                {

                    caseidsg.Value = caseid;

                    savingGoal = savingGoalsDao.getSavingGoal(caseid);
                    if (savingGoal != null && savingGoal.Count>0 && sgid!=0)
                    {
                        ViewState["casetype"] = "update";
                    }
                    else
                    {
                        ViewState["casetype"] = "new";
                    }

                    savinggoal displaysg = null;
                    if (savingGoal != null && savingGoal.Count > 0)
                    {
                        displaysg = savingGoal[0];
                        savinggoalid.Value = displaysg.id.ToString();
                    }
                    populateSavingGoal(displaysg, assmptn, caseid);

                    List<savinggoal> gridgoal = savingGoal;
                    foreach (savinggoal s in gridgoal)
                    {
                        double damtfv = 0;
                        double dmaturityval = 0;
                        double deattl = 0;

                        if (s.amtneededfv != null && s.amtneededfv != "")
                        {
                            damtfv = double.Parse(s.amtneededfv);
                        }
                        if (s.maturityvalue != null && s.maturityvalue != "")
                        {
                            dmaturityval = double.Parse(s.maturityvalue);
                        }
                        if (s.existingassetstotal != null && s.existingassetstotal != "")
                        {
                            deattl = double.Parse(s.existingassetstotal);
                        }

                        if (((dmaturityval + deattl) - damtfv) < 0)
                        {
                            s.total = "-" + s.total;
                        }
                    }

                    existingsggrid.DataSource = gridgoal;
                    existingsggrid.DataBind();

                }
            }
            existingAssets.Attributes.Add("readonly", "readonly");
            totalShortfallSurplus.Attributes.Add("readonly", "readonly");

            yrstoAccumulate.Attributes.Add("onblur", "tempCalculate();");
            futureValue.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");
            existingAssets.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");
            maturityValue.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");

            markStatusOnTab(caseid);
        }
예제 #4
0
        private void refreshEducationGoal(assumption assmptn, EntitySet<countrycostofeducation> cced)
        {
            inflationRate.Text = "0";

            maturityValue.Text = "0";
            futureValue.Text = "0";

            if (assmptn != null && assmptn.percentage != null)
            {
                inflationRate.Text = assmptn.percentage.ToString();
            }

            int idCountrySel = 0;
            idCountrySel = cced[0].id;

            countryList.DataSource = cced;
            countryList.DataValueField = "id";
            countryList.DataTextField = "country";
            countryList.DataBind();
            countryList.SelectedValue = idCountrySel.ToString();

            costEducation.Text = "0";

            foreach (countrycostofeducation cc in cced)
            {
                if (cc.id == idCountrySel)
                {
                    if (cc.costofeducation != null && cc.costofeducation != "")
                    {
                        costEducation.Text = cc.costofeducation;
                    }
                    break;
                }
            }

            futureValue.Text = costEducation.Text;

            yrsToSave.Text = "0";
            ageWhenFundsNeeded.Text = "0";
            currentAge.Text = "0";
            nameofChild.Text = "";

            assetList.DataSource = null;
            assetList.DataBind();

            existingAssetsEducationGoals.Text = "0";

            totalShortfallSurplus.Text = "0";

            ttlSS.Text = "Shortfall / Surplus";
            ttlSS.Style.Add("color", "black");

            educationgoalid.Value = "0";
            saveclicked.Value = "0";
            delclicked.Value = "0";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            inflationAdjustedReturnAsmptn = assumptionDao.getAssumptionById(4);
            annualInflationReturn = assumptionDao.getAssumptionById(1);

            activity = activityStatusDao.getActivity(7);
            ViewState["activity"] = activity;

            if (!IsPostBack)
            {
                /*string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseid = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseid = menuCaseId;
                }*/
                if (Session["fnacaseid"] != null)
                {
                    caseid = Session["fnacaseid"].ToString();
                }

                ViewState["caseid"] = caseid;

                string url = "popitup('/_layouts/Zurich/AssetAndLiabilityPopUp.aspx',900,1200);return false;";
                eaAssetLiability.Attributes.Add("onClick", url);

                url = "popitup('/_layouts/Zurich/IncomeExpensePopUp.aspx',900,1200);return false;";
                mvalueLink.Attributes.Add("onClick", url);

                if (caseid != null)
                {
                    ViewState["caseid"] = caseid;
                    caseidrg.Value = caseid;

                    retirementGoalSelf = retirementGoalsDao.getRetirementGoal(caseid, "self");

                    if (retirementGoalSelf == null)
                    {
                        retirementGoalSelf = new retirementgoal();
                    }

                    populateRetirementGoal(retirementGoalSelf, inflationAdjustedReturnAsmptn, annualInflationReturn, caseid);
                }
            }

            intendedRetirementAge.Attributes.Add("onblur", "calculateAmountNeededFutureValue('intendedra')");

            incomeRequiredUponRetirement.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            yearsToRetirement.Attributes.Add("onblur", "tempCalculate1()");

            annualInflationRate.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            futureIncomeNeeded.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            sourcesOfIncome.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            totalFirstYearIncomeNeeded.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            inflationAdjustedReturn.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            durationOfRetirement.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            lumpSumRequiredAtRetirement.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            existingAssets2.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            maturityValue2.Attributes.Add("onblur", "calculateAmountNeededFutureValue('')");

            futureIncomeNeeded.Attributes.Add("readonly", "readonly");

            totalFirstYearIncomeNeeded.Attributes.Add("readonly", "readonly");

            lumpSumRequiredAtRetirement.Attributes.Add("readonly", "readonly");

            totalShortfallSurplus2.Attributes.Add("readonly", "readonly");

            existingAssets2.Attributes.Add("readonly", "readonly");

            yearsToRetirement.Attributes.Add("readonly", "readonly");

            markStatusOnTab(caseid);
        }
예제 #6
0
        private void populateEducationGoal(educationgoal educationGoal, assumption assmptn, EntitySet<countrycostofeducation> cced, string caseid)
        {
            double shortfallSurplus = 0;

            inflationRate.Text = "0";

            maturityValue.Text = "0";
            futureValue.Text = "0";

            if(assmptn!=null && assmptn.percentage!=null)
            {
                inflationRate.Text = assmptn.percentage.ToString();
            }

            int idCountrySel = 0;
            idCountrySel = cced[0].id;

            if (countryList != null && countryList.SelectedValue != null && countryList.SelectedValue!="")
            {
                string countrySel = countryList.SelectedValue;
                idCountrySel = Int16.Parse(countrySel);
            }

            countryList.DataSource = cced;
            countryList.DataValueField = "id";
            countryList.DataTextField = "country";
            countryList.DataBind();
            countryList.SelectedValue = idCountrySel.ToString();

            costEducation.Text = "0";

            futureValue.Text = "0";

            yrsToSave.Text = "0";
            ageWhenFundsNeeded.Text = "0";
            currentAge.Text = "0";
            nameofChild.Text = "";
            existingAssetsEducationGoals.Text = "0";

            totalShortfallSurplus.Text = "0";

            educationGoalNeeded2.Selected = true;

            if (educationGoal != null)
            {
                educationGoalNeeded.SelectedValue = educationGoal.educationGoalNeeded.ToString();

                nameofChild.Text = educationGoal.nameofchild;

                if (educationGoal.currentage != null && educationGoal.currentage != "")
                {
                    currentAge.Text = educationGoal.currentage;
                }

                if (educationGoal.agefundsneeded != null && educationGoal.agefundsneeded != "")
                {
                    ageWhenFundsNeeded.Text = educationGoal.agefundsneeded;
                }

                if (educationGoal.noofyrstosave != null && educationGoal.noofyrstosave != "")
                {
                    yrsToSave.Text = educationGoal.noofyrstosave;
                }

                if (educationGoal.presentcost == null || educationGoal.presentcost == "")
                {
                    foreach (countrycostofeducation cc in cced)
                    {
                        if (cc.id == idCountrySel)
                        {
                            if (cc.costofeducation != null && cc.costofeducation != "")
                            {
                                costEducation.Text = cc.costofeducation;
                            }
                            else
                            {
                                costEducation.Text = "0";
                            }
                            break;
                        }
                    }
                }
                else
                {
                    costEducation.Text = educationGoal.presentcost;
                }

                futureValue.Text = costEducation.Text;

                if (educationGoal.countryofstudyid != null)
                {
                    countryList.SelectedValue = educationGoal.countryofstudyid.ToString();
                }

                futureValue.Text = educationGoal.futurecost;

                if (educationGoal.maturityvalue != null && educationGoal.maturityvalue != "")
                {
                    maturityValue.Text = educationGoal.maturityvalue;
                }

                assetList.DataSource = educationGoal.existingassetegs;
                assetList.DataBind();

                if (educationGoal.inflationrate != null && educationGoal.inflationrate != "")
                {
                    inflationRate.Text = educationGoal.inflationrate;
                }

                if (educationGoal.existingassetegs != null)
                {
                    ViewState["noofassets"] = educationGoal.existingassetegs.Count;

                    if (educationGoal.existingassetegs != null && educationGoal.existingassetegs.Count > 0)
                    {
                        existingAssetsEducationGoals.Text = educationGoal.existingassetstotal;
                    }
                    else
                    {
                        existingAssetsEducationGoals.Text = "0";
                    }

                }

            }

            string ExistingValuesplbl = (double.Parse(existingAssetsEducationGoals.Text) + double.Parse(maturityValue.Text)).ToString();

            if (futureValue.Text == "")
            {
                futureValue.Text = "0";
            }

            shortfallSurplus = double.Parse(ExistingValuesplbl) - double.Parse(futureValue.Text);

            totalShortfallSurplus.Text = Math.Abs(shortfallSurplus).ToString();

            if (shortfallSurplus < 0)
            {
                ttlSS.Text = "Shortfall";
                ttlSS.Style.Add("color", "red");
            }
            else if (shortfallSurplus > 0)
            {
                ttlSS.Text = "Surplus";
                ttlSS.Style.Add("color", "black");
            }
            else
            {
                ttlSS.Text = "Shortfall / Surplus";
                ttlSS.Style.Add("color", "black");
            }

            activityId.Value = caseid;
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            assmptn = assumptionDao.getAssumptionById(3);

            cced = educationGoalsDao.getCountryCostOfEducation();

            activity = activityStatusDao.getActivity(8);
            ViewState["activity"] = activity;

            lblEducationGoalDelFailed.Visible = false;
            lblEducationGoalDelSuccess.Visible = false;
            lblEducationGoalFailed.Visible = false;
            lblEducationGoalSuccess.Visible = false;
            lblStatusSubmissionFailed.Visible = false;
            lblStatusSubmitted.Visible = false;

            int egid = 0;
            if (educationgoalid.Value != null && educationgoalid.Value != "")
            {
                egid = Int32.Parse(educationgoalid.Value);
            }

            ViewState["egid"] = egid;

            if (egid != 0)
            {
                ViewState["casetype"] = "update";

                if ((saveclicked.Value == "0" || saveclicked.Value == "") && (addclicked.Value == "0" || addclicked.Value == "") && (delclicked.Value == "0" || delclicked.Value == "") && (selectedcountrychanged.Value == "0" || selectedcountrychanged.Value == ""))
                {
                    if (ViewState["caseid"] != null)
                    {
                        educationGoal = educationGoalsDao.getEducationGoal(ViewState["caseid"].ToString());
                    }

                    educationgoal displaysg = null;
                    if (educationGoal != null && educationGoal.Count > 0)
                    {
                        displaysg = educationGoal[0];
                        foreach (educationgoal s in educationGoal)
                        {
                            if (egid == s.id)
                            {
                                displaysg = s;
                            }
                        }
                    }
                    populateEducationGoal(displaysg, assmptn, cced, ViewState["caseid"].ToString());
                    saveclicked.Value = "1";
                }
                if (delclicked.Value == "1")
                {
                    deleteEducationGoal(egid);
                }
                saveclicked.Value = "1";
            }
            else
            {
                ViewState["casetype"] = "new";
            }

            string cid = "";
            if (Session["fnacaseid"] != null)
            {
                cid = Session["fnacaseid"].ToString();
            }
            else if (ViewState["caseid"] != null)
            {
                cid = ViewState["caseid"].ToString();
            }

            if (cid != null && cid != "" && (saveclicked.Value == "0" || saveclicked.Value == "") && (addclicked.Value == "0" || addclicked.Value == "") && (delclicked.Value == "0" || delclicked.Value == "") && (selectedcountrychanged.Value == "0" || selectedcountrychanged.Value == ""))
            {
                educationGoal = educationGoalsDao.getEducationGoal(cid);

                educationgoal displaysg = null;
                if (educationGoal != null && educationGoal.Count > 0)
                {
                    displaysg = educationGoal[0];
                    if (displaysg.existingassetegs != null)
                    {
                        ViewState["noofassets"] = displaysg.existingassetegs.Count;
                        noofmembers.Value = displaysg.existingassetegs.Count.ToString();
                    }
                }
                saveclicked.Value = "1";
            }

            if (addclicked.Value == "1")
            {
                refreshEducationGoal(assmptn, cced);
                //addclicked.Value = "0";
                saveclicked.Value = "1";
                ViewState["addclicked"] = addclicked.Value;
            }

            if (!IsPostBack)
            {

                /*string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseid = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseid = menuCaseId;
                }*/

                if (Session["fnacaseid"] != null)
                {
                    caseid = Session["fnacaseid"].ToString();
                }

                ViewState["caseid"] = caseid;

                string url = "popitup('/_layouts/Zurich/AssetAndLiabilityPopUp.aspx',900,1200);return false;";
                eaAssetLiability.Attributes.Add("onClick", url);

                url = "popitup('/_layouts/Zurich/IncomeExpensePopUp.aspx',900,1200);return false;";
                mvalueLink.Attributes.Add("onClick", url);

                if (caseid != null)
                {
                    caseidsg.Value = caseid;

                    educationGoal = educationGoalsDao.getEducationGoal(caseid);
                    if (educationGoal != null && educationGoal.Count>0 && egid!=0)
                    {
                        ViewState["casetype"] = "update";
                    }
                    else
                    {
                        ViewState["casetype"] = "new";
                    }

                    educationgoal displaysg = null;
                    if (educationGoal != null && educationGoal.Count > 0)
                    {
                        displaysg = educationGoal[0];
                        educationgoalid.Value = displaysg.id.ToString();
                    }

                    populateEducationGoal(displaysg, assmptn, cced, caseid);

                    List<educationgoal> gridgoal = educationGoal;
                    foreach (educationgoal s in gridgoal)
                    {
                        double damtfv = 0;
                        double dmaturityval = 0;
                        double deattl = 0;

                        if (s.futurecost != null && s.futurecost != "")
                        {
                            damtfv = double.Parse(s.futurecost);
                        }
                        if (s.maturityvalue != null && s.maturityvalue != "")
                        {
                            dmaturityval = double.Parse(s.maturityvalue);
                        }
                        if (s.existingassetstotal != null && s.existingassetstotal != "")
                        {
                            deattl = double.Parse(s.existingassetstotal);
                        }

                        if (((dmaturityval + deattl) - damtfv) < 0)
                        {
                            s.total = "-" + s.total;
                        }
                    }

                    existingeggrid.DataSource = gridgoal;
                    existingeggrid.DataBind();
                }
            }

            currentAge.Attributes.Add("onblur", "tempCalculate();");
            ageWhenFundsNeeded.Attributes.Add("onblur", "tempCalculate();");
            yrsToSave.Attributes.Add("readonly", "readonly");

            costEducation.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");
            inflationRate.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");

            futureValue.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");
            futureValue.Attributes.Add("readonly", "readonly");

            maturityValue.Attributes.Add("onblur", "calculateAmountNeededFutureValue();");

            existingAssetsEducationGoals.Attributes.Add("readonly", "readonly");
            totalShortfallSurplus.Attributes.Add("readonly", "readonly");

            countryList.Attributes.Add("onchange", "selectedCountryChanged();");

            markStatusOnTab(caseid);
        }
예제 #8
0
 partial void Deleteassumption(assumption instance);
예제 #9
0
 partial void Updateassumption(assumption instance);
예제 #10
0
 partial void Insertassumption(assumption instance);