Ejemplo n.º 1
0
        protected void saveAssetLiabilitiesDetails(object sender, EventArgs e)
        {
            string caseId = "";
            if (ViewState["caseId"] != null)
            {
                caseId = ViewState["caseId"].ToString();
            }

            if (Session["fnacaseid"] != null)
            {
                caseId = Session["fnacaseid"].ToString();
            }

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

            AssetAndLiabilityDAO assetAndLiabilityDAO = new AssetAndLiabilityDAO();
            assetAndLiability assetAndLiability = assetAndLiabilityDAO.getAssetLiabilityForCase(caseId);

            string status = "new";

            if (assetAndLiability != null)
            {
                copyAssetBaseClass(assetAndLiability);
                status = "update";
            }
            else
            {
                assetAndLiability = new assetAndLiability();
                copyAssetBaseClass(assetAndLiability);
            }

            int noofmemberOfInvestedAssets = 0;
            int noOfLiabilitiesNumber = 0;
            int noPersonalUsedAssetsNumber = 0;

            if (otherInvestedAssetsNumber.Value != "")
            {
                noofmemberOfInvestedAssets = Int16.Parse(otherInvestedAssetsNumber.Value) + 1;
            }

            if (otherPersonalUsedAssetsNumber.Value != "")
            {
                noPersonalUsedAssetsNumber = Int16.Parse(otherPersonalUsedAssetsNumber.Value) + 1;
            }

            if (otherLiabilitiesNumber.Value != "")
            {
                noOfLiabilitiesNumber = Int16.Parse(otherLiabilitiesNumber.Value) + 1;
            }

            EntitySet<personalUseAssetsOther> personalUseAssets = new EntitySet<personalUseAssetsOther>();
            EntitySet<liabilityOther> liabilityOthers = new EntitySet<liabilityOther>();
            EntitySet<investedAssetOther> investedAssetOther = new EntitySet<investedAssetOther>();

            if (noofmemberOfInvestedAssets > 0)
            {
                for (int i = 0; i < noofmemberOfInvestedAssets; i++)
                {

                    if (Request.Form["priothers-" + i] != null)
                    {
                        investedAssetOther asset = new investedAssetOther();
                        asset.cash = Request.Form["priotherscash-" + i];
                        asset.cpf = Request.Form["priotherscpf-" + i];
                        asset.date = DateTime.Today;
                        asset.assetDesc = Request.Form["priothers-" + i];
                        investedAssetOther.Add(asset);
                    }
                }
            }
            assetAndLiability.investedAssetOthers = investedAssetOther;
            if (noPersonalUsedAssetsNumber > 0)
            {
                for (int i = 0; i < noPersonalUsedAssetsNumber; i++)
                {

                    if (Request.Form["priotherspu-" + i] != null)
                    {
                        personalUseAssetsOther asset = new personalUseAssetsOther();
                        asset.cash = Request.Form["priotherspucash-" + i];
                        asset.cpf = Request.Form["priotherspucpf-" + i];
                        asset.date = DateTime.Today;
                        asset.assetDesc = Request.Form["priotherspu-" + i];
                        personalUseAssets.Add(asset);

                    }
                }
            }
            assetAndLiability.personalUseAssetsOthers = personalUseAssets;
            if (noOfLiabilitiesNumber > 0)
            {
                for (int i = 0; i < noOfLiabilitiesNumber; i++)
                {

                    if (Request.Form["priotherslb-" + i] != null)
                    {
                        liabilityOther liability = new liabilityOther();
                        liability.liabilityDesc = Request.Form["priotherslb-" + i];
                        liability.cash = Request.Form["priotherslbamount-" + i];
                        liability.date = DateTime.Today;
                        liabilityOthers.Add(liability);

                    }
                }
            }

            assetAndLiability.liabilityOthers = liabilityOthers;
            AssetAndLiabilityDAO dao = new AssetAndLiabilityDAO();
            if (status.Equals("new"))
            {
                assetAndLiability.caseId = caseId;
                dao.insertNewAssetLiabilityDetails(assetAndLiability);
            }
            else
                dao.updateAssetLiabilityDetails(assetAndLiability);

            this.assetList.DataSource = investedAssetOther;
            this.assetList.DataBind();
            this.liabilitiesOtherRepeater.DataSource = liabilityOthers;
            this.liabilitiesOtherRepeater.DataBind();
            this.otherPersonalAssetsRepeater.DataSource = personalUseAssets;
            this.otherPersonalAssetsRepeater.DataBind();

            string sts = activityStatusCheck.getAssetLiabilityStatus(assetAndLiability);
            activityStatusDao.saveOrUpdateActivityStatus(caseId, actv, sts);

            markStatusOnTab(caseId);

            string caseStatus = activityStatusCheck.getZPlanStatus(caseId);

            string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
            pdfData = activityStatusCheck.sendDataToSalesPortal(caseId, caseStatus, url, sendPdf);

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

            if (liabilityOthers.Count > 0)
                this.otherInvestedAssetsNumber.Value = (liabilityOthers.Count - 1) + "";
            if (personalUseAssets.Count > 0)
                this.otherPersonalUsedAssetsNumber.Value = (personalUseAssets.Count - 1) + "";
            if (investedAssetOther.Count > 0)
                this.otherInvestedAssetsNumber.Value = (investedAssetOther.Count - 1) + "";
            activityId.Value = caseId;

            lblPdSummarySaveSuccess.Visible = true;

            List<string> errors = printErrorMessages(assetAndLiability);
            this.ErrorRepeater.DataSource = errors;
            this.ErrorRepeater.DataBind();
        }
Ejemplo n.º 2
0
		private void detach_liabilityOthers(liabilityOther entity)
		{
			this.SendPropertyChanging();
			entity.assetAndLiability = null;
		}
Ejemplo n.º 3
0
 partial void UpdateliabilityOther(liabilityOther instance);
Ejemplo n.º 4
0
 partial void DeleteliabilityOther(liabilityOther instance);
Ejemplo n.º 5
0
 partial void InsertliabilityOther(liabilityOther instance);