public void updatePriorityDetails(priorityDetail priorityDetails) { try { dbDataContext ct = new dbDataContext(); priorityDetail detail = null; //retrieve existing saving goal var queryPriorityDetails = from al in ct.priorityDetails where al.caseid == priorityDetails.caseid select al; foreach (priorityDetail priorityDetailObject in queryPriorityDetails) { detail = priorityDetailObject; } detail.protection1 = priorityDetails.protection1; detail.protection2 = priorityDetails.protection2; detail.protection3 = priorityDetails.protection3; detail.protection4 = priorityDetails.protection4; detail.protection5 = priorityDetails.protection5; detail.savings1 = priorityDetails.savings1; detail.savings2 = priorityDetails.savings2; detail.savings3 = priorityDetails.savings3; ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } }
public List<myzurichadviser> saveMza(List<myzurichadviser> mzaoptions) { int status = 1; try { dbDataContext ct = new dbDataContext(); if (mzaoptions != null && mzaoptions.Count > 0) { ct.myzurichadvisers.InsertAllOnSubmit(mzaoptions); ct.SubmitChanges(); } } catch (Exception e) { status = 0; string str = e.Message; } if (status == 0) { mzaoptions = null; } return mzaoptions; }
public assetAndLiability getAssetLiabilityForCase(string caseNumber) { assetAndLiability result = null; try { dbDataContext dbDataContext = new dbDataContext(); IQueryable<assetAndLiability> queryable = from a in dbDataContext.GetTable<assetAndLiability>() where a.caseId.Equals(caseNumber) select a; using (IEnumerator<assetAndLiability> enumerator = queryable.GetEnumerator()) { if (enumerator.MoveNext()) { assetAndLiability current = enumerator.Current; result = current; } } } catch (Exception ex) { string message = ex.Message; } return result; }
public int deleteEducationGoal(int egid) { int status = 1; educationgoal retrievedGoal = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing education goal var queryEducationGoals = from sg in ct.educationgoals where sg.id == egid select sg; foreach (educationgoal sgoals in queryEducationGoals) { retrievedGoal = sgoals; } //update education goal attributes retrievedGoal.deleted = true; ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; status = 0; } return status; }
public CkaAssessment getCkaProfile(string caseId) { CkaAssessment result = null; try { dbDataContext dbDataContext = new dbDataContext(); IQueryable<CkaAssessment> queryable = from a in dbDataContext.GetTable<CkaAssessment>() where a.caseId.Equals(caseId) select a; using (IEnumerator<CkaAssessment> enumerator = queryable.GetEnumerator()) { if (enumerator.MoveNext()) { CkaAssessment current = enumerator.Current; result = current; } } } catch (Exception ex) { string message = ex.Message; } return result; }
public incomeExpense getIncomeExpenseForCase(string caseNumber) { incomeExpense result = null; try { dbDataContext dbDataContext = new dbDataContext(); IQueryable<incomeExpense> queryable = from a in dbDataContext.GetTable<incomeExpense>() where a.caseId.Equals(caseNumber) select a; using (IEnumerator<incomeExpense> enumerator = queryable.GetEnumerator()) { if (enumerator.MoveNext()) { incomeExpense current = enumerator.Current; result = current; } } } catch (Exception ex) { string message = ex.Message; } return result; }
public void saveNewCkaProfile(CkaAssessment ckaAssessment) { try { dbDataContext ct = new dbDataContext(); ct.CkaAssessments.InsertOnSubmit(ckaAssessment); ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } }
public void savePriorityDetails(priorityDetail priorityDetails) { try { dbDataContext ct = new dbDataContext(); ct.priorityDetails.InsertOnSubmit(priorityDetails); ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } }
public personaldetail getPersonalDetail(string caseId) { dbDataContext ct = new dbDataContext(); personaldetail detail = null; //retrieve existing saving goal var queryPersonalDetails = from al in ct.personaldetails where al.caseid == caseId select al; foreach (personaldetail personalDetailObject in queryPersonalDetails) { detail = personalDetailObject; } return detail; }
public incomeExpense insertNewIncomeExpenseDetails(incomeExpense incomeExpenseDetail) { try { dbDataContext ct = new dbDataContext(); ct.incomeExpenses.InsertOnSubmit(incomeExpenseDetail); ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return incomeExpenseDetail; }
public Boolean insertNewAssetLiabilityDetails(assetAndLiability assetAndLiability) { Boolean status = true; try { dbDataContext ct = new dbDataContext(); ct.assetAndLiabilities.InsertOnSubmit(assetAndLiability); ct.SubmitChanges(); } catch (Exception e) { status = false; string str = e.Message; } return status; }
public int savePersonalDetails(personaldetail personalDetails) { int noOfRows = 0; try { dbDataContext ct = new dbDataContext(); ct.personaldetails.InsertOnSubmit(personalDetails); ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return noOfRows; }
public priorityDetail getPriorityDetails(string caseId) { priorityDetail detail = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing saving goal var queryPriorityDetails = from al in ct.priorityDetails where al.caseid == caseId select al; foreach (priorityDetail priorityDetailObject in queryPriorityDetails) { detail = priorityDetailObject; } } catch (Exception e) { throw e; } return detail; }
public void updateCkaDetails(CkaAssessment ckaAssessment) { CkaAssessment assessment = null; try { dbDataContext ct = new dbDataContext(); var queryCkaDetails = from al in ct.CkaAssessments where al.caseId == ckaAssessment.caseId select al; foreach (CkaAssessment ckAssessment in queryCkaDetails) { assessment = ckAssessment; } assessment.agreeCKA = ckaAssessment.agreeCKA; assessment.csaOutcomeOption1 = ckaAssessment.csaOutcomeOption1; assessment.csaOutcomeOption2 = ckaAssessment.csaOutcomeOption2; assessment.disagreeCKA = ckaAssessment.disagreeCKA; assessment.educationalExperienceOption1 = ckaAssessment.educationalExperienceOption1; assessment.educationalExperienceOption2 = ckaAssessment.educationalExperienceOption2; assessment.financeRelatedKnowledgeOption1 = ckaAssessment.financeRelatedKnowledgeOption1; assessment.financeRelatedKnowledgeOption2 = ckaAssessment.financeRelatedKnowledgeOption2; assessment.investmentExperienceOption1 = ckaAssessment.investmentExperienceOption1; assessment.investmentExperienceOption2 = ckaAssessment.investmentExperienceOption2; assessment.workingExperienceOption1 = ckaAssessment.workingExperienceOption1; assessment.workingExperienceOption2 = ckaAssessment.workingExperienceOption2; assessment.educationalExperienceList = ckaAssessment.educationalExperienceList; assessment.investmentExperienceList = ckaAssessment.investmentExperienceList; assessment.workingExperienceList = ckaAssessment.workingExperienceList; ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } }
public string getActivity(int activityId) { string activity = ""; try { dbDataContext ct = new dbDataContext(); var queryActivity = from act in ct.activities where act.id == activityId select act; foreach (activity a in queryActivity) { activity = a.activity1; } } catch (Exception e) { string str = e.Message; } return activity; }
public retirementgoal saveRetirementGoals(retirementgoal goals) { int status = 1; try { dbDataContext ct = new dbDataContext(); ct.retirementgoals.InsertOnSubmit(goals); ct.SubmitChanges(); } catch (Exception e) { status = 0; string str = e.Message; } if (status == 0) { goals = null; } return goals; }
public retirementgoal getRetirementGoal(string caseid, string selforspouse) { retirementgoal goal = null; try { dbDataContext ct = new dbDataContext(); var queryRetirementGoals = from sg in ct.retirementgoals where sg.caseid == caseid && sg.selforspouse == selforspouse select sg; foreach (retirementgoal sgoals in queryRetirementGoals) { goal = sgoals; } } catch (Exception e) { string str = e.Message; } return goal; }
public List<educationgoal> getEducationGoal(string caseid) { List<educationgoal> goal = new List<educationgoal>(); try { dbDataContext ct = new dbDataContext(); var queryEducationGoals = from sg in ct.educationgoals where sg.caseid == caseid && sg.deleted == false select sg; foreach (educationgoal sgoals in queryEducationGoals) { goal.Add(sgoals); } } catch (Exception e) { string str = e.Message; } return goal; }
public EntitySet<countrycostofeducation> getCountryCostOfEducation() { EntitySet<countrycostofeducation> cced = new EntitySet<countrycostofeducation>(); try { dbDataContext ct = new dbDataContext(); var queryCountry = from sg in ct.countrycostofeducations select sg; foreach (countrycostofeducation cc in queryCountry) { cced.Add(cc); } } catch (Exception e) { string str = e.Message; } return cced; }
public List<myzurichadviser> getMza(string caseid) { List<myzurichadviser> mzaOptions = new List<myzurichadviser>(); try { dbDataContext ct = new dbDataContext(); var queryMza = from mza in ct.myzurichadvisers where mza.caseid == caseid select mza; foreach (myzurichadviser m in queryMza) { mzaOptions.Add(m); } } catch (Exception e) { string str = e.Message; } return mzaOptions; }
public myNeed saveMyNeeds(myNeed myNeeds) { int status = 1; try { dbDataContext ct = new dbDataContext(); ct.myNeeds.InsertOnSubmit(myNeeds); ct.SubmitChanges(); } catch (Exception ex) { logException(ex); throw ex; } if (status == 0) { myNeeds = null; } return myNeeds; }
public activitystatus getActivityForCaseid(string caseid, string activity) { activitystatus activityStatus = null; try { dbDataContext ct = new dbDataContext(); var queryActivity = from act in ct.activitystatus where act.caseid == caseid && act.activity == activity select act; foreach (activitystatus a in queryActivity) { activityStatus = a; } } catch (Exception e) { string str = e.Message; } return activityStatus; }
public List<myzurichadviser> updateMza(List<myzurichadviser> mzaoptions, string caseid) { int status = 1; try { dbDataContext ct = new dbDataContext(); //delete existing my zurich adviser var queryExistingMza = from emza in ct.myzurichadvisers where emza.caseid == caseid select emza; foreach (myzurichadviser mza in queryExistingMza) { ct.myzurichadvisers.DeleteOnSubmit(mza); } if (mzaoptions != null && mzaoptions.Count > 0) { ct.myzurichadvisers.InsertAllOnSubmit(mzaoptions); } ct.SubmitChanges(); } catch (Exception e) { status = 0; string str = e.Message; } if (status == 0) { mzaoptions = null; } return mzaoptions; }
public myNeed getMyNeed(string caseid) { myNeed myNeed = null; try { dbDataContext ct = new dbDataContext(); var queryMyNeeds = from sg in ct.myNeeds where sg.caseId == caseid select sg; foreach (myNeed need in queryMyNeeds) { myNeed = need; } } catch (Exception ex) { logException(ex); throw ex; } return myNeed; }
public retirementgoal updateRetirementGoals(retirementgoal goals) { retirementgoal retrievedGoal = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing retirement goal var queryRetirementGoals = from sg in ct.retirementgoals where sg.caseid == goals.caseid && sg.selforspouse == goals.selforspouse select sg; foreach (retirementgoal sgoals in queryRetirementGoals) { retrievedGoal = sgoals; } //update retirement goal attributes retrievedGoal.durationretirement = goals.durationretirement; retrievedGoal.futureincome = goals.futureincome; retrievedGoal.incomerequired = goals.incomerequired; retrievedGoal.intendedretirementage = goals.intendedretirementage; retrievedGoal.lumpsumrequired = goals.lumpsumrequired; retrievedGoal.maturityvalue = goals.maturityvalue; retrievedGoal.sourcesofincome = goals.sourcesofincome; retrievedGoal.total = goals.total; retrievedGoal.totalfirstyrincome = goals.totalfirstyrincome; retrievedGoal.yrstoretirement = goals.yrstoretirement; retrievedGoal.existingassetstotal = goals.existingassetstotal; retrievedGoal.inflationreturnrate = goals.inflationreturnrate; retrievedGoal.inflationrate = goals.inflationrate; retrievedGoal.retirementGoalNeeded = goals.retirementGoalNeeded; //delete existing assets for the retirement goal var queryExistingAssets = from easg in ct.existingassetrgs where easg.retirementgoalsid == retrievedGoal.id select easg; foreach (existingassetrg easgoals in queryExistingAssets) { ct.existingassetrgs.DeleteOnSubmit(easgoals); //ct.SubmitChanges(); } //update existing assets list for the retirement goal if (goals.existingassetrgs != null && goals.existingassetrgs.Count > 0) { EntitySet<existingassetrg> easgList = new EntitySet<existingassetrg>(); foreach (existingassetrg sgea in goals.existingassetrgs) { easgList.Add(sgea); } retrievedGoal.existingassetrgs = easgList; } ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return retrievedGoal; }
public educationgoal updateEducationGoals(educationgoal goals, int egid) { educationgoal retrievedGoal = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing education goal var queryEducationGoals = from sg in ct.educationgoals where sg.caseid == goals.caseid && sg.id == egid select sg; foreach (educationgoal sgoals in queryEducationGoals) { retrievedGoal = sgoals; } //update education goal attributes retrievedGoal.agefundsneeded = goals.agefundsneeded; retrievedGoal.currentage = goals.currentage; retrievedGoal.maturityvalue = goals.maturityvalue; retrievedGoal.nameofchild = goals.nameofchild; retrievedGoal.noofyrstosave = goals.noofyrstosave; retrievedGoal.total = goals.total; retrievedGoal.existingassetstotal = goals.existingassetstotal; retrievedGoal.futurecost = goals.futurecost; retrievedGoal.presentcost = goals.presentcost; retrievedGoal.inflationrate = goals.inflationrate; retrievedGoal.educationGoalNeeded = goals.educationGoalNeeded; retrievedGoal.countryofstudyid = goals.countryofstudyid; //delete existing assets for the education goal var queryExistingAssets = from easg in ct.existingassetegs where easg.educationgoalsid == retrievedGoal.id select easg; foreach (existingasseteg easgoals in queryExistingAssets) { ct.existingassetegs.DeleteOnSubmit(easgoals); //ct.SubmitChanges(); } //update existing assets list for the education goal if (goals.existingassetegs != null && goals.existingassetegs.Count > 0) { EntitySet<existingasseteg> easgList = new EntitySet<existingasseteg>(); foreach (existingasseteg sgea in goals.existingassetegs) { easgList.Add(sgea); } retrievedGoal.existingassetegs = easgList; } if (retrievedGoal.educationGoalNeeded == 1 || retrievedGoal.educationGoalNeeded == 0) { var eduGoalRecords = from edug in ct.educationgoals where edug.caseid == goals.caseid select edug; int[] arrRecordIds = null; if (eduGoalRecords != null) { int size = eduGoalRecords.ToArray().Length; arrRecordIds = new int[size]; } int index = 0; foreach (educationgoal egl in eduGoalRecords) { arrRecordIds[index] = egl.id; index++; } var todelExistingAssets = from easg in ct.existingassetegs where arrRecordIds.Contains(easg.educationgoalsid) select easg; foreach (existingasseteg easgoals in todelExistingAssets) { ct.existingassetegs.DeleteOnSubmit(easgoals); } var toDelEducationGoals = from sg in ct.educationgoals where sg.caseid == goals.caseid && sg.id != egid select sg; foreach (educationgoal s in toDelEducationGoals) { ct.educationgoals.DeleteOnSubmit(s); } } ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return retrievedGoal; }
public savinggoal updateSavingGoals(savinggoal goals, int sgid) { savinggoal retrievedGoal = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing saving goal var querySavingGoals = from sg in ct.savinggoals where sg.caseid == goals.caseid && sg.id == sgid select sg; foreach (savinggoal sgoals in querySavingGoals) { retrievedGoal = sgoals; } //retrievedGoal = goals; //update saving goal attributes retrievedGoal.amtneededfv = goals.amtneededfv; retrievedGoal.goal = goals.goal; retrievedGoal.maturityvalue = goals.maturityvalue; retrievedGoal.regularannualcontrib = goals.regularannualcontrib; retrievedGoal.total = goals.total; retrievedGoal.yrstoaccumulate = goals.yrstoaccumulate; retrievedGoal.existingassetstotal = goals.existingassetstotal; retrievedGoal.savingGoalNeeded = goals.savingGoalNeeded; //delete existing assets for the saving goal var queryExistingAssets = from easg in ct.existingassetsgs where easg.savinggoalsid == retrievedGoal.id select easg; foreach (existingassetsg easgoals in queryExistingAssets) { ct.existingassetsgs.DeleteOnSubmit(easgoals); //ct.SubmitChanges(); } //update existing assets list for the saving goal if (goals.existingassetsgs != null && goals.existingassetsgs.Count > 0) { EntitySet<existingassetsg> easgList = new EntitySet<existingassetsg>(); foreach (existingassetsg sgea in goals.existingassetsgs) { easgList.Add(sgea); } retrievedGoal.existingassetsgs = easgList; } if (retrievedGoal.savingGoalNeeded == 1 || retrievedGoal.savingGoalNeeded == 0) { var sgGoalRecords = from sgids in ct.savinggoals where sgids.caseid == goals.caseid select sgids; int[] arrRecordIds = null; if (sgGoalRecords != null) { int size = sgGoalRecords.ToArray().Length; arrRecordIds = new int[size]; } int index = 0; foreach (savinggoal sgl in sgGoalRecords) { arrRecordIds[index] = sgl.id; index++; } var todelExistingAssets = from easg in ct.existingassetsgs where arrRecordIds.Contains(easg.savinggoalsid) select easg; foreach (existingassetsg easgoals in todelExistingAssets) { ct.existingassetsgs.DeleteOnSubmit(easgoals); } var toDeleteSgGoals = from sg in ct.savinggoals where sg.caseid == goals.caseid && sg.id != sgid select sg; foreach (savinggoal s in toDeleteSgGoals) { ct.savinggoals.DeleteOnSubmit(s); } } ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return retrievedGoal; }
public myNeed updateMyNeeds(myNeed needs) { myNeed retrievedNeed = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing my need var queryMyNeeds = from myneed in ct.myNeeds where myneed.caseId == needs.caseId select myneed; foreach (myNeed myNeeds in queryMyNeeds) { retrievedNeed = myNeeds; } //update my need attributes retrievedNeed.lumpSumRequiredForTreatment = needs.lumpSumRequiredForTreatment; retrievedNeed.totalRequired = needs.totalRequired; retrievedNeed.criticalIllnessInsurance = needs.criticalIllnessInsurance; retrievedNeed.existingAssetsMyneeds = needs.existingAssetsMyneeds; retrievedNeed.totalShortfallSurplusMyNeeds = needs.totalShortfallSurplusMyNeeds; retrievedNeed.lumpSumMyNeeds = needs.lumpSumMyNeeds; retrievedNeed.existingSumMyNeeds = needs.existingSumMyNeeds; retrievedNeed.shortfallSumMyNeeds = needs.shortfallSumMyNeeds; retrievedNeed.monthlyIncomeDisabilityIncome = needs.monthlyIncomeDisabilityIncome; retrievedNeed.percentOfIncomeCoverageRequired = needs.percentOfIncomeCoverageRequired; retrievedNeed.monthlyCoverageRequired = needs.monthlyCoverageRequired; retrievedNeed.disabilityInsuranceMyNeeds = needs.disabilityInsuranceMyNeeds; retrievedNeed.existingAssetsMyneedsDisability = needs.existingAssetsMyneedsDisability; retrievedNeed.shortfallSurplusMyNeeds = needs.shortfallSurplusMyNeeds; retrievedNeed.monthlyAmountMyNeeds = needs.monthlyAmountMyNeeds; retrievedNeed.existingMyNeeds = needs.existingMyNeeds; retrievedNeed.shortfallMyNeeds = needs.shortfallMyNeeds; retrievedNeed.typeOfHospitalCoverage = needs.typeOfHospitalCoverage; retrievedNeed.anyExistingPlans = needs.anyExistingPlans; retrievedNeed.typeOfRoomCoverage = needs.typeOfRoomCoverage; retrievedNeed.coverageOldageYesNo = needs.coverageOldageYesNo; retrievedNeed.epOldageYesNo = needs.epOldageYesNo; retrievedNeed.coverageIncomeYesNo = needs.coverageIncomeYesNo; retrievedNeed.epIncomeYesNo = needs.epIncomeYesNo; retrievedNeed.coverageOutpatientYesNo = needs.coverageOutpatientYesNo; retrievedNeed.epOutpatientYesNo = needs.epOutpatientYesNo; retrievedNeed.coverageDentalYesNo = needs.coverageDentalYesNo; retrievedNeed.epDentalYesNo = needs.epDentalYesNo; retrievedNeed.coveragePersonalYesNo = needs.coveragePersonalYesNo; retrievedNeed.epPersonalYesNo = needs.epPersonalYesNo; retrievedNeed.criticalIllnessPrNeeded = needs.criticalIllnessPrNeeded; retrievedNeed.disabilityPrNeeded = needs.disabilityPrNeeded; retrievedNeed.hospitalmedCoverNeeded = needs.hospitalmedCoverNeeded; retrievedNeed.accidentalhealthCoverNeeded = needs.accidentalhealthCoverNeeded; retrievedNeed.coverageOutpatientMedExp = needs.coverageOutpatientMedExp; retrievedNeed.epOutpatientMedExp = needs.epOutpatientMedExp; retrievedNeed.coverageLossOfIncome = needs.coverageLossOfIncome; retrievedNeed.epLossOfIncome = needs.epLossOfIncome; retrievedNeed.coverageOldageDisabilities = needs.coverageOldageDisabilities; retrievedNeed.epOldageDisabilities = needs.epOldageDisabilities; retrievedNeed.coverageDentalExp = needs.coverageDentalExp; retrievedNeed.epDentalExp = needs.epDentalExp; if ((needs.anyExistingPlans == true) || (needs.epOldageYesNo == true) || (needs.epPersonalYesNo == true) || (needs.epOutpatientMedExp == true) || (needs.epLossOfIncome == true) || (needs.epOldageDisabilities == true) || (needs.epDentalExp == true)) { retrievedNeed.existingPlansDetail = needs.existingPlansDetail; } else retrievedNeed.existingPlansDetail = ""; // retrievedNeed.existingPlansDetail = needs.existingPlansDetail; retrievedNeed.disabilityProtectionReplacementIncomeRequired = needs.disabilityProtectionReplacementIncomeRequired; retrievedNeed.disabilityProtectionReplacementIncomeRequiredPercentage =needs.disabilityProtectionReplacementIncomeRequiredPercentage; retrievedNeed.replacementIncomeRequired = needs.replacementIncomeRequired; retrievedNeed.yearsOfSupportRequired = needs.yearsOfSupportRequired; retrievedNeed.disabilityYearsOfSupport = needs.disabilityYearsOfSupport; retrievedNeed.inflatedAdjustedReturns = needs.inflatedAdjustedReturns; retrievedNeed.replacementAmountRequired = needs.replacementAmountRequired; retrievedNeed.disabilityReplacementAmountRequired = needs.disabilityReplacementAmountRequired; retrievedNeed.disabilityInsurance = needs.disabilityInsurance; retrievedNeed.inflationAdjustedReturns = needs.inflationAdjustedReturns; //delete existing assets for my needs critical illness var queryExistingCriticalAssets = from eamyneed in ct.myNeedsCriticalAssets where eamyneed.myNeedId == retrievedNeed.id select eamyneed; foreach (myNeedsCriticalAsset eamyneeds in queryExistingCriticalAssets) { ct.myNeedsCriticalAssets.DeleteOnSubmit(eamyneeds); //ct.SubmitChanges(); } //update existing assets list for my needs critical illness if (needs.myNeedsCriticalAssets != null && needs.myNeedsCriticalAssets.Count > 0) { EntitySet<myNeedsCriticalAsset> eaMNCriticalList = new EntitySet<myNeedsCriticalAsset>(); foreach (myNeedsCriticalAsset mnea in needs.myNeedsCriticalAssets) { eaMNCriticalList.Add(mnea); } retrievedNeed.myNeedsCriticalAssets = eaMNCriticalList; } //delete existing assets for my needs disability income var queryExistingDisablityAssets = from eamyneed in ct.myNeedsDisabilityAssets where eamyneed.myNeedId == retrievedNeed.id select eamyneed; foreach (myNeedsDisabilityAsset eamyneeds in queryExistingDisablityAssets) { ct.myNeedsDisabilityAssets.DeleteOnSubmit(eamyneeds); //ct.SubmitChanges(); } //update existing assets list for disability income if (needs.myNeedsDisabilityAssets != null && needs.myNeedsDisabilityAssets.Count > 0) { EntitySet<myNeedsDisabilityAsset> eaMNDisabilityList = new EntitySet<myNeedsDisabilityAsset>(); foreach (myNeedsDisabilityAsset mnea in needs.myNeedsDisabilityAssets) { eaMNDisabilityList.Add(mnea); } retrievedNeed.myNeedsDisabilityAssets = eaMNDisabilityList; } ct.SubmitChanges(); } catch (Exception ex) { logException(ex); throw ex; } return retrievedNeed; }
public incomeExpense updateIncomeExpenseDetails(incomeExpense incomeExpenseDetail) { incomeExpense incomeExpense = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing saving goal var queryIncomeExpenseDetails = from al in ct.incomeExpenses where al.caseId == incomeExpenseDetail.caseId select al; foreach (incomeExpense incomeExpenseDetails in queryIncomeExpenseDetails) { incomeExpense = incomeExpenseDetails; } incomeExpense.emergencyFundsNeeded = incomeExpenseDetail.emergencyFundsNeeded; incomeExpense.shortTermGoals = incomeExpenseDetail.shortTermGoals; incomeExpense.extraDetails = incomeExpenseDetail.extraDetails; incomeExpense.netMonthlyIncomeAfterCpf = incomeExpenseDetail.netMonthlyIncomeAfterCpf; incomeExpense.netMonthlyExpenses = incomeExpenseDetail.netMonthlyExpenses; incomeExpense.monthlySavings = incomeExpenseDetail.monthlySavings; incomeExpense.lifeInsuranceSA = incomeExpenseDetail.lifeInsuranceSA; incomeExpense.lifeInsuranceMV = incomeExpenseDetail.lifeInsuranceMV; incomeExpense.expiry1 = incomeExpenseDetail.expiry1; incomeExpense.lifeInsurancePremium = incomeExpenseDetail.lifeInsurancePremium; incomeExpense.lifeInsuranceRemarks = incomeExpenseDetail.lifeInsuranceRemarks; incomeExpense.tpdcSA = incomeExpenseDetail.tpdcSA; incomeExpense.tpdcMV = incomeExpenseDetail.tpdcMV; incomeExpense.expiry2 = incomeExpenseDetail.expiry2; incomeExpense.tpdcPremium = incomeExpenseDetail.tpdcPremium; incomeExpense.tpdcRemarks = incomeExpenseDetail.tpdcRemarks; incomeExpense.criticalIllnessSA = incomeExpenseDetail.criticalIllnessSA; incomeExpense.criticalIllnessMV = incomeExpenseDetail.criticalIllnessMV; incomeExpense.expiry3 = incomeExpenseDetail.expiry3; incomeExpense.criticalIllnessPremium = incomeExpenseDetail.criticalIllnessPremium; incomeExpense.criticalIllnessRemarks = incomeExpenseDetail.criticalIllnessRemarks; incomeExpense.disabilityIncomeSA = incomeExpenseDetail.disabilityIncomeSA; incomeExpense.disabilityIncomeMV = incomeExpenseDetail.disabilityIncomeMV; incomeExpense.expiry4 = incomeExpenseDetail.expiry4; incomeExpense.disabilityIncomePremium = incomeExpenseDetail.disabilityIncomePremium; incomeExpense.disabilityIncomeRemarks = incomeExpenseDetail.disabilityIncomeRemarks; incomeExpense.mortgageSA = incomeExpenseDetail.mortgageSA; incomeExpense.mortgageMV = incomeExpenseDetail.mortgageMV; incomeExpense.expiry5 = incomeExpenseDetail.expiry5; incomeExpense.mortgagePremium = incomeExpenseDetail.mortgagePremium; incomeExpense.mortgageRemarks = incomeExpenseDetail.mortgageRemarks; incomeExpense.others1A = incomeExpenseDetail.others1A; incomeExpense.others1V = incomeExpenseDetail.others1V; incomeExpense.expiry6 = incomeExpenseDetail.expiry6; incomeExpense.others1Premium = incomeExpenseDetail.others1Premium; incomeExpense.others1Remarks = incomeExpenseDetail.others1Remarks; incomeExpense.DeathTermInsurancePremium = incomeExpenseDetail.DeathTermInsurancePremium; incomeExpense.DeathTermInsuranceSA = incomeExpenseDetail.DeathTermInsuranceSA; incomeExpense.DeathTermInsuranceTerm = incomeExpenseDetail.DeathTermInsuranceTerm; incomeExpense.DeathWholeLifeInsurancePremium = incomeExpenseDetail.DeathWholeLifeInsurancePremium; incomeExpense.DeathWholeLifeInsuranceSA = incomeExpenseDetail.DeathWholeLifeInsuranceSA; incomeExpense.DeathWholeLifeInsuranceTerm = incomeExpenseDetail.DeathWholeLifeInsuranceTerm; incomeExpense.incomeExpenseNeeded = incomeExpenseDetail.incomeExpenseNeeded; incomeExpense.incomeExpenseNotNeededReason = incomeExpenseDetail.incomeExpenseNotNeededReason; incomeExpense.assecertainingAffordabilityEnable = incomeExpenseDetail.assecertainingAffordabilityEnable; incomeExpense.assecertainingAffordabilityReason = incomeExpenseDetail.assecertainingAffordabilityReason; incomeExpense.otherSourcesOfIncome = incomeExpenseDetail.otherSourcesOfIncome; incomeExpense.caseId=incomeExpenseDetail.caseId; var queryIncomeExpenseOthers = from incomeExpenseOther in ct.incomeExpenseOthers where incomeExpenseOther.incomeExpenseId == incomeExpenseDetail.id select incomeExpenseOther; foreach (incomeExpenseOther incomeExpenseOther in queryIncomeExpenseOthers) { ct.incomeExpenseOthers.DeleteOnSubmit(incomeExpenseOther); } //update income expense others list for the IncomeExpense goal if (incomeExpenseDetail.incomeExpenseOthers != null && incomeExpenseDetail.incomeExpenseOthers.Count > 0) { EntitySet<incomeExpenseOther> incomeExpenseOtherSet = new EntitySet<incomeExpenseOther>(); foreach (incomeExpenseOther incomeExpenseOther in incomeExpenseDetail.incomeExpenseOthers) { incomeExpenseOtherSet.Add(incomeExpenseOther); } incomeExpense.incomeExpenseOthers = incomeExpenseOtherSet; } var queryIncomeExpenseSaving = from insuranceArrangementSaving in ct.insuranceArrangementSavings where insuranceArrangementSaving.incomeExpenseId == incomeExpenseDetail.id select insuranceArrangementSaving; foreach (insuranceArrangementSaving insuranceArrangementSaving in queryIncomeExpenseSaving) { ct.insuranceArrangementSavings.DeleteOnSubmit(insuranceArrangementSaving); } //update income expense others list for the IncomeExpense goal if (incomeExpenseDetail.insuranceArrangementSavings != null && incomeExpenseDetail.insuranceArrangementSavings.Count > 0) { EntitySet<insuranceArrangementSaving> insuranceArrangementSavingSet = new EntitySet<insuranceArrangementSaving>(); foreach (insuranceArrangementSaving insuranceArrangementSaving in incomeExpenseDetail.insuranceArrangementSavings) { insuranceArrangementSavingSet.Add(insuranceArrangementSaving); } incomeExpense.insuranceArrangementSavings = insuranceArrangementSavingSet; } var queryIncomeExpenseRetirement = from insuranceArrangementRetirement in ct.insuranceArrangementRetirements where insuranceArrangementRetirement.incomeExpenseId == incomeExpenseDetail.id select insuranceArrangementRetirement; foreach (insuranceArrangementRetirement insuranceArrangementRetirement in queryIncomeExpenseRetirement) { ct.insuranceArrangementRetirements.DeleteOnSubmit(insuranceArrangementRetirement); } //update income expense others list for the IncomeExpense goal if (incomeExpenseDetail.insuranceArrangementRetirements != null && incomeExpenseDetail.insuranceArrangementRetirements.Count > 0) { EntitySet<insuranceArrangementRetirement> insuranceArrangementRetirementSet = new EntitySet<insuranceArrangementRetirement>(); foreach (insuranceArrangementRetirement insuranceArrangementRetirement in incomeExpenseDetail.insuranceArrangementRetirements) { insuranceArrangementRetirementSet.Add(insuranceArrangementRetirement); } incomeExpense.insuranceArrangementRetirements = insuranceArrangementRetirementSet; } var queryIncomeExpenseEducation = from insuranceArrangementEducation in ct.insuranceArrangementEducations where insuranceArrangementEducation.incomeExpenseId == incomeExpenseDetail.id select insuranceArrangementEducation; foreach (insuranceArrangementEducation insuranceArrangementEducation in queryIncomeExpenseEducation) { ct.insuranceArrangementEducations.DeleteOnSubmit(insuranceArrangementEducation); } //update income expense others list for the IncomeExpense goal if (incomeExpenseDetail.insuranceArrangementEducations != null && incomeExpenseDetail.insuranceArrangementEducations.Count > 0) { EntitySet<insuranceArrangementEducation> insuranceArrangementEducationSet = new EntitySet<insuranceArrangementEducation>(); foreach (insuranceArrangementEducation insuranceArrangementEducation in incomeExpenseDetail.insuranceArrangementEducations) { insuranceArrangementEducationSet.Add(insuranceArrangementEducation); } incomeExpense.insuranceArrangementEducations = insuranceArrangementEducationSet; } ct.SubmitChanges(); } catch (Exception e) { string str = e.Message; } return incomeExpense; }
public Boolean updateAssetLiabilityDetails(assetAndLiability assetAndLiability) { Boolean status = true; assetAndLiability assetLiability = null; try { dbDataContext ct = new dbDataContext(); //retrieve existing saving goal var queryAssetAndLiabilityGoals = from al in ct.assetAndLiabilities where al.caseId == assetAndLiability.caseId select al; foreach (assetAndLiability assetLiabilityGoals in queryAssetAndLiabilityGoals) { assetLiability = assetLiabilityGoals; } assetLiability.bankAcctCash = assetAndLiability.bankAcctCash; assetLiability.cashLoan = assetAndLiability.cashLoan; assetLiability.cpfoaBal = assetAndLiability.cpfoaBal; assetLiability.creditCard = assetAndLiability.creditCard; assetLiability.homeMortgage = assetAndLiability.homeMortgage; assetLiability.ilpCash = assetAndLiability.ilpCash; assetLiability.ilpCpf = assetAndLiability.ilpCpf; assetLiability.invPropCash = assetAndLiability.invPropCash; assetLiability.invPropCpf = assetAndLiability.invPropCpf; assetLiability.lumpSumCash = assetAndLiability.lumpSumCash; assetLiability.lumpSumCpf = assetAndLiability.lumpSumCpf; assetLiability.netWorth = assetAndLiability.netWorth; assetLiability.regularSumCash = assetAndLiability.regularSumCash; assetLiability.regularSumCpf = assetAndLiability.regularSumCpf; assetLiability.resPropCash = assetAndLiability.resPropCash; assetLiability.resPropCpf = assetAndLiability.resPropCpf; assetLiability.srsBal = assetAndLiability.srsBal; assetLiability.srsInvCash = assetAndLiability.srsInvCash; assetLiability.stocksSharesCash = assetAndLiability.stocksSharesCash; assetLiability.stocksSharesCpf = assetAndLiability.stocksSharesCpf; assetLiability.submissionDate = assetAndLiability.submissionDate; assetLiability.unitTrustsCash = assetAndLiability.unitTrustsCash; assetLiability.unitTrustsCpf = assetAndLiability.unitTrustsCpf; assetLiability.vehicleLoan = assetAndLiability.vehicleLoan; assetLiability.cpfsaBal = assetAndLiability.cpfsaBal; assetLiability.cpfMediSaveBalance = assetAndLiability.cpfMediSaveBalance; assetLiability.assetAndLiabilityNeeded = assetAndLiability.assetAndLiabilityNeeded; assetLiability.assetAndLiabilityNotNeededReason = assetAndLiability.assetAndLiabilityNotNeededReason; assetLiability.assetIncomePercent = assetAndLiability.assetIncomePercent; assetLiability.premiumRecomendedNeeded = assetAndLiability.premiumRecomendedNeeded; var queryliabilityOthers = from liabilityOther in ct.liabilityOthers where liabilityOther.assetLiabilityId == assetAndLiability.id select liabilityOther; foreach (liabilityOther liabilityOthers in queryliabilityOthers) { ct.liabilityOthers.DeleteOnSubmit(liabilityOthers); } var querypersonalUseAssetsOthers = from personalUseAssetsOther in ct.personalUseAssetsOthers where personalUseAssetsOther.assetLiabilityId == assetAndLiability.id select personalUseAssetsOther; foreach (personalUseAssetsOther personalUseAssetsOther in querypersonalUseAssetsOthers) { ct.personalUseAssetsOthers.DeleteOnSubmit(personalUseAssetsOther); } var queryinvestedAssetOthers = from investedAssetOthers in ct.investedAssetOthers where investedAssetOthers.assetLiabilityId == assetAndLiability.id select investedAssetOthers; foreach (investedAssetOther investedAssetOther in queryinvestedAssetOthers) { ct.investedAssetOthers.DeleteOnSubmit(investedAssetOther); } //update liability others list for the AssetLiability goal if (assetAndLiability.liabilityOthers != null && assetAndLiability.liabilityOthers.Count > 0) { EntitySet<liabilityOther> liabilityOtherSet = new EntitySet<liabilityOther>(); foreach (liabilityOther liabilityOther in assetAndLiability.liabilityOthers) { liabilityOtherSet.Add(liabilityOther); } assetLiability.liabilityOthers = liabilityOtherSet; } //update personal UseAssets others list for the AssetLiability if (assetAndLiability.personalUseAssetsOthers != null && assetAndLiability.personalUseAssetsOthers.Count > 0) { EntitySet<personalUseAssetsOther> personalUseAssetsOtherSet = new EntitySet<personalUseAssetsOther>(); foreach (personalUseAssetsOther liabilityOther in assetAndLiability.personalUseAssetsOthers) { personalUseAssetsOtherSet.Add(liabilityOther); } assetLiability.personalUseAssetsOthers = personalUseAssetsOtherSet; } //update invested others list for the AssetLiability if (assetAndLiability.investedAssetOthers != null && assetAndLiability.investedAssetOthers.Count > 0) { EntitySet<investedAssetOther> investedAssetOtherSet = new EntitySet<investedAssetOther>(); foreach (investedAssetOther investedAssetOther in assetAndLiability.investedAssetOthers) { investedAssetOtherSet.Add(investedAssetOther); } assetLiability.investedAssetOthers = investedAssetOtherSet; } ct.SubmitChanges(); } catch (Exception e) { status = false; string str = e.Message; } return status; }