private bool saveFamilyNeeds()
        {
            familyNeed familyNeeds = new familyNeed();

            familyNeeds.familyIncPrNeeded = Convert.ToInt32(familyIncPrNeeded.SelectedValue);
            familyNeeds.mortgageNeeded = Convert.ToInt32(mortgagePrNeeded.SelectedValue);

            if (familyNeeds.familyIncPrNeeded == 2)
            {
                familyNeeds.replacementIncomeRequired = txtReplacementIncome.Text;
                familyNeeds.yearsOfSupportRequired = txtYrsOfSupport.Text;
                familyNeeds.inflationAdjustedReturns = txtInflationAdjustedReturns.Text;
                familyNeeds.lumpSumRequired = txtLumpSumRequired.Text;
                familyNeeds.otherLiabilities = txtOtherLiabilities.Text;
                familyNeeds.emergencyFundsNeeded = txtEmergencyFundsNeeded.Text;
                familyNeeds.finalExpenses = txtFinalExpenses.Text;
                familyNeeds.otherFundingNeeds = txtOtherFundingNeeds.Text;
                //familyNeeds.otherComments = txtotherComments.Text;
                familyNeeds.totalRequired = txtTotalRequired.Text;
                familyNeeds.existingLifeInsurance = txtExistingLifeInsurance.Text;
                familyNeeds.existingAssetsFamilyneeds = txtExistingAssetsFamilyneeds.Text;
                //familyNeeds.totalShortfallSurplus = txtTotalShortfallSurplus.Text;
                familyNeeds.totalShortfallSurplus = hiddenTotalShortfallSurplus.Value;
            }
            else if (familyNeeds.familyIncPrNeeded == 1 || familyNeeds.familyIncPrNeeded == 0)
            {
                familyNeeds.replacementIncomeRequired = "0";
                familyNeeds.yearsOfSupportRequired = "0";
                familyNeeds.inflationAdjustedReturns = "0";
                familyNeeds.lumpSumRequired = "0";
                familyNeeds.otherLiabilities = "0";
                familyNeeds.emergencyFundsNeeded = "0";
                familyNeeds.finalExpenses = "0";
                familyNeeds.otherFundingNeeds = "0";
                //familyNeeds.otherComments = txtotherComments.Text;
                familyNeeds.totalRequired = "0";
                familyNeeds.existingLifeInsurance = "0";
                familyNeeds.existingAssetsFamilyneeds = "0";
                //familyNeeds.totalShortfallSurplus = txtTotalShortfallSurplus.Text;
                familyNeeds.totalShortfallSurplus = "0";
            }

            if (familyNeeds.mortgageNeeded == 2)
            {
                familyNeeds.mortgageProtectionOutstanding = txtMortgageProtectionOutstanding.Text;
                familyNeeds.mortgageProtectionInsurances = txtMortgageProtectionInsurances.Text;
                familyNeeds.mortgageProtectionTotal = hiddentxtMortgageProtectionTotal.Value;
            }
            else if (familyNeeds.mortgageNeeded == 1 || familyNeeds.mortgageNeeded == 0)
            {
                familyNeeds.mortgageProtectionOutstanding = "0";
                familyNeeds.mortgageProtectionInsurances = "0";
                familyNeeds.mortgageProtectionTotal = "0";
            }

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

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

            EntitySet<familyNeedsAsset> eaFNeedsList = new EntitySet<familyNeedsAsset>();
            if (noofea > 0)
            {
                for (int i = 1; i <= noofea; i++)
                {
                    familyNeedsAsset eafn = new familyNeedsAsset();
                    eafn.asset = Request.Form["prifamily-" + i];
                    eafn.presentValue = Request.Form["prifamilyneeds_" + i];

                    if ((Request.Form["prifamily-" + i] != null) && (Request.Form["prifamilyneeds_" + i] != null))
                    {
                        eaFNeedsList.Add(eafn);
                    }

                }
                familyNeeds.familyNeedsAssets = eaFNeedsList;
            }

            if (ViewState["casetypefamily"] != null && ViewState["casetypefamily"].ToString() == "new")
            {
                familyNeeds = familyNeedsDAO.saveFamilyNeeds(familyNeeds);
            }
            else if (ViewState["casetypefamily"] != null && ViewState["casetypefamily"].ToString() == "update")
            {
                familyNeeds = familyNeedsDAO.updateFamilyNeeds(familyNeeds);
            }

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

            string status = activityStatusCheck.getProtectionGoalFamilyStatus(familyNeeds);
            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 (familyNeeds != null)
            {
                populateFamilyNeed(familyNeeds);
            }
            else
            {
                return false;
            }

            return true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //lblSaveSuccess.Visible = false;
            activity = activityStatusDao.getActivity(5);
            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);

                    if (fmlyNeed != null)
                    {
                        ViewState["casetypefamily"] = "update";
                        populateFamilyNeed(fmlyNeed);
                    }
                    else
                    {
                        ViewState["casetypefamily"] = "new";
                        populateFamilyNeedIfNoNeed(caseId);
                    }
                }

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

            txtReplacementIncome.Attributes.Add("onblur", "calculate()");
            txtYrsOfSupport.Attributes.Add("onblur", "calculate()");
            txtInflationAdjustedReturns.Attributes.Add("onblur", "calculate()");
            txtLumpSumRequired.Attributes.Add("onblur", "calculate()");
            txtOtherLiabilities.Attributes.Add("onblur", "calculate()");
            txtEmergencyFundsNeeded.Attributes.Add("onblur", "calculate()");
            txtFinalExpenses.Attributes.Add("onblur", "calculate()");
            txtOtherFundingNeeds.Attributes.Add("onblur", "calculate()");
            txtTotalRequired.Attributes.Add("onblur", "calculate()");
            txtExistingLifeInsurance.Attributes.Add("onblur", "calculate()");
            txtExistingAssetsFamilyneeds.Attributes.Add("onblur", "calculate()");
            txtTotalShortfallSurplus.Attributes.Add("onblur", "calculate()");
            txtMortgageProtectionOutstanding.Attributes.Add("onblur", "calculate()");
            txtMortgageProtectionInsurances.Attributes.Add("onblur", "calculate()");
            txtMortgageProtectionTotal.Attributes.Add("onblur", "calculate()");
            txtTotalRequired.Attributes.Add("readonly", "readonly");
            txtExistingAssetsFamilyneeds.Attributes.Add("readonly", "readonly");
            txtTotalShortfallSurplus.Attributes.Add("readonly", "readonly");
            txtMortgageProtectionTotal.Attributes.Add("readonly", "readonly");
            txtLumpSumRequired.Attributes.Add("readonly", "readonly");

            markStatusOnTab(caseId);
        }
        private void populateFamilyNeed(familyNeed fNeed)
        {
            //txtReplacementIncome.Text = (fNeed.replacementIncomeRequired == null || fNeed.replacementIncomeRequired == "") ? "0" : fNeed.replacementIncomeRequired;

            familyIncPrNeeded.SelectedValue = fNeed.familyIncPrNeeded.ToString();
            mortgagePrNeeded.SelectedValue = fNeed.mortgageNeeded.ToString();

            if(fNeed.yearsOfSupportRequired == null || fNeed.yearsOfSupportRequired == "")
            {
                string yearsToSupport = getYearsToSupport(fNeed.caseId);
                txtYrsOfSupport.Text = yearsToSupport;
            }
            else
                txtYrsOfSupport.Text=fNeed.yearsOfSupportRequired;

            txtInflationAdjustedReturns.Text = (fNeed.inflationAdjustedReturns == null || fNeed.inflationAdjustedReturns == "") ? "0" : fNeed.inflationAdjustedReturns;
            txtLumpSumRequired.Text = (fNeed.lumpSumRequired == null || fNeed.lumpSumRequired == "") ? "0" : fNeed.lumpSumRequired;
            txtOtherLiabilities.Text = (fNeed.otherLiabilities == null || fNeed.otherLiabilities == "") ? "0" : fNeed.otherLiabilities;
            txtEmergencyFundsNeeded.Text = (fNeed.emergencyFundsNeeded == null || fNeed.emergencyFundsNeeded == "") ? "0" : fNeed.emergencyFundsNeeded;
            txtFinalExpenses.Text = (fNeed.finalExpenses == null || fNeed.finalExpenses == "") ? "0" : fNeed.finalExpenses;
            txtOtherFundingNeeds.Text = (fNeed.otherFundingNeeds == null || fNeed.otherFundingNeeds == "") ? "0" : fNeed.otherFundingNeeds;
            //txtotherComments.Text = (fNeed.otherComments == null || fNeed.otherComments == "") ? "0" : fNeed.otherComments;
            txtTotalRequired.Text = (fNeed.totalRequired == null || fNeed.totalRequired == "") ? "0" : fNeed.totalRequired;
            txtExistingLifeInsurance.Text = (fNeed.existingLifeInsurance == null || fNeed.existingLifeInsurance == "") ? "0" : fNeed.existingLifeInsurance;
            //txtExistingAssetsFamilyneeds.Text = (fNeed.existingAssetsFamilyneeds == null || fNeed.existingAssetsFamilyneeds == "") ? "0" : fNeed.existingAssetsFamilyneeds;
            txtTotalShortfallSurplus.Text = (fNeed.totalShortfallSurplus == null || fNeed.totalShortfallSurplus == "") ? "0" : fNeed.totalShortfallSurplus;
            hiddenTotalShortfallSurplus.Value = (fNeed.totalShortfallSurplus == null || fNeed.totalShortfallSurplus == "") ? "0" : fNeed.totalShortfallSurplus;

            txtMortgageProtectionOutstanding.Text = (fNeed.mortgageProtectionOutstanding == null || fNeed.mortgageProtectionOutstanding == "") ? "0" : fNeed.mortgageProtectionOutstanding;
               // txtMortgageProtectionInsurances.Text = (fNeed.mortgageProtectionInsurances == null || fNeed.mortgageProtectionInsurances == "") ? "0" : fNeed.mortgageProtectionInsurances;
            txtMortgageProtectionTotal.Text = (fNeed.mortgageProtectionTotal == null || fNeed.mortgageProtectionTotal == "") ? "0" : fNeed.mortgageProtectionTotal;

            float percentage= 70;

            IncomeExpenseDAO incomeExpenseDao = new IncomeExpenseDAO();
            incomeExpense incomeExpense= incomeExpenseDao.getIncomeExpenseForCase(fNeed.caseId);

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

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

            if (fNeed.emergencyFundsNeeded == null || fNeed.emergencyFundsNeeded == "")
            {
                if(incomeExpense!=null)
                {
                    if (incomeExpense.emergencyFundsNeeded != null &&  incomeExpense.emergencyFundsNeeded == "")
                        txtEmergencyFundsNeeded.Text=incomeExpense.emergencyFundsNeeded;
                }
                else
                    txtEmergencyFundsNeeded.Text="0";
            }
            else
                txtEmergencyFundsNeeded.Text=fNeed.emergencyFundsNeeded;

            if(fNeed.otherLiabilities==null || fNeed.otherLiabilities=="")
            {

                if(assetAndLiability!=null)
                {
                    float liability=0;

                    if (assetAndLiability.vehicleLoan != null && assetAndLiability.vehicleLoan != "")
                    {
                        liability+=float.Parse(assetAndLiability.vehicleLoan);
                    }

                    if (assetAndLiability.cashLoan != null && assetAndLiability.cashLoan != "")
                    {
                        liability+=float.Parse(assetAndLiability.cashLoan);
                    }

                    if (assetAndLiability.creditCard != null && assetAndLiability.creditCard != "")
                    {
                        liability+=float.Parse(assetAndLiability.creditCard);
                    }

                    if(assetAndLiability.liabilityOthers!=null)
                    {
                        int count=assetAndLiability.liabilityOthers.Count;

                        EntitySet<liabilityOther> others = assetAndLiability.liabilityOthers;
                        for (int i = 0; i < count; i++)
                        {
                            if (others[i].cash != null && others[i].cash != "")
                                liability+= float.Parse(others[i].cash);
                        }
                    }

                    txtOtherLiabilities.Text=liability+"";
                }
                else
                    txtOtherLiabilities.Text="0";
            }

            float existLifeInsurance=0;

            if(fNeed.existingLifeInsurance ==null || fNeed.existingLifeInsurance=="")
            {
                if (incomeExpense != null)
                {
                    if (incomeExpense.DeathTermInsuranceSA != null && incomeExpense.DeathTermInsuranceSA != "")
                    {
                        existLifeInsurance += float.Parse(incomeExpense.DeathTermInsuranceSA);
                    }
                    if (incomeExpense.DeathWholeLifeInsuranceSA != null && incomeExpense.DeathWholeLifeInsuranceSA != "")
                    {
                        existLifeInsurance += float.Parse(incomeExpense.DeathWholeLifeInsuranceSA);
                    }
                    if (incomeExpense.lifeInsuranceSA != null && incomeExpense.lifeInsuranceSA != "")
                    {
                        existLifeInsurance += float.Parse(incomeExpense.lifeInsuranceSA);
                    }
                }

                 txtExistingLifeInsurance.Text=existLifeInsurance+"";
            }
            else
                txtExistingLifeInsurance.Text=fNeed.existingLifeInsurance;

            if(fNeed.mortgageProtectionOutstanding ==null || fNeed.mortgageProtectionOutstanding=="")
            {
                if(assetAndLiability!=null)
                {
                    if (assetAndLiability.homeMortgage != null && assetAndLiability.homeMortgage != "")
                    {
                        txtMortgageProtectionOutstanding.Text=assetAndLiability.homeMortgage;
                    }
                    else
                        txtMortgageProtectionOutstanding.Text="0";
                }
            }
            else
                txtMortgageProtectionOutstanding.Text=fNeed.mortgageProtectionOutstanding;

            if(fNeed.mortgageProtectionInsurances ==null || fNeed.mortgageProtectionInsurances=="")
            {
                if(incomeExpense!=null)
                {
                    if (incomeExpense.mortgageSA != null && incomeExpense.mortgageSA != "")
                    {
                        txtMortgageProtectionInsurances.Text=incomeExpense.mortgageSA;
                    }
                    else
                        txtMortgageProtectionInsurances.Text="0";
                }
                else
                   txtMortgageProtectionInsurances.Text="0";
            }
                else
                    txtMortgageProtectionInsurances.Text=fNeed.mortgageProtectionInsurances;

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

            if (fNeed.familyNeedsAssets!=null)
                noofmembers.Value = fNeed.familyNeedsAssets.Count+"";
            else
                noofmembers.Value = "0";

            familyNeedsAssetList.DataSource = fNeed.familyNeedsAssets;
            familyNeedsAssetList.DataBind();

            if (fNeed.familyNeedsAssets != null)
            {
                ViewState["assetsSize"] = fNeed.familyNeedsAssets.Count;

                double sum = 0;
                txtExistingAssetsFamilyneeds.Text = sum.ToString();
            }
        }
Esempio n. 4
0
        public string getProtectionGoalFamilyStatus(familyNeed familyneed)
        {
            string status = "";
            string familyIncStatus = "";
            string mortgageStatus = "";

            if ((familyneed.familyIncPrNeeded == 1 || familyneed.familyIncPrNeeded == 0) && (familyneed.mortgageNeeded == 1 || familyneed.mortgageNeeded == 0))
            {
                familyIncStatus = "complete";
                mortgageStatus = "complete";
            }
            else
            {
                if (familyneed.familyIncPrNeeded == 2)
                {
                    if ((familyneed.replacementIncomeRequired == null || familyneed.replacementIncomeRequired == "") &&
                    (familyneed.yearsOfSupportRequired == null || familyneed.yearsOfSupportRequired == "") &&
                    (familyneed.inflationAdjustedReturns == null || familyneed.inflationAdjustedReturns == "") &&
                    (familyneed.lumpSumRequired == null || familyneed.lumpSumRequired == "") &&
                    (familyneed.otherLiabilities == null || familyneed.otherLiabilities == "") &&
                    (familyneed.emergencyFundsNeeded == null || familyneed.emergencyFundsNeeded == "") &&
                    (familyneed.finalExpenses == null || familyneed.finalExpenses == "") &&
                    (familyneed.otherFundingNeeds == null || familyneed.otherFundingNeeds == "") &&
                    (familyneed.totalRequired == null || familyneed.totalRequired == "") &&
                    (familyneed.existingLifeInsurance == null || familyneed.existingLifeInsurance == "") &&
                    (familyneed.totalShortfallSurplus == null || familyneed.totalShortfallSurplus == ""))
                    {
                        familyIncStatus = "incomplete";
                    }
                    else
                    {
                        familyIncStatus = "complete";
                    }
                }
                else
                {
                    familyIncStatus = "complete";
                }

                if (familyneed.mortgageNeeded == 2)
                {
                    if ((familyneed.mortgageProtectionOutstanding == null || familyneed.mortgageProtectionOutstanding == "") &&
                    (familyneed.mortgageProtectionInsurances == null || familyneed.mortgageProtectionInsurances == "") &&
                    (familyneed.mortgageProtectionTotal == null || familyneed.mortgageProtectionTotal == ""))
                    {
                        mortgageStatus = "incomplete";
                    }
                    else
                    {
                        mortgageStatus = "complete";
                    }
                }
                else
                {
                    mortgageStatus = "complete";
                }
            }

            if (familyIncStatus == "complete" && mortgageStatus == "complete")
            {
                status = "complete";
            }
            else
            {
                status = "incomplete";
            }

            return status;
        }
Esempio n. 5
0
 partial void DeletefamilyNeed(familyNeed instance);
Esempio n. 6
0
 partial void UpdatefamilyNeed(familyNeed instance);
Esempio n. 7
0
 partial void InsertfamilyNeed(familyNeed instance);
        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);
        }