Exemple #1
0
        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;
        }
Exemple #2
0
        public string getProtectionGoalMyneedsStatus(myNeed myneed)
        {
            string status = "";
            string criticalIllnessSectionStatus = "";
            string disabilitySectionStatus = "";
            string hospitalCoverSectionStatus = "";
            string accidentalCoverSectionStatus = "";

            if ((myneed.criticalIllnessPrNeeded == 1 || myneed.criticalIllnessPrNeeded == 0) && (myneed.disabilityPrNeeded == 1 || myneed.disabilityPrNeeded == 0) && (myneed.hospitalmedCoverNeeded == 1 || myneed.hospitalmedCoverNeeded == 0) && (myneed.accidentalhealthCoverNeeded == 1 || myneed.accidentalhealthCoverNeeded == 0))
            {
                status = "complete";
            }
            else
            {
                if (myneed.criticalIllnessPrNeeded == 2)
                {
                    if ((myneed.replacementIncomeRequired == null || myneed.replacementIncomeRequired == "") &&
                        (myneed.yearsOfSupportRequired == null || myneed.yearsOfSupportRequired == "") &&
                        (myneed.inflatedAdjustedReturns == null || myneed.inflatedAdjustedReturns == "") &&
                        (myneed.replacementAmountRequired == null || myneed.replacementAmountRequired == "") &&
                        (myneed.lumpSumRequiredForTreatment == null || myneed.lumpSumRequiredForTreatment == "") &&
                        (myneed.totalRequired == null || myneed.totalRequired == "") &&
                        (myneed.criticalIllnessInsurance == null || myneed.criticalIllnessInsurance == ""))
                    {
                        criticalIllnessSectionStatus = "incomplete";
                    }
                    else
                    {
                        criticalIllnessSectionStatus = "complete";
                    }
                }
                else if (myneed.criticalIllnessPrNeeded == 1 || myneed.criticalIllnessPrNeeded == 0)
                {
                    criticalIllnessSectionStatus = "complete";
                }

                if (myneed.disabilityPrNeeded == 2)
                {
                    if ((myneed.disabilityProtectionReplacementIncomeRequired == null || myneed.disabilityProtectionReplacementIncomeRequired == "") &&
                        (myneed.disabilityYearsOfSupport == null || myneed.disabilityYearsOfSupport == "") &&
                        (myneed.disabilityReplacementAmountRequired == null || myneed.disabilityReplacementAmountRequired == "") &&
                        (myneed.disabilityInsurance == null || myneed.disabilityInsurance == ""))
                    {
                        disabilitySectionStatus = "incomplete";
                    }
                    else
                    {
                        disabilitySectionStatus = "complete";
                    }
                }
                else if (myneed.disabilityPrNeeded == 1 || myneed.disabilityPrNeeded == 0)
                {
                    disabilitySectionStatus = "complete";
                }

                if (myneed.hospitalmedCoverNeeded == 2)
                {
                    if ((myneed.typeOfHospitalCoverage == null || myneed.typeOfHospitalCoverage == "") &&
                        (myneed.anyExistingPlans == null) &&
                        (myneed.typeOfRoomCoverage == null || myneed.typeOfRoomCoverage.Value == 0))
                    {
                        hospitalCoverSectionStatus = "incomplete";
                    }
                    else
                    {
                        hospitalCoverSectionStatus = "complete";
                    }
                }
                else if (myneed.hospitalmedCoverNeeded == 1 || myneed.hospitalmedCoverNeeded == 0)
                {
                    hospitalCoverSectionStatus = "complete";
                }

                if (myneed.accidentalhealthCoverNeeded == 2)
                {
                    if ((myneed.coverageOldageYesNo == null) &&
                        (myneed.epOldageYesNo == null) &&
                        (myneed.coveragePersonalYesNo == null) &&
                        (myneed.epPersonalYesNo == null) &&
                        (myneed.coverageOutpatientMedExp == null) &&
                        (myneed.epOutpatientMedExp == null) &&
                        (myneed.coverageLossOfIncome == null) &&
                        (myneed.epLossOfIncome == null) &&
                        (myneed.coverageOldageDisabilities == null) &&
                        (myneed.epOldageDisabilities == null) &&
                        (myneed.coverageDentalExp == null) &&
                        (myneed.epDentalExp == null))
                    {
                        accidentalCoverSectionStatus = "incomplete";
                    }
                    else
                    {
                        accidentalCoverSectionStatus = "complete";
                    }
                }
                else if (myneed.accidentalhealthCoverNeeded == 1 || myneed.accidentalhealthCoverNeeded == 0)
                {
                    accidentalCoverSectionStatus = "complete";
                }

                if (criticalIllnessSectionStatus == "complete" && disabilitySectionStatus == "complete" && hospitalCoverSectionStatus == "complete" && accidentalCoverSectionStatus == "complete")
                {
                    status = "complete";
                }
                else
                {
                    status = "incomplete";
                }
            }

            return status;
        }
Exemple #3
0
        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;
        }
Exemple #4
0
 partial void DeletemyNeed(myNeed instance);
Exemple #5
0
 partial void UpdatemyNeed(myNeed instance);
Exemple #6
0
 partial void InsertmyNeed(myNeed instance);
        private bool saveMyNeeds()
        {
            myNeed myNeeds = new myNeed();

            myNeeds.criticalIllnessPrNeeded = Convert.ToInt16(criticalIllnessPr.SelectedValue);

            if (criticalIllnessPr.SelectedValue == "2")
            {
                myNeeds.replacementIncomeRequired = replacementIncomeRequired.Text;
                myNeeds.lumpSumRequiredForTreatment = txtlumpSumRequiredForTreatment.Text;
                myNeeds.yearsOfSupportRequired = yearsOfSupportRequired.Text;
                myNeeds.inflatedAdjustedReturns = inflatedAdjustedReturns.Text;
                myNeeds.replacementAmountRequired = replacementAmountRequired.Text;
                myNeeds.criticalIllnessInsurance = txtCriticalIllnessInsurance.Text;
                myNeeds.existingAssetsMyneeds = txtExistingAssetsMyNeedsCritical.Text;
                myNeeds.totalShortfallSurplusMyNeeds = hiddentxtTotalShortfallSurplusMyNeeds.Value;
                myNeeds.totalRequired = totalRequired.Text;
            }
            else if (criticalIllnessPr.SelectedValue == "1" || criticalIllnessPr.SelectedValue == "0")
            {
                myNeeds.replacementIncomeRequired = "0";
                myNeeds.lumpSumRequiredForTreatment = "0";
                myNeeds.yearsOfSupportRequired = "0";
                myNeeds.inflatedAdjustedReturns = "0";
                myNeeds.replacementAmountRequired = "0";
                myNeeds.criticalIllnessInsurance = "0";
                myNeeds.existingAssetsMyneeds = "0";
                myNeeds.totalShortfallSurplusMyNeeds = "0";
                myNeeds.totalRequired = "0";
            }

            myNeeds.hospitalmedCoverNeeded = Convert.ToInt16(hospitalmedCoverNeeded.SelectedValue);
            myNeeds.accidentalhealthCoverNeeded = Convert.ToInt16(accidentalHealthCoverNeeded.SelectedValue);

            if (hospitalmedCoverNeeded.SelectedValue == "2")
            {
                myNeeds.typeOfHospitalCoverage = ddlHospitalTypeList.SelectedValue;

                if (ddlExistingPlanList.SelectedValue == "")
                {
                    myNeeds.anyExistingPlans = null;
                }
                else
                {
                    myNeeds.anyExistingPlans = ddlExistingPlanList.SelectedValue == "1" ? true : false;
                }

                if (ddlRoomTypeList.SelectedValue == "")
                {
                    myNeeds.typeOfRoomCoverage = null;
                }
                else
                {
                    myNeeds.typeOfRoomCoverage = Convert.ToInt16(ddlRoomTypeList.SelectedValue);
                }
            }
            else if (hospitalmedCoverNeeded.SelectedValue == "1" || hospitalmedCoverNeeded.SelectedValue == "0")
            {
                myNeeds.typeOfHospitalCoverage = "";
                myNeeds.anyExistingPlans = null;
                myNeeds.typeOfRoomCoverage = null;
            }

               if (ddlCoverageOldageYesNo.SelectedValue == "")
               {
               myNeeds.coverageOldageYesNo = null;
               }
               else
               {
               myNeeds.coverageOldageYesNo = ddlCoverageOldageYesNo.SelectedValue == "1" ? true : false;
               }

               if (ddlEpOldageYesNo.SelectedValue == "")
               {
               myNeeds.epOldageYesNo = null;
               }
               else
               {
               myNeeds.epOldageYesNo = ddlEpOldageYesNo.SelectedValue == "1" ? true : false;
               }

               if (ddlCoveragePersonalYesNo.SelectedValue == "")
               {
               myNeeds.coveragePersonalYesNo = null;
               }
               else
               {
               myNeeds.coveragePersonalYesNo = ddlCoveragePersonalYesNo.SelectedValue == "1" ? true : false;
               }

               if (ddlEpPersonalYesNo.SelectedValue == "")
               {
               myNeeds.epPersonalYesNo = null;
               }
               else
               {
               myNeeds.epPersonalYesNo = ddlEpPersonalYesNo.SelectedValue == "1" ? true : false;
               }

               if (coverageOutpatientMedExp.SelectedValue == "")
               {
               myNeeds.coverageOutpatientMedExp = null;
               }
               else
               {
               myNeeds.coverageOutpatientMedExp = coverageOutpatientMedExp.SelectedValue == "1" ? true : false;
               }
               if (epOutpatientMedExp.SelectedValue == "")
               {
               myNeeds.epOutpatientMedExp = null;
               }
               else
               {
               myNeeds.epOutpatientMedExp = epOutpatientMedExp.SelectedValue == "1" ? true : false;
               }
               if (coverageLossOfIncome.SelectedValue == "")
               {
               myNeeds.coverageLossOfIncome = null;
               }
               else
               {
               myNeeds.coverageLossOfIncome = coverageLossOfIncome.SelectedValue == "1" ? true : false;
               }
               if (epLossOfIncome.SelectedValue == "")
               {
               myNeeds.epLossOfIncome = null;
               }
               else
               {
               myNeeds.epLossOfIncome = epLossOfIncome.SelectedValue == "1" ? true : false;
               }
               if (coverageOldageDisabilities.SelectedValue == "")
               {
               myNeeds.coverageOldageDisabilities = null;
               }
               else
               {
               myNeeds.coverageOldageDisabilities = coverageOldageDisabilities.SelectedValue == "1" ? true : false;
               }
               if (epOldageDisabilities.SelectedValue == "")
               {
               myNeeds.epOldageDisabilities = null;
               }
               else
               {
               myNeeds.epOldageDisabilities = epOldageDisabilities.SelectedValue == "1" ? true : false;
               }
               if (coverageDentalExp.SelectedValue == "")
               {
               myNeeds.coverageDentalExp = null;
               }
               else
               {
               myNeeds.coverageDentalExp = coverageDentalExp.SelectedValue == "1" ? true : false;
               }
               if (epDentalExp.SelectedValue == "")
               {
               myNeeds.epDentalExp = null;
               }
               else
               {
               myNeeds.epDentalExp = epDentalExp.SelectedValue == "1" ? true : false;
               }

               if (ddlExistingPlanList.SelectedValue == "" && ddlEpOldageYesNo.SelectedValue == "" && ddlEpPersonalYesNo.SelectedValue == "" && epOutpatientMedExp.SelectedValue == "" && epLossOfIncome.SelectedValue == "" && epOldageDisabilities.SelectedValue == "" && epDentalExp.SelectedValue == "")
               {
               myNeeds.existingPlansDetail = "";
               }
               else
               {
               if (ddlExistingPlanList.SelectedValue != "" || ddlEpOldageYesNo.SelectedValue != "" || ddlEpPersonalYesNo.SelectedValue != "" || epOutpatientMedExp.SelectedValue != "" || epLossOfIncome.SelectedValue != "" || epOldageDisabilities.SelectedValue != "" || epDentalExp.SelectedValue != "")
               {
                   myNeeds.existingPlansDetail = DetailsOfExistingPlans.Text;
               }
               }

            myNeeds.disabilityPrNeeded = Convert.ToInt16(disabilityPr.SelectedValue);

            if (disabilityPr.SelectedValue == "2")
            {
                myNeeds.disabilityProtectionReplacementIncomeRequired = disabilityProtectionReplacementIncomeRequired.Text;
                myNeeds.disabilityYearsOfSupport = disabilityYearsOfSupport.Text;
                myNeeds.disabilityReplacementAmountRequired = disabilityReplacementAmountRequired.Text;
                myNeeds.disabilityInsurance = disabilityInsurance.Text;
                myNeeds.inflationAdjustedReturns = inflationAdjustedReturns.Text;
                myNeeds.existingAssetsMyneedsDisability = txtExistingAssetsMyneedsDisability.Text;
                myNeeds.shortfallSurplusMyNeeds = hiddentxtShortfallSurplusMyNeeds.Value;
            }
            else if (disabilityPr.SelectedValue == "1" || disabilityPr.SelectedValue == "0")
            {
                myNeeds.disabilityProtectionReplacementIncomeRequired = "0";
                myNeeds.disabilityYearsOfSupport = "0";
                myNeeds.disabilityReplacementAmountRequired = "0";
                myNeeds.disabilityInsurance = "0";
                myNeeds.inflationAdjustedReturns = "0";
                myNeeds.existingAssetsMyneedsDisability = "0";
                myNeeds.shortfallSurplusMyNeeds = "0";
            }

            myNeeds.caseId = ViewState["caseId"].ToString();

            int noofeacritical = 0;
            if (criticalIllnessPr.SelectedValue == "2")
            {
                if (noofcriticalassets.Value != "")
                {
                    noofeacritical = Int16.Parse(noofcriticalassets.Value);
                }
            }

            EntitySet<myNeedsCriticalAsset> eaMyNeedsCriticalList = new EntitySet<myNeedsCriticalAsset>();
            if (noofeacritical > 0)
            {
                for (int i = 1; i <= noofeacritical; i++)
                {
                    myNeedsCriticalAsset eaMNCritical = new myNeedsCriticalAsset();
                    eaMNCritical.asset = Request.Form["primyneedscritical-" + i];
                    eaMNCritical.presentValue = Request.Form["primyneedplus_" + i];

                    if ((Request.Form["primyneedscritical-" + i] != null) && (Request.Form["primyneedplus_" + i] != null))
                    {
                        eaMyNeedsCriticalList.Add(eaMNCritical);
                    }

                }
                myNeeds.myNeedsCriticalAssets = eaMyNeedsCriticalList;
            }

            int noOfDisability = 0;
            if (disabilityPr.SelectedValue == "2")
            {
                if (noofdisabilityassets.Value != "")
                {
                    noOfDisability = Int16.Parse(noofdisabilityassets.Value);
                }
            }

            EntitySet<myNeedsDisabilityAsset> eaMyNeedsDisabilityList = new EntitySet<myNeedsDisabilityAsset>();
            if (noOfDisability > 0)
            {
                for (int i = 1; i <= noOfDisability; i++)
                {
                    myNeedsDisabilityAsset eaMNDisability = new myNeedsDisabilityAsset();
                    eaMNDisability.asset = Request.Form["primyneedsdisb-" + i];
                    eaMNDisability.presentValue = Request.Form["primyneedpluspart2_" + i];

                    if ((Request.Form["primyneedsdisb-" + i] != null) && (Request.Form["primyneedpluspart2_" + i] != null))
                    {
                        eaMyNeedsDisabilityList.Add(eaMNDisability);
                    }

                }
                myNeeds.myNeedsDisabilityAssets = eaMyNeedsDisabilityList;
            }

            if (ViewState["casetypemyneeds"] != null && ViewState["casetypemyneeds"].ToString() == "new")
            {
                myNeeds = myNeedsDAO.saveMyNeeds(myNeeds);
            }
            else if (ViewState["casetypemyneeds"] != null && ViewState["casetypemyneeds"].ToString() == "update")
            {
                myNeeds = myNeedsDAO.updateMyNeeds(myNeeds);
            }

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

            string status = activityStatusCheck.getProtectionGoalMyneedsStatus(myNeeds);
            activityStatusDao.saveOrUpdateActivityStatus(ViewState["caseId"].ToString(), actv, status);

            markStatusOnTab(ViewState["caseId"].ToString());

            string caseStatus = activityStatusCheck.getZPlanStatus(ViewState["caseId"].ToString());

            string url = Server.MapPath("~/_layouts/Zurich/Printpages/");

            pdfData = activityStatusCheck.sendDataToSalesPortal(ViewState["caseId"].ToString(), caseStatus, url, sendPdf);

            if (myNeeds != null)
            {
                populateMyNeed(myNeeds);
            }
            else
            {
                return false;
            }

            return true;
        }
        private void populateMyNeed(myNeed mNeed)
        {
            IncomeExpenseDAO IncomeExpenseDAO = new IncomeExpenseDAO();
            incomeExpense incomeExpense= IncomeExpenseDAO.getIncomeExpenseForCase(mNeed.caseId);

            AssetAndLiabilityDAO assetLiabilityDao = new AssetAndLiabilityDAO();
            assetAndLiability assetAndLiability = assetLiabilityDao.getAssetLiabilityForCase(mNeed.caseId);

            float criticalIllnessPercentage = 100;
            float disabilityIncomePercentage = 75;

            if (mNeed.criticalIllnessPrNeeded != null)
            {
                criticalIllnessPr.SelectedValue = mNeed.criticalIllnessPrNeeded.ToString();
            }
            else
            {
                criticalIllnessPr2.Selected = true;
            }

            if (mNeed.disabilityPrNeeded != null)
            {
                disabilityPr.SelectedValue = mNeed.disabilityPrNeeded.ToString();
            }
            else
            {
                disabilityPr2.Selected = true;
            }

            if (mNeed.hospitalmedCoverNeeded != null)
            {
                hospitalmedCoverNeeded.SelectedValue = mNeed.hospitalmedCoverNeeded.ToString();
            }
            else
            {
                hospitalmedCoverNeeded2.Selected = true;
            }

            if (mNeed.accidentalhealthCoverNeeded != null)
            {
                accidentalHealthCoverNeeded.SelectedValue = mNeed.accidentalhealthCoverNeeded.ToString();
            }
            else
            {
                accidentalHealthCoverNeeded2.Selected = true;
            }

            if (mNeed.replacementIncomeRequired == null || mNeed.replacementIncomeRequired == "")
            {
                if (incomeExpense != null)
                {
                    if (incomeExpense.netMonthlyIncomeAfterCpf != null && incomeExpense.netMonthlyIncomeAfterCpf != "")
                    {
                        replacementIncomeRequired.Text = Math.Round((float.Parse(incomeExpense.netMonthlyIncomeAfterCpf) * 12 * criticalIllnessPercentage * .01)) + "";
                    }
                }
                else
                    replacementIncomeRequired.Text = "0";
            }
            else
                replacementIncomeRequired.Text = mNeed.replacementIncomeRequired;

            if (mNeed.disabilityProtectionReplacementIncomeRequired == null || mNeed.disabilityProtectionReplacementIncomeRequired == "")
            {
                if (incomeExpense != null)
                {
                    if (incomeExpense.netMonthlyIncomeAfterCpf != null && incomeExpense.netMonthlyIncomeAfterCpf != "")
                    {
                        disabilityProtectionReplacementIncomeRequired.Text = (float.Parse(incomeExpense.netMonthlyIncomeAfterCpf) * 12 * disabilityIncomePercentage * .01) + "";
                    }
                }
                else
                    disabilityProtectionReplacementIncomeRequired.Text = "0";
            }
            else
                disabilityProtectionReplacementIncomeRequired.Text = mNeed.disabilityProtectionReplacementIncomeRequired;

            if (mNeed.criticalIllnessInsurance == null || mNeed.criticalIllnessInsurance == "")
            {
                if (incomeExpense != null)
                {
                    if (incomeExpense.criticalIllnessSA != null && incomeExpense.criticalIllnessSA != "")
                    {
                        txtCriticalIllnessInsurance.Text = incomeExpense.criticalIllnessSA;
                    }
                    else
                        txtCriticalIllnessInsurance.Text = "0";
                }
                else
                    txtCriticalIllnessInsurance.Text = "0";
             }
            else
                txtCriticalIllnessInsurance.Text = mNeed.criticalIllnessInsurance;

            if (mNeed.disabilityInsurance == null || mNeed.disabilityInsurance == "")
            {
                if (incomeExpense != null)
                {
                    if (incomeExpense.tpdcSA != null && incomeExpense.tpdcSA != "")
                    {
                        disabilityInsurance.Text = incomeExpense.tpdcSA;
                    }
                    else
                        disabilityInsurance.Text = "0";
                }
                else
                    disabilityInsurance.Text = "0";
            }
            else
                disabilityInsurance.Text = mNeed.disabilityInsurance;

            string yearsToSupportCriticalIllness = getYearsToSupportCriticalIllness(mNeed.caseId);
            string yearsToSupportDisabilityProtection = getYearsToSupportDisabilityProtection(mNeed.caseId);

            if (mNeed.yearsOfSupportRequired == null || mNeed.yearsOfSupportRequired == "")
            {
                yearsOfSupportRequired.Text = yearsToSupportCriticalIllness;
            }
            else
                yearsOfSupportRequired.Text = mNeed.yearsOfSupportRequired;

            if (mNeed.disabilityYearsOfSupport == null || mNeed.disabilityYearsOfSupport == "")
            {
                disabilityYearsOfSupport.Text = yearsToSupportDisabilityProtection;
            }
            else
                disabilityYearsOfSupport.Text = mNeed.disabilityYearsOfSupport;

            //inflatedAdjustedReturns.Text = (mNeed.inflatedAdjustedReturns == null || mNeed.inflatedAdjustedReturns == "") ? "0" : mNeed.inflatedAdjustedReturns;
            replacementAmountRequired.Text = (mNeed.replacementAmountRequired == null || mNeed.replacementAmountRequired == "") ? "0" : mNeed.replacementAmountRequired;
            disabilityReplacementAmountRequired.Text = (mNeed.disabilityReplacementAmountRequired == null || mNeed.disabilityReplacementAmountRequired == "") ? "0" : mNeed.disabilityReplacementAmountRequired;
            //disabilityInsurance.Text = (mNeed.disabilityInsurance == null || mNeed.disabilityInsurance == "") ? "0" : mNeed.disabilityInsurance;
            //inflationAdjustedReturns.Text = (mNeed.inflationAdjustedReturns == null || mNeed.inflationAdjustedReturns == "") ? "0" : mNeed.inflationAdjustedReturns;

            if (mNeed.inflationAdjustedReturns == null || mNeed.inflationAdjustedReturns == "")
            {
                AssumptionDAO assumptionDao = new AssumptionDAO();
                inflationAdjustedReturns.Text = assumptionDao.getAssumptionById(4).percentage + "";
            }
            else
                inflationAdjustedReturns.Text = mNeed.inflationAdjustedReturns;

            if (mNeed.inflatedAdjustedReturns == null || mNeed.inflatedAdjustedReturns == "")
            {
                AssumptionDAO assumptionDao = new AssumptionDAO();
                inflatedAdjustedReturns.Text = assumptionDao.getAssumptionById(4).percentage + "";
            }
            else
                inflatedAdjustedReturns.Text = mNeed.inflatedAdjustedReturns;

            txtlumpSumRequiredForTreatment.Text = (mNeed.lumpSumRequiredForTreatment == null || mNeed.lumpSumRequiredForTreatment == "") ? "0" : mNeed.lumpSumRequiredForTreatment;
            //txtCriticalIllnessInsurance.Text = (mNeed.criticalIllnessInsurance == null || mNeed.criticalIllnessInsurance == "") ? "0" : mNeed.criticalIllnessInsurance;
            txtExistingAssetsMyNeedsCritical.Text = (mNeed.existingAssetsMyneeds == null || mNeed.existingAssetsMyneeds == "") ? "0" : mNeed.existingAssetsMyneeds;
            txtExistingAssetsMyneedsDisability.Text = (mNeed.existingAssetsMyneedsDisability == null || mNeed.existingAssetsMyneedsDisability == "") ? "0" : mNeed.existingAssetsMyneedsDisability;
            ddlHospitalTypeList.SelectedValue = (mNeed.typeOfHospitalCoverage == null || mNeed.typeOfHospitalCoverage == "") ? "" : mNeed.typeOfHospitalCoverage;

            if (mNeed.anyExistingPlans != null)
            {
                ddlExistingPlanList.SelectedValue = mNeed.anyExistingPlans == true ? "1" : "0";
            }
            else
            {
                ddlExistingPlanList.SelectedValue = "";
            }
            ViewState["anyExPl"] = ddlExistingPlanList.SelectedValue;

            if (mNeed.typeOfRoomCoverage != null)
            {
                ddlRoomTypeList.SelectedValue = mNeed.typeOfRoomCoverage.ToString();
            }
            else
            {
                ddlRoomTypeList.SelectedValue = "";
            }

            if (mNeed.coverageOldageYesNo != null)
            {
                ddlCoverageOldageYesNo.SelectedValue = mNeed.coverageOldageYesNo == true ? "1" : "0";
            }
            else
                ddlCoverageOldageYesNo.SelectedValue = "";

            if (mNeed.coverageOutpatientMedExp != null)
            {
                coverageOutpatientMedExp.SelectedValue = mNeed.coverageOutpatientMedExp == true ? "1" : "0";
            }
            else
            {
                coverageOutpatientMedExp.SelectedValue = "";
            }

            if (mNeed.coverageLossOfIncome != null)
            {
                coverageLossOfIncome.SelectedValue = mNeed.coverageLossOfIncome == true ? "1" : "0";
            }
            else
            {
                coverageLossOfIncome.SelectedValue = "";
            }

            if (mNeed.coverageOldageDisabilities != null)
            {
                coverageOldageDisabilities.SelectedValue = mNeed.coverageOldageDisabilities == true ? "1" : "0";
            }
            else
            {
                coverageOldageDisabilities.SelectedValue = "";
            }

            if (mNeed.coverageDentalExp != null)
            {
                coverageDentalExp.SelectedValue = mNeed.coverageDentalExp == true ? "1" : "0";
            }
            else
            {
                coverageDentalExp.SelectedValue = "";
            }

            //ddlEpOldageYesNo.SelectedValue = mNeed.epOldageYesNo == true ? "1" : "0";

            if (mNeed.epOldageYesNo != null)
            {
                ddlEpOldageYesNo.SelectedValue = mNeed.epOldageYesNo == true ? "1" : "0";
            }
            else
            {
                ddlEpOldageYesNo.SelectedValue = "";
            }
            ViewState["oldageExPl"] = ddlEpOldageYesNo.SelectedValue;

            //ddlCoveragePersonalYesNo.SelectedValue = mNeed.coveragePersonalYesNo == true ? "1" : "0";

            if (mNeed.coveragePersonalYesNo != null)
            {
                ddlCoveragePersonalYesNo.SelectedValue = mNeed.coveragePersonalYesNo == true ? "1" : "0";
            }
            else
                ddlCoveragePersonalYesNo.SelectedValue = "";

            //ddlEpPersonalYesNo.SelectedValue = mNeed.epPersonalYesNo == true ? "1" : "0";

            if (mNeed.epPersonalYesNo != null)
            {
                ddlEpPersonalYesNo.SelectedValue = mNeed.epPersonalYesNo == true ? "1" : "0";
            }
            else
            {
                ddlEpPersonalYesNo.SelectedValue = "";
            }
            ViewState["personalExPl"] = ddlEpPersonalYesNo.SelectedValue;

            if (mNeed.epOutpatientMedExp != null)
            {
                epOutpatientMedExp.SelectedValue = mNeed.epOutpatientMedExp == true ? "1" : "0";
            }
            else
            {
                epOutpatientMedExp.SelectedValue = "";
            }
            ViewState["epOutpatientMedExp"] = epOutpatientMedExp.SelectedValue;

            if (mNeed.epLossOfIncome != null)
            {
                epLossOfIncome.SelectedValue = mNeed.epLossOfIncome == true ? "1" : "0";
            }
            else
            {
                epLossOfIncome.SelectedValue = "";
            }
            ViewState["epLossOfIncome"] = epLossOfIncome.SelectedValue;

            if (mNeed.epOldageDisabilities != null)
            {
                epOldageDisabilities.SelectedValue = mNeed.epOldageDisabilities == true ? "1" : "0";
            }
            else
            {
                epOldageDisabilities.SelectedValue = "";
            }
            ViewState["epOldageDisabilities"] = epOldageDisabilities.SelectedValue;

            if (mNeed.epDentalExp != null)
            {
                epDentalExp.SelectedValue = mNeed.epDentalExp == true ? "1" : "0";
            }
            else
            {
                epDentalExp.SelectedValue = "";
            }
            ViewState["epDentalExp"] = epDentalExp.SelectedValue;

            if (mNeed.existingPlansDetail != null)
            {
                DetailsOfExistingPlans.Text = mNeed.existingPlansDetail.ToString();
            }
            else
                DetailsOfExistingPlans.Text = "";

            myNeedsCriticalAssetList.DataSource = mNeed.myNeedsCriticalAssets;
            myNeedsCriticalAssetList.DataBind();

            if (mNeed.myNeedsCriticalAssets != null)
            {
                ViewState["noofcriticalassets"] = mNeed.myNeedsCriticalAssets.Count;

                double sum = 0;
                txtTotalShortfallSurplusMyNeeds.Text = sum.ToString();
            }

            myNeedsDisabilityAssetList.DataSource = mNeed.myNeedsDisabilityAssets;
            myNeedsDisabilityAssetList.DataBind();

            if (mNeed.myNeedsDisabilityAssets != null)
            {
                ViewState["noofdisablityassets"] = mNeed.myNeedsDisabilityAssets.Count;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //lblSaveSuccess.Visible = false;

            activity = activityStatusDao.getActivity(14);
            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;
                activityId.Value = caseId;

                if (caseId != null && caseId != "")
                {
                    ViewState["caseid"] = caseId;
                    fmlyNeed = familyNeedsDAO.getFamilyNeed(caseId);

                    myNeed = myNeedsDAO.getMyNeed(caseId);

                    if (myNeed != null)
                    {
                        ViewState["casetypemyneeds"] = "update";
                        populateMyNeed(myNeed);
                    }
                    else
                    {
                        ViewState["casetypemyneeds"] = "new";
                        populateMyNeedIfNoNeed(caseId);
                    }

                }

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

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

            txtlumpSumRequiredForTreatment.Attributes.Add("onblur", "calculate()");
            txtCriticalIllnessInsurance.Attributes.Add("onblur", "calculate()");
            txtExistingAssetsMyNeedsCritical.Attributes.Add("onblur", "calculate()");
            txtTotalShortfallSurplusMyNeeds.Attributes.Add("onblur", "calculate()");
            txtTotalShortfallSurplusMyNeeds.Attributes.Add("readonly", "readonly");

            txtExistingAssetsMyneedsDisability.Attributes.Add("onblur", "calculate()");
            txtShortfallSurplusMyNeeds.Attributes.Add("onblur", "calculate()");
            txtShortfallSurplusMyNeeds.Attributes.Add("readonly", "readonly");

            replacementIncomeRequired.Attributes.Add("onblur", "calculate()");
            disabilityProtectionReplacementIncomeRequired.Attributes.Add("onblur", "calculate()");
            yearsOfSupportRequired.Attributes.Add("onblur", "calculate()");
            disabilityYearsOfSupport.Attributes.Add("onblur", "calculate()");
            inflatedAdjustedReturns.Attributes.Add("onblur", "calculate()");
            inflationAdjustedReturns.Attributes.Add("onblur", "calculate()");
            replacementAmountRequired.Attributes.Add("onblur", "calculate()");

            replacementAmountRequired.Attributes.Add("readonly", "readonly");
            totalRequired.Attributes.Add("readonly", "readonly");

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

            txtlumpSumRequiredForTreatment.Attributes.Add("onblur", "calculate()");
            txtCriticalIllnessInsurance.Attributes.Add("onblur", "calculate()");
            disabilityInsurance.Attributes.Add("onblur", "calculate()");
            markStatusOnTab(caseId);
        }