protected void submitSavingGoals(object sender, EventArgs e) { savinggoal goals = new savinggoal(); goals.savingGoalNeeded = Convert.ToInt16(savingGoalNeeded.SelectedValue); if (goals.savingGoalNeeded == 2) { goals.goal = goal.Text; goals.yrstoaccumulate = yrstoAccumulate.Text; goals.amtneededfv = futureValue.Text; goals.maturityvalue = maturityValue.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 = existingAssets.Text; } else if (goals.savingGoalNeeded == 1 || goals.savingGoalNeeded == 0) { goals.goal = ""; goals.yrstoaccumulate = "0"; goals.amtneededfv = "0"; goals.maturityvalue = "0"; goals.total = "0"; goals.existingassetstotal = "0"; } goals.deleted = false; string caseid = ""; if (ViewState["caseid"] != null) { caseid = ViewState["caseid"].ToString(); goals.caseid = caseid; } int noofea = 0; if (goals.savingGoalNeeded == 2) { if (noofmembers.Value != "") { noofea = Int16.Parse(noofmembers.Value); } } EntitySet<existingassetsg> easgList = new EntitySet<existingassetsg>(); if (noofea > 0) { for (int i = 1; i <= noofea; i++) { existingassetsg easg = new existingassetsg(); 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)) { easgList.Add(easg); } } goals.existingassetsgs = easgList; } int sgid = 0; if (ViewState["sgid"] != null) { sgid = Int32.Parse(ViewState["sgid"].ToString()); } if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "new") { goals = savingGoalsDao.saveSavingGoals(goals); } else if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "update") { goals = savingGoalsDao.updateSavingGoals(goals, sgid); } string actv = ""; if (ViewState["activity"] != null) { actv = ViewState["activity"].ToString(); } string status = activityStatusCheck.getSavingGoalStatus(caseid); activityStatusDao.saveOrUpdateActivityStatus(caseid, actv, status); markStatusOnTab(caseid); string caseStatus = activityStatusCheck.getZPlanStatus(caseid); string url = Server.MapPath("~/_layouts/Zurich/Printpages/"); pdfData = activityStatusCheck.sendDataToSalesPortal(caseid, caseStatus, url, sendPdf); /*if (st == 1) { lblStatusSubmitted.Visible = false; } else { lblStatusSubmissionFailed.Visible = true; }*/ if (goals != null) { lblSavingGoalSuccess.Visible = true; savingGoal = savingGoalsDao.getSavingGoal(caseid); savinggoal displaysg = null; if (savingGoal != null && savingGoal.Count > 0) { if (addandsave.Value == "1") { displaysg = savingGoal[savingGoal.Count-1]; } else { bool found = false; int count = 0; foreach (savinggoal sgl in savingGoal) { if (sgid == sgl.id) { found = true; break; } count++; } if (found) { displaysg = savingGoal[count]; } else { displaysg = savingGoal[0]; } } savinggoalid.Value = displaysg.id.ToString(); addandsave.Value = ""; } 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 = savingGoal; existingsggrid.DataSource = gridgoal; existingsggrid.DataBind(); //refreshSavingGoal(); } else { lblSavingGoalFailed.Visible = true; } }
private void detach_existingassetsgs(existingassetsg entity) { this.SendPropertyChanging(); entity.savinggoal = null; }
partial void Updateexistingassetsg(existingassetsg instance);
partial void Deleteexistingassetsg(existingassetsg instance);
partial void Insertexistingassetsg(existingassetsg instance);