protected void submitRetirementGoals(object sender, EventArgs e)
        {
            //File.AppendAllText(@"C:\ZurichLogs\logs.txt", "\n inside submitSavingGoals code behind");

            retirementgoal goalsSelf = new retirementgoal();

            string caseid = "";
            if (ViewState["caseid"] != null)
            {
                caseid = ViewState["caseid"].ToString();
                goalsSelf.caseid = caseid;
            }

            string actv = "";
            if (ViewState["activity"] != null)
            {
                actv = ViewState["activity"].ToString();
            }

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

            if (retirementGoalSelf != null)
            {
                caseType = "update";
            }
            else
            {
                caseType = "new";
            }

            goalsSelf.retirementGoalNeeded = Convert.ToInt32(retirementGoalNeeded.SelectedValue);

            if (goalsSelf.retirementGoalNeeded == 2)
            {
                goalsSelf.durationretirement = durationOfRetirement.Text;
                goalsSelf.futureincome = futureIncomeNeeded.Text;
                goalsSelf.incomerequired = incomeRequiredUponRetirement.Text;
                goalsSelf.intendedretirementage = intendedRetirementAge.Text;
                goalsSelf.lumpsumrequired = lumpSumRequiredAtRetirement.Text;
                goalsSelf.maturityvalue = maturityValue2.Text;
                goalsSelf.selforspouse = "self";
                goalsSelf.sourcesofincome = sourcesOfIncome.Text;

                if (totalShortfallSurplus2.Text != null && totalShortfallSurplus2.Text != "")
                {
                    double ttl = double.Parse(totalShortfallSurplus2.Text);
                    if (ttl < 0)
                    {
                        totalShortfallSurplus2.Text = Math.Abs(ttl).ToString();
                    }
                }
                goalsSelf.total = totalShortfallSurplus2.Text;

                goalsSelf.totalfirstyrincome = totalFirstYearIncomeNeeded.Text;
                goalsSelf.yrstoretirement = yearsToRetirement.Text;
                goalsSelf.existingassetstotal = existingAssets2.Text;
                goalsSelf.inflationrate = annualInflationRate.Text;
                goalsSelf.inflationreturnrate = inflationAdjustedReturn.Text;
            }
            else if (goalsSelf.retirementGoalNeeded == 1 || goalsSelf.retirementGoalNeeded == 0)
            {
                goalsSelf.durationretirement = "0";
                goalsSelf.futureincome = "0";
                goalsSelf.incomerequired = "0";
                goalsSelf.intendedretirementage = "0";
                goalsSelf.lumpsumrequired = "0";
                goalsSelf.maturityvalue = "0";
                goalsSelf.selforspouse = "self";
                goalsSelf.sourcesofincome = "0";
                goalsSelf.total = "0";
                goalsSelf.totalfirstyrincome = "0";
                goalsSelf.yrstoretirement = "0";
                goalsSelf.existingassetstotal = "0";
                goalsSelf.inflationrate = "0";
                goalsSelf.inflationreturnrate = "0";
            }

            int noofeaself = 0;
            if (goalsSelf.retirementGoalNeeded == 2)
            {
                if (noofmembers.Value != "")
                {
                    noofeaself = Int16.Parse(noofmembers.Value);
                }
            }

            EntitySet<existingassetrg> eargSelfList = new EntitySet<existingassetrg>();
            if (noofeaself > 0)
            {
                for (int i = 1; i <= noofeaself; i++)
                {
                    existingassetrg easg = new existingassetrg();
                    easg.asset = Request.Form["pridesc-" + i];
                    easg.presentvalue = Request.Form["pri_" + i];
                    easg.percentpa = Request.Form["sec_" + i];

                    if ((Request.Form["pridesc-" + i] != null) && (Request.Form["pri_" + i] != null) && (Request.Form["sec_" + i] != null))
                    {
                        eargSelfList.Add(easg);
                    }

                }
                goalsSelf.existingassetrgs = eargSelfList;
            }

            if (caseType == "new")
            {
                goalsSelf = retirementGoalsDao.saveRetirementGoals(goalsSelf);
            }
            else if (caseType == "update")
            {
                goalsSelf = retirementGoalsDao.updateRetirementGoals(goalsSelf);
            }

            string status = activityStatusCheck.getRetirementGoalStatus(goalsSelf);
            activityStatusDao.saveOrUpdateActivityStatus(caseid, actv, status);

            string caseStatus = activityStatusCheck.getZPlanStatus(caseid);

            string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
            pdfData = activityStatusCheck.sendDataToSalesPortal(caseid, caseStatus, url, sendPdf);

            markStatusOnTab(caseid);

            /*if (st == 1)
            {
                lblStatusSubmitted.Visible = false;
            }
            else
            {
                lblStatusSubmissionFailed.Visible = true;
            }*/

            if (goalsSelf != null)
            {
                lblRetirementGoalSuccess.Visible = true;
                populateRetirementGoal(goalsSelf, inflationAdjustedReturnAsmptn, annualInflationReturn, caseid);
            }
            else
            {
                lblRetirementGoalFailed.Visible = true;
            }
        }
Exemple #2
0
		private void detach_existingassetrgs(existingassetrg entity)
		{
			this.SendPropertyChanging();
			entity.retirementgoal = null;
		}
Exemple #3
0
 partial void Updateexistingassetrg(existingassetrg instance);
Exemple #4
0
 partial void Deleteexistingassetrg(existingassetrg instance);
Exemple #5
0
 partial void Insertexistingassetrg(existingassetrg instance);