public static void MergeRows(GridView gridView) { try { string strPrevAsset = string.Empty; foreach (GridViewRow gvr in gridView.Rows) { string strAsset = string.Empty; Label tbAllocationPercent = (Label)gvr.FindControl("lblAssetClasses"); if (tbAllocationPercent != null && tbAllocationPercent.Text != string.Empty) { strAsset = tbAllocationPercent.Text; if (strPrevAsset == strAsset) { tbAllocationPercent.Text = string.Empty; } } strPrevAsset = strAsset; } } catch (Exception ex) { exceptionlog exLog = new exceptionlog(); exLog.message = ex.Message + " class: GapSummary Method: MergeRows"; exLog.source = ex.Source; string strtmp = ex.StackTrace; strtmp = strtmp.Replace('\r', ' '); strtmp = strtmp.Replace('\n', ' '); exLog.stacktrace = strtmp; exLog.targetsitename = ex.TargetSite.Name; ActivityStatusDAO activityStatus = new ActivityStatusDAO(); activityStatus.logException(exLog); } }
public string getZPlanStatus(string caseid) { string status = ""; ActivityStatusDAO dao = new ActivityStatusDAO(); activitystatus activityStatusPerdet = null; //activitystatus activityStatusPrDet = null; activitystatus activityStatusAssetLiab = null; activitystatus activityStatusIncomeExpense = null; activitystatus activityStatusMza = null; activityStatusPerdet = dao.getActivityForCaseid(caseid, "personaldetail"); //activityStatusPrDet = dao.getActivityForCaseid(caseid, "prioritydetail"); activityStatusAssetLiab = dao.getActivityForCaseid(caseid, "assetliability"); activityStatusIncomeExpense = dao.getActivityForCaseid(caseid, "incomeexpense"); activityStatusMza = dao.getActivityForCaseid(caseid, "myzurichadviser"); if (activityStatusPerdet != null && activityStatusAssetLiab != null && activityStatusIncomeExpense != null && activityStatusMza != null) { if (activityStatusPerdet.status == "incomplete" || activityStatusAssetLiab.status == "incomplete" || activityStatusIncomeExpense.status == "incomplete" || activityStatusMza.status == "incomplete") { status = "Incomplete"; } else { status = "Complete"; } } else { status = "Incomplete"; } return status; }
private bool savePortFolioModel() { try { if ((optnAgreeRiskProfileYes.Selected == true && lblRiskProfile.Text != "Capital Preservation") || (optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex > 1)) { if (!validateAllRequiredFields()) { return false; } } int riskProfileId = -1; switch (strProfileName) { case "Capital Preservation": riskProfileId = 0; break; case "Cautious": riskProfileId = 1; break; case "Moderately Cautious": riskProfileId = 2; break; case "Balanced": riskProfileId = 3; break; case "Moderately Adventurous": riskProfileId = 4; break; case "Adventurous": riskProfileId = 5; break; default: break; } bool agreeRiskProfile = true; if (optnAgreeRiskProfileYes.Selected == true) { agreeRiskProfile = true; } if (optnAgreeRiskProfileNo.Selected == true) { agreeRiskProfile = false; } string newRiskProfile = "-1"; newRiskProfile = ddlRiskProfileList.SelectedValue.ToString(); bool followAssetAllocationOnRiskProfileYesNo = false; if (optnAssetAllocRiskProfile1.Selected == true) { followAssetAllocationOnRiskProfileYesNo = true; } if (optnAssetAllocRiskProfile2.Selected == true) { followAssetAllocationOnRiskProfileYesNo = false; } //True = Fund Risk Plottor, False = Fund Selection bool assetAllocationOnRiskProfileYesNo = false; if (optnAllocRiskProfile1.Selected == true) { assetAllocationOnRiskProfileYesNo = true; } if (optnAllocRiskProfile2.Selected == true) { assetAllocationOnRiskProfileYesNo = false; } bool includeNonCoreFundsYesNo = false; if (optnNonCoreFunds1.Selected == true) { includeNonCoreFundsYesNo = true; } if (optnNonCoreFunds2.Selected == true) { includeNonCoreFundsYesNo = false; } int premiumSelect = -1; if (optnPremiumSelect1.Selected == true) { premiumSelect = 0; } if (optnPremiumSelect2.Selected == true) { premiumSelect = 1; } double premiumAmount = 0; double premiumPercent = 0; double totalPremiumAmount = 0; if (premium.Text != null && premium.Text != "") { premiumAmount = Convert.ToDouble(premium.Text); } string paymentMode = "-1"; paymentMode = ddlPaymentMode.SelectedValue.ToString(); List<int> lstAssetId = new List<int>(); List<int> lstFundId = new List<int>(); List<int> lstAllocationPercent = new List<int>(); List<int> lstAmount = new List<int>(); DataTable dtPortFolioBuilderDetail = new DataTable(); dtPortFolioBuilderDetail.Columns.Add("AssetId", typeof(string)); dtPortFolioBuilderDetail.Columns.Add("FundId", typeof(string)); dtPortFolioBuilderDetail.Columns.Add("AllocationPercent", typeof(string)); dtPortFolioBuilderDetail.Columns.Add("Amount", typeof(string)); List<GridViewRow> gvRows = new List<GridViewRow>(); if (optnAssetAllocRiskProfile1.Selected == true && (optnNonCoreFunds1.Selected == true || optnNonCoreFunds2.Selected == true)) { if (!validateFundAllocation()) { return false; } foreach (GridViewRow gvRow in grdNonCoreFunds.Rows) { gvRows.Add(gvRow); } } if (optnAssetAllocRiskProfile2.Selected == true && optnAllocRiskProfile1.Selected == true) { if (!validateFundPlotter()) { return false; } foreach (GridViewRow gvRow in grdFundRiskPlotter.Rows) { gvRows.Add(gvRow); } foreach (GridViewRow gvRow in grdSecondaryFunds.Rows) { gvRows.Add(gvRow); } } if (optnAssetAllocRiskProfile2.Selected == true && optnAllocRiskProfile2.Selected == true) { if (!ValidateFundSelection()) { return false; } foreach (GridViewRow gvRow in grdFundsSelection.Rows) { gvRows.Add(gvRow); } } if (gvRows != null) { foreach (GridViewRow gvr in gvRows) { Label lblAssedId = (Label)gvr.FindControl("lblAssetId"); Label lblFundId = (Label)gvr.FindControl("lblFundId"); TextBox tbAllocationPercent = (TextBox)gvr.FindControl("txtAllocation"); TextBox tbAmount = (TextBox)gvr.FindControl("txtAmount"); string iAssetId = lblAssedId.Text; string iFundId = lblFundId.Text; string strAllocationPercent = tbAllocationPercent.Text; string strAmount = tbAmount.Text; double totalPercent = 0; double totalpremiumAmt = 0; if ((strAllocationPercent != null && strAllocationPercent != "" && Convert.ToDouble(strAllocationPercent) > 0) || (strAmount != null && strAmount != "" && Convert.ToDouble(strAmount) > 0)) { if (strAllocationPercent == null || strAllocationPercent == "") { strAllocationPercent = "0"; } if ( Convert.ToDouble(strAllocationPercent) == 0) { continue; } //{ totalPercent = Convert.ToDouble(strAllocationPercent); //} if (strAmount == null || strAmount == "") { strAmount = "0"; } //else //{ totalpremiumAmt = Convert.ToDouble(strAmount); //} dtPortFolioBuilderDetail.Rows.Add(iAssetId, iFundId, strAllocationPercent, strAmount); } premiumPercent = premiumPercent + totalPercent; totalPremiumAmount = totalPremiumAmount + totalpremiumAmt; //if (txtTotalPremium.Text != null && txtTotalPremium.Text != "") //{ //premiumPercent = Convert.ToDouble(txtTotalPremium.Text); //} } PortFolioModellingDAO portFolioDAO = new PortFolioModellingDAO(); bool bResult = portFolioDAO.SavePortFolioBuilderInfo(caseID, riskProfileId, agreeRiskProfile, newRiskProfile, followAssetAllocationOnRiskProfileYesNo, assetAllocationOnRiskProfileYesNo, includeNonCoreFundsYesNo, premiumSelect, premiumAmount, paymentMode, premiumPercent, totalPremiumAmount, dtPortFolioBuilderDetail); if (bResult) { string actv = ""; if (ViewState["activity"] != null) { actv = ViewState["activity"].ToString(); } string status = activityStatusCheck.getPortfolioBuilderStatus(premiumPercent); activityStatusDao.saveOrUpdateActivityStatus(caseID, actv, status); cst.Value = markStatusOnTab(caseID); ScriptManager.RegisterStartupScript(this, typeof(string), "TabStatus", "tabstatus('"+cst.Value+"');", true); string caseStatus = activityStatusCheck.getZPlanStatus(caseID); string url = Server.MapPath("~/_layouts/Zurich/Printpages/"); pdfData = activityStatusCheck.sendDataToSalesPortal(caseID, caseStatus, url, sendPdf); LoadPortFolioDetails(); if ((txtTotalPremium.Text != string.Empty && (Convert.ToInt32(txtTotalPremium.Text) < 100)) && !(optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex == 1)) { lblSubmitMessageLessThan100.Visible = true; lblSubmitMessage.Visible = false; } else { lblSubmitMessageLessThan100.Visible = false; lblSubmitMessage.Visible = true; } return true; } } } catch (Exception ex) { exceptionlog exLog = new exceptionlog(); exLog.message = ex.Message + " class: PortFolioModelling Method: SavePortFolioModel"; exLog.source = ex.Source; string strtmp = ex.StackTrace; strtmp = strtmp.Replace('\r', ' '); strtmp = strtmp.Replace('\n', ' '); exLog.stacktrace = strtmp; exLog.targetsitename = ex.TargetSite.Name; ActivityStatusDAO activityStatus = new ActivityStatusDAO(); activityStatus.logException(exLog); } return false; }
protected void Page_Load(object sender, EventArgs e) { activity = activityStatusDao.getActivity(11); ViewState["activity"] = activity; premium.Style["TEXT-ALIGN"] = TextAlign.Right.ToString(); txtTotalPremium.Style["TEXT-ALIGN"] = TextAlign.Right.ToString(); txtAllocationAmtTotal.Style["TEXT-ALIGN"] = TextAlign.Right.ToString(); lblTotal.Style["TEXT-ALIGN"] = TextAlign.Right.ToString(); //followAssetAllocationOnRiskProfile.Attributes.Add("onclick", "return confirm('Data will be lost when?');"); //nonCoreFunds.Attributes.Add("onclick", "return confirm('Are you sure?');"); //allocationBasedOnRiskProfile.Attributes.Add("onclick", "return confirm('Are you sure?');"); //optnAgreeRiskProfile.Attributes.Add("onclick", "showChangeRiskProfileMessage();"); premium.Attributes.Add("onblur", "roundOffValues();"); txtTotalPremium.Attributes.Add("onblur", "roundOffValues();"); txtAllocationAmtTotal.Attributes.Add("onblur", "roundOffValues();"); // txtTotalPremium.Attributes.Add("OnKeyPress", "DisableTyping();"); txtTotalPremium.BackColor = Color.LightGray; txtAllocationAmtTotal.BackColor = Color.LightGray; try { if (!IsPostBack) { string menuCaseId = Request.QueryString["caseid"]; if (Session["fnacaseid"] != null) { caseID = Session["fnacaseid"].ToString(); } if (menuCaseId != null && menuCaseId != "") { caseID = menuCaseId; } ViewState["caseid"] = caseID; activityId.Value = caseID; HideFieldsOnFormLoad(); string strLclRiskProfileName = LoadRiskProfileDetails(caseID); if (strLclRiskProfileName == null || strLclRiskProfileName == string.Empty) { EnableDisableControls(false); btnBackFundPlotter.Enabled = true; btnNextFundPlotter.Enabled = true; btnBackPortFolioModel.Enabled = true; btnNextPortFolioModel.Enabled = true; return; } else { EnableDisableControls(true); } if (ViewState["strProfileName"] != null) { strProfileName = ViewState["strProfileName"].ToString(); } if (ViewState["strRiskProfileID"] != null) { strRiskProfileID = ViewState["strRiskProfileID"].ToString(); } LoadPortFolioDetails(); if ((txtTotalPremium.Text != string.Empty && (Convert.ToInt32(txtTotalPremium.Text) < 100)) && !(optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex == 1)) { //if (lblSubmitMessageLessThan100.Visible == false) //{ if (optnAgreeRiskProfileYes.Selected == true && lblRiskProfile.Text == "Capital Preservation") { lblAllocationLessThan100.Visible = false; } else { lblAllocationLessThan100.Visible = true; } //} } } else { if (ViewState["caseid"] != null) { caseID = ViewState["caseid"].ToString(); } if (ViewState["strProfileName"] != null) { strProfileName = ViewState["strProfileName"].ToString(); } if (ViewState["strRiskProfileID"] != null) { strRiskProfileID = ViewState["strRiskProfileID"].ToString(); } } cst.Value = markStatusOnTab(caseID); } catch (Exception ex) { exceptionlog exLog = new exceptionlog(); exLog.message = ex.Message + " class: PortFolioModelling Method: Page_Load"; exLog.source = ex.Source; string strtmp = ex.StackTrace; strtmp = strtmp.Replace('\r', ' '); strtmp = strtmp.Replace('\n', ' '); exLog.stacktrace = strtmp; exLog.targetsitename = ex.TargetSite.Name; ActivityStatusDAO activityStatus = new ActivityStatusDAO(); activityStatus.logException(exLog); } }
private void logException(Exception ex, string methodName) { exceptionlog exLog = new exceptionlog(); exLog.message = ex.Message + " class: PortFolioModellingDAO Method: " + methodName; exLog.source = ex.Source; string strtmp = ex.StackTrace; strtmp = strtmp.Replace('\r', ' '); strtmp = strtmp.Replace('\n', ' '); exLog.stacktrace = strtmp; exLog.targetsitename = ex.TargetSite.Name; ActivityStatusDAO activityStatus = new ActivityStatusDAO(); activityStatus.logException(exLog); }