protected void submitEducationGoals(object sender, EventArgs e)
        {
            educationgoal goals = new educationgoal();

            goals.educationGoalNeeded = Convert.ToInt16(educationGoalNeeded.SelectedValue);

            if (goals.educationGoalNeeded == 2)
            {
                goals.agefundsneeded = ageWhenFundsNeeded.Text;
                goals.currentage = currentAge.Text;
                goals.maturityvalue = maturityValue.Text;
                goals.nameofchild = nameofChild.Text;
                goals.noofyrstosave = yrsToSave.Text;

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

                goals.existingassetstotal = existingAssetsEducationGoals.Text;
                goals.futurecost = futureValue.Text;
                goals.presentcost = costEducation.Text;
                goals.inflationrate = inflationRate.Text;
            }
            else if (goals.educationGoalNeeded == 1 || goals.educationGoalNeeded == 0)
            {
                goals.agefundsneeded = "0";
                goals.currentage = "0";
                goals.maturityvalue = "0";
                goals.nameofchild = "";
                goals.noofyrstosave = "0";
                goals.total = "0";
                goals.existingassetstotal = "0";
                goals.futurecost = "0";
                goals.presentcost = "0";
                goals.inflationrate = "0";
            }

            goals.deleted = false;

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

            goals.countryofstudyid = Int16.Parse(countryList.SelectedValue);

            int noofea = 0;
            if (goals.educationGoalNeeded == 2)
            {
                if (noofmembers.Value != "")
                {
                    noofea = Int16.Parse(noofmembers.Value);
                }
            }

            EntitySet<existingasseteg> easgList = new EntitySet<existingasseteg>();
            if (noofea > 0)
            {
                for (int i = 1; i <= noofea; i++)
                {
                    existingasseteg easg = new existingasseteg();
                    easg.asset = Request.Form["pri-" + i];
                    easg.presentvalue = Request.Form["pri_" + i];
                    easg.percentpa = Request.Form["sec_" + i];

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

                }
                goals.existingassetegs = easgList;
            }

            int egid = 0;
            if (ViewState["egid"] != null)
            {
                egid = Int32.Parse(ViewState["egid"].ToString());
            }

            if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "new")
            {
                goals = educationGoalsDao.saveEducationGoals(goals);
            }
            else if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "update")
            {
                goals = educationGoalsDao.updateEducationGoals(goals, egid);
            }

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

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

            markStatusOnTab(caseid);

            string caseStatus = activityStatusCheck.getZPlanStatus(caseid);

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

            if (goals != null)
            {
                lblEducationGoalSuccess.Visible = true;

                educationGoal = educationGoalsDao.getEducationGoal(caseid);

                educationgoal displaysg = null;
                if (educationGoal != null && educationGoal.Count > 0)
                {
                    if (addandsave.Value == "1")
                    {
                        displaysg = educationGoal[educationGoal.Count-1];
                    }
                    else
                    {
                        bool found = false;
                        int count = 0;
                        foreach (educationgoal sgl in educationGoal)
                        {
                            if (egid == sgl.id)
                            {
                                found = true;
                                break;
                            }
                            count++;
                        }

                        if (found)
                        {
                            displaysg = educationGoal[count];
                        }
                        else
                        {
                            displaysg = educationGoal[0];
                        }
                    }

                    educationgoalid.Value = displaysg.id.ToString();
                    addandsave.Value = "";
                }
                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 = educationGoal;
                existingeggrid.DataSource = gridgoal;
                existingeggrid.DataBind();

                //refreshEducationGoal(assmptn, cced);
            }
            else
            {
                lblEducationGoalFailed.Visible = true;
            }
            string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
            pdfData = activityStatusCheck.sendDataToSalesPortal(caseid, caseStatus, url, sendPdf);
        }
Example #2
0
		private void detach_existingassetegs(existingasseteg entity)
		{
			this.SendPropertyChanging();
			entity.educationgoal = null;
		}
Example #3
0
 partial void Updateexistingasseteg(existingasseteg instance);
Example #4
0
 partial void Deleteexistingasseteg(existingasseteg instance);
Example #5
0
 partial void Insertexistingasseteg(existingasseteg instance);