public void CreateCustomerGoalProfile(GoalProfileSetupVo GoalProfileVo, int UserId) { Database db; DbCommand createCustomerGoalProfileCmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); createCustomerGoalProfileCmd = db.GetStoredProcCommand("SP_SaveCustomerGoalProfile"); db.AddInParameter(createCustomerGoalProfileCmd, "@CustomerId", DbType.Int32, GoalProfileVo.CustomerId); db.AddInParameter(createCustomerGoalProfileCmd, "@GoalCode", DbType.String, GoalProfileVo.Goalcode); db.AddInParameter(createCustomerGoalProfileCmd, "@CostToday", DbType.Double, GoalProfileVo.CostOfGoalToday); db.AddInParameter(createCustomerGoalProfileCmd, "@GoalYear", DbType.Int32, GoalProfileVo.GoalYear); db.AddInParameter(createCustomerGoalProfileCmd, "@GoalProfileDate", DbType.DateTime, GoalProfileVo.GoalDate); db.AddInParameter(createCustomerGoalProfileCmd, "@CorpusRequired", DbType.Double, GoalProfileVo.RetirementCorpus); db.AddInParameter(createCustomerGoalProfileCmd, "@MonthlySavingsRequired", DbType.Double, GoalProfileVo.MonthlySavingsReq); if (GoalProfileVo.AssociateId != 0) { db.AddInParameter(createCustomerGoalProfileCmd, "@AssociateId", DbType.Int32, GoalProfileVo.AssociateId); } db.AddInParameter(createCustomerGoalProfileCmd, "@ROIEarned", DbType.Double, GoalProfileVo.ROIEarned); db.AddInParameter(createCustomerGoalProfileCmd, "@CurrentInvestment", DbType.Double, GoalProfileVo.CurrInvestementForGoal); db.AddInParameter(createCustomerGoalProfileCmd, "@ExpectedROI", DbType.Double, GoalProfileVo.ExpectedROI); db.AddInParameter(createCustomerGoalProfileCmd, "@IsActive", DbType.Int16, GoalProfileVo.IsActice); db.AddInParameter(createCustomerGoalProfileCmd, "@InflationPer", DbType.Double, GoalProfileVo.InflationPercent); if (GoalProfileVo.CustomerApprovedOn != DateTime.Parse("01/01/0001 00:00:00")) { db.AddInParameter(createCustomerGoalProfileCmd, "@CustomerApprovedOn", DbType.DateTime, GoalProfileVo.CustomerApprovedOn); } db.AddInParameter(createCustomerGoalProfileCmd, "@Comments", DbType.String, GoalProfileVo.Comments); db.AddInParameter(createCustomerGoalProfileCmd, "@GoalDescription", DbType.String, GoalProfileVo.GoalDescription); db.AddInParameter(createCustomerGoalProfileCmd, "@ROIOnFuture", DbType.Double, GoalProfileVo.RateofInterestOnFture); db.AddInParameter(createCustomerGoalProfileCmd, "@CreatedBy", DbType.Int32, GoalProfileVo.CreatedBy); db.AddInParameter(createCustomerGoalProfileCmd, "@LumpsumInvestmentRequired", DbType.Double, GoalProfileVo.LumpsumInvestRequired); db.AddInParameter(createCustomerGoalProfileCmd, "@FutureValueOnCurrentInvest", DbType.Double, GoalProfileVo.FutureValueOnCurrentInvest); db.ExecuteNonQuery(createCustomerGoalProfileCmd); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "GoalProfileSetupDao.cs:CreateCustomerGoalProfile()"); object[] objects = new object[1]; objects[0] = GoalProfileVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public double SumSavingReq(int CustomerId, int ActiveFlag) { double SumSave = 0; List <GoalProfileSetupVo> GoalProfileList = new List <GoalProfileSetupVo>(); CustomerGoalSetupDao customerGoalProfileDao = new CustomerGoalSetupDao(); GoalProfileSetupVo goalProfileSetupVo = new GoalProfileSetupVo(); GoalProfileList = customerGoalProfileDao.GetCustomerGoalProfile(CustomerId, ActiveFlag); try { for (int i = 0; i < GoalProfileList.Count; i++) { SumSave += goalProfileSetupVo.MonthlySavingsReq; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:SumSavingReq()"); object[] objects = new object[1]; objects[0] = CustomerId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(SumSave); }
public GoalProfileSetupVo GetCustomerGoal(int CustomerId, int GoalId) { GoalProfileSetupVo GoalProfileVo = new GoalProfileSetupVo(); CustomerGoalSetupDao GaolProfiling = new CustomerGoalSetupDao(); try { GoalProfileVo = GaolProfiling.GetCustomerGoal(CustomerId, GoalId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:GetCustomerGoalProfiling()"); object[] objects = new object[2]; objects[0] = CustomerId; objects[1] = GoalId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(GoalProfileVo); }
public void CreateCustomerGoalProfileForRetirement(GoalProfileSetupVo GoalProfileVo, int UserId, int Flag) { try { GoalProfileSetupVo CreateGoalProfileVo = new GoalProfileSetupVo(); CreateGoalProfileVo = CalculateGoalProfileRT(GoalProfileVo); CustomerGoalSetupDao customerGoalSetupDao = new CustomerGoalSetupDao(); if (Flag == 0) { customerGoalSetupDao.CreateCustomerGoalProfile(CreateGoalProfileVo, UserId); } else { // when the flag value 1 at this time userId IS GoalId customerGoalSetupDao.UpdateCustomerGoalProfile(CreateGoalProfileVo, UserId); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:CreateCustomerGoalProfileForRetirement()"); object[] objects = new object[2]; objects[0] = GoalProfileVo; objects[1] = UserId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public GoalProfileSetupVo GetCustomerGoal(int CustomerId, int GoalId) { GoalProfileSetupVo GoalProfileVo = new GoalProfileSetupVo(); Database db; DbCommand getCustomerGoalCmd; DataSet getCustomerGoalDs; DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getCustomerGoalCmd = db.GetStoredProcCommand("SP_GetCustomerGoalProfile"); db.AddInParameter(getCustomerGoalCmd, "@CustomerId", DbType.Int32, CustomerId); db.AddInParameter(getCustomerGoalCmd, "@GoalId", DbType.Int32, GoalId); getCustomerGoalDs = db.ExecuteDataSet(getCustomerGoalCmd); if (getCustomerGoalDs.Tables[0].Rows.Count == 1) { dr = getCustomerGoalDs.Tables[0].Rows[0]; GoalProfileVo.GoalId = int.Parse(dr["CG_GoalId"].ToString()); GoalProfileVo.GoalDate = DateTime.Parse(dr["CG_GoalProfileDate"].ToString()); GoalProfileVo.GoalName = dr["XG_GoalName"].ToString(); GoalProfileVo.Goalcode = dr["XG_GoalCode"].ToString(); GoalProfileVo.GoalDescription = dr["CG_GoalDescription"].ToString(); GoalProfileVo.ChildName = dr["ChildName"].ToString(); GoalProfileVo.CostOfGoalToday = double.Parse(dr["CG_CostToday"].ToString()); GoalProfileVo.GoalYear = int.Parse(dr["CG_GoalYear"].ToString()); GoalProfileVo.CurrInvestementForGoal = double.Parse(dr["CG_CurrentInvestment"].ToString()); GoalProfileVo.ROIEarned = double.Parse(dr["CG_ROIEarned"].ToString()); GoalProfileVo.ExpectedROI = double.Parse(dr["CG_ExpectedROI"].ToString()); GoalProfileVo.InflationPercent = double.Parse(dr["CG_InflationPer"].ToString()); if (dr["CA_AssociateId"].ToString() != string.Empty) { GoalProfileVo.AssociateId = int.Parse(dr["CA_AssociateId"].ToString()); } if (dr["CG_ROIOnFuture"].ToString() != string.Empty) { GoalProfileVo.RateofInterestOnFture = double.Parse(dr["CG_ROIOnFuture"].ToString()); } else { GoalProfileVo.RateofInterestOnFture = 0; } GoalProfileVo.Comments = dr["CG_Comments"].ToString(); if (dr["CG_CustomerApprovedOn"].ToString() != string.Empty) { GoalProfileVo.CustomerApprovedOn = DateTime.Parse(dr["CG_CustomerApprovedOn"].ToString()); } else { GoalProfileVo.CustomerApprovedOn = DateTime.MinValue; } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupDao:GetCustomerGoal()"); object[] objects = new object[2]; objects[0] = CustomerId; objects[1] = GoalId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(GoalProfileVo); }
public List <GoalProfileSetupVo> GetCustomerGoalProfile(int CustomerId, int ActiveFlag) { DataSet ds = null; Database db; DbCommand getCustomerGoalProfileCmd; List <GoalProfileSetupVo> GoalProfileList = null; GoalProfileSetupVo GoalProfileVo = new GoalProfileSetupVo(); DataTable dtGoalProfile = new DataTable(); try { db = DatabaseFactory.CreateDatabase("wealtherp"); getCustomerGoalProfileCmd = db.GetStoredProcCommand("SP_GetCustomerGoalProfileDetails"); db.AddInParameter(getCustomerGoalProfileCmd, "@CustomerId", DbType.Int32, CustomerId); db.AddInParameter(getCustomerGoalProfileCmd, "@ActiveFlag", DbType.Int32, ActiveFlag); ds = db.ExecuteDataSet(getCustomerGoalProfileCmd); if (ds.Tables[0].Rows.Count > 0) { dtGoalProfile = ds.Tables[0]; GoalProfileList = new List <GoalProfileSetupVo>(); foreach (DataRow dr in dtGoalProfile.Rows) { GoalProfileVo = new GoalProfileSetupVo(); GoalProfileVo.GoalId = int.Parse(dr["CG_GoalId"].ToString()); GoalProfileVo.Goalcode = dr["XG_GoalCode"].ToString(); if (dr["XG_GoalName"].ToString() != string.Empty) { GoalProfileVo.GoalName = dr["XG_GoalName"].ToString(); } else { GoalProfileVo.GoalName = string.Empty; } GoalProfileVo.ChildName = dr["ChildName"].ToString(); GoalProfileVo.CostOfGoalToday = double.Parse(dr["CG_CostToday"].ToString()); GoalProfileVo.MonthlySavingsReq = double.Parse(dr["CG_MonthlySavingsRequired"].ToString()); GoalProfileVo.GoalProfileDate = DateTime.Parse(dr["CG_GoalProfileDate"].ToString()); GoalProfileVo.GoalYear = int.Parse(dr["CG_GoalYear"].ToString()); GoalProfileVo.IsActice = int.Parse(dr["CG_IsActive"].ToString()); if ((dr["CG_CustomerApprovedOn"].ToString()) != string.Empty) { GoalProfileVo.CustomerApprovedOn = DateTime.Parse(dr["CG_CustomerApprovedOn"].ToString()); } GoalProfileList.Add(GoalProfileVo); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerTransactionDao.cs:GetCustomerGoalProfile()"); object[] objects = new object[1]; objects[0] = CustomerId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(GoalProfileList); }
/// <summary> /// It retuns Customer Other Goals description paragrapgh /// </summary> /// <param name="CustomerId"></param> /// <returns></returns> public string OtherGoalDescriptionText(int CustomerId) { string GoalDescription = ""; List <GoalProfileSetupVo> GoalProfileList = new List <GoalProfileSetupVo>(); CustomerGoalSetupDao customerGoalProfileDao = new CustomerGoalSetupDao(); try { double totalChildEducation = 0; double totalChildMarriage = 0; double totalHome = 0; double totalOther = 0; string strMain = ""; string strChildEducation = ""; string strChildMarriage = ""; string strHome = ""; string strOther = ""; string strTotal = ""; GoalProfileList = customerGoalProfileDao.GetCustomerGoalProfile(CustomerId, 1); if (GoalProfileList != null) { for (int i = 0; i < GoalProfileList.Count; i++) { goalProfileSetupVo = new GoalProfileSetupVo(); goalProfileSetupVo = GoalProfileList[i]; if (goalProfileSetupVo.Goalcode == "BH") { totalHome = totalHome + goalProfileSetupVo.MonthlySavingsReq; } if (goalProfileSetupVo.Goalcode == "ED") { totalChildEducation = totalChildEducation + goalProfileSetupVo.MonthlySavingsReq; } if (goalProfileSetupVo.Goalcode == "MR") { totalChildMarriage = totalChildMarriage + goalProfileSetupVo.MonthlySavingsReq; } if (goalProfileSetupVo.Goalcode == "OT") { totalOther = totalOther + goalProfileSetupVo.MonthlySavingsReq; } } double TotalCost = totalChildEducation + totalChildMarriage + totalHome + totalOther; strMain = "Based on your inputs we have done an analysis of your life's major financial goals and savings required to achieve them."; if (totalChildEducation != 0) { strChildEducation = "You need to save Rs." + Math.Round(totalChildEducation, 2).ToString() + " to meet your children's higher education expenses."; } if (totalChildMarriage != 0) { strChildMarriage = "Your monthly saving should be Rs." + Math.Round(totalChildMarriage, 2).ToString() + " to meet your children's marriage expeneses."; } if (totalHome != 0) { strHome = "For buying house you need to save Rs." + Math.Round(totalHome, 2).ToString() + " every month."; } if (totalOther != 0) { strOther = "For other Goals you need to save Rs." + Math.Round(totalOther, 2).ToString() + " every month."; } strTotal = "To meet all your major life goals other than retirement you need to save Rs." + Math.Round(TotalCost, 2).ToString() + " every month."; GoalDescription = strMain + strChildEducation + strChildMarriage + strHome + strOther + strTotal; } else { GoalDescription = ""; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:GetCustomerGoalProfile()"); object[] objects = new object[1]; objects[0] = CustomerId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(GoalDescription); }
public GoalProfileSetupVo CalculateGoalProfileRT(GoalProfileSetupVo GoalProfileVo) { CustomerGoalSetupDao CustomerGoalDao = new CustomerGoalSetupDao(); int yearsLeft = 0; int targetRetirementYear = 0; double amountRequired = 0; double futureValue = 0; double retirementCorpus = 0; double monthlySavings = 0; double lumpsumInvestRequired = 0; double InflationPercent = GoalProfileVo.InflationPercent; double InflationValue = InflationPercent / 100; try { double annualRequirement = GoalProfileVo.CostOfGoalToday; double currentValue = GoalProfileVo.CurrInvestementForGoal; double exRate = GoalProfileVo.ROIEarned / 100; double newRate = GoalProfileVo.ExpectedROI / 100; double retRetirementCorpus = GoalProfileVo.RateofInterestOnFture / 100; if (GoalProfileVo.GoalYear != 0) { targetRetirementYear = GoalProfileVo.GoalYear; yearsLeft = targetRetirementYear - DateTime.Now.Year; } amountRequired = annualRequirement / retRetirementCorpus; if (currentValue == 0 && exRate == 0) { futureValue = 0; } else { futureValue = Math.Abs(FutureValue(exRate, yearsLeft, 0, currentValue, 0)); } retirementCorpus = Math.Abs(FutureValue(InflationValue, yearsLeft, 0, amountRequired, 0)); monthlySavings = Math.Abs(PMT((newRate / 12), (yearsLeft * 12), 0, (retirementCorpus - futureValue), 0)); lumpsumInvestRequired = Math.Abs(PV(newRate, yearsLeft, 0, -(retirementCorpus - futureValue), 0)); GoalProfileVo.FutureValueOnCurrentInvest = futureValue; GoalProfileVo.FutureValueOfCostToday = retirementCorpus; GoalProfileVo.MonthlySavingsReq = monthlySavings; GoalProfileVo.InflationPercent = InflationPercent; GoalProfileVo.LumpsumInvestRequired = lumpsumInvestRequired; return(GoalProfileVo); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:CreateCustomerGoalProfileForRetirement()"); object[] objects = new object[1]; objects[0] = GoalProfileVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public GoalProfileSetupVo CalculateGoalProfile(GoalProfileSetupVo GoalProfileVo) { double futureInvValue = 0; double futureCost = 0; double requiredSavings = 0; double costToday = 0; double requiredAfter = 0; double currentValue = 0; double rateEarned = 0; double rateOfReturn = 0; double inflationValues = 0; string goal = string.Empty; CustomerGoalSetupDao CustomerGoalDao = new CustomerGoalSetupDao(); double InflationPercent = GoalProfileVo.InflationPercent; try { costToday = GoalProfileVo.CostOfGoalToday; // requiredAfter = GoalProfileVo.GoalYear; requiredAfter = GoalProfileVo.GoalYear - DateTime.Today.Year; currentValue = GoalProfileVo.CurrInvestementForGoal; rateEarned = GoalProfileVo.ROIEarned / 100; rateOfReturn = GoalProfileVo.ExpectedROI / 100; inflationValues = (Double)InflationPercent / 100; futureCost = Math.Abs(FutureValue(inflationValues, requiredAfter, 0, costToday, 0)); if (currentValue == 0 && rateEarned == 0) { futureInvValue = 0; } else { futureInvValue = Math.Abs(FutureValue(rateEarned, requiredAfter, 0, currentValue, 0)); } requiredSavings = Math.Abs(PMT((rateOfReturn / 12), (requiredAfter * 12), 0, (futureCost - futureInvValue), 0)); GoalProfileVo.MonthlySavingsReq = requiredSavings; GoalProfileVo.InflationPercent = (Double)InflationPercent; GoalProfileVo.FutureValueOfCostToday = (Double)futureCost; return(GoalProfileVo); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerGoalSetupBo.cs:CalculateGoalProfile()"); object[] objects = new object[1]; objects[0] = GoalProfileVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public List <GoalProfileSetupVo> GetCustomerGoalProfile(int CustomerId, int ActiveFlag, out int investmentTotal, out int surplusTotal, out int investedAmountForAllGaol, out int monthlySavingRequired) { DataSet ds = null; Database db; DbCommand getCustomerGoalProfileCmd; List <GoalProfileSetupVo> GoalProfileList = null; GoalProfileSetupVo GoalProfileVo = new GoalProfileSetupVo(); DataTable dtGoalProfile = new DataTable(); DataTable dtGoalFund = new DataTable(); DataRow[] drGoalFundingDetails; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getCustomerGoalProfileCmd = db.GetStoredProcCommand("SP_GetCustomerGoalProfileDetails"); db.AddInParameter(getCustomerGoalProfileCmd, "@CustomerId", DbType.Int32, CustomerId); db.AddInParameter(getCustomerGoalProfileCmd, "@ActiveFlag", DbType.Int32, ActiveFlag); db.AddOutParameter(getCustomerGoalProfileCmd, "@InvestmentTotal", DbType.Int32, 20); db.AddOutParameter(getCustomerGoalProfileCmd, "@SurplusTotal", DbType.Int32, 20); db.AddOutParameter(getCustomerGoalProfileCmd, "@InvestedAmountForAllGaol", DbType.Int32, 20); db.AddOutParameter(getCustomerGoalProfileCmd, "@MonthlySavingTotal", DbType.Int32, 20); getCustomerGoalProfileCmd.CommandTimeout = 60 * 60; ds = db.ExecuteDataSet(getCustomerGoalProfileCmd); //dtGoalFund = ds.Tables[1]; Object objInvestmentTotal = db.GetParameterValue(getCustomerGoalProfileCmd, "@InvestmentTotal"); if (objInvestmentTotal != DBNull.Value) { investmentTotal = (int)db.GetParameterValue(getCustomerGoalProfileCmd, "@InvestmentTotal"); } else { investmentTotal = 0; } Object objSurplusTotal = db.GetParameterValue(getCustomerGoalProfileCmd, "@SurplusTotal"); if (objSurplusTotal != DBNull.Value) { surplusTotal = (int)db.GetParameterValue(getCustomerGoalProfileCmd, "@SurplusTotal"); } else { surplusTotal = 0; } Object objInvestedAmountTotal = db.GetParameterValue(getCustomerGoalProfileCmd, "@InvestedAmountForAllGaol"); if (objInvestedAmountTotal != DBNull.Value) { investedAmountForAllGaol = (int)db.GetParameterValue(getCustomerGoalProfileCmd, "@InvestedAmountForAllGaol"); } else { investedAmountForAllGaol = 0; } Object objMonthlySavingTotal = db.GetParameterValue(getCustomerGoalProfileCmd, "@MonthlySavingTotal"); if (objMonthlySavingTotal != DBNull.Value) { monthlySavingRequired = (int)db.GetParameterValue(getCustomerGoalProfileCmd, "@MonthlySavingTotal"); } else { monthlySavingRequired = 0; } if (ds.Tables[0].Rows.Count > 0) { dtGoalProfile = ds.Tables[0]; GoalProfileList = new List <GoalProfileSetupVo>(); foreach (DataRow dr in dtGoalProfile.Rows) { GoalProfileVo = new GoalProfileSetupVo(); GoalProfileVo.GoalId = int.Parse(dr["CG_GoalId"].ToString()); GoalProfileVo.Goalcode = dr["XG_GoalCode"].ToString(); if (dr["XG_GoalName"].ToString() != string.Empty) { GoalProfileVo.GoalName = dr["XG_GoalName"].ToString(); } else { GoalProfileVo.GoalName = string.Empty; } GoalProfileVo.ChildName = dr["ChildName"].ToString(); GoalProfileVo.CostOfGoalToday = double.Parse(dr["CG_CostToday"].ToString()); if (!string.IsNullOrEmpty(Convert.ToString(dr["CG_CurrentInvestment"]))) { GoalProfileVo.CurrInvestementForGoal = double.Parse(dr["CG_CurrentInvestment"].ToString()); } GoalProfileVo.MonthlySavingsReq = double.Parse(dr["CG_MonthlySavingsRequired"].ToString()); if (!string.IsNullOrEmpty(dr["CG_FVofCostToday"].ToString())) { GoalProfileVo.FutureValueOfCostToday = double.Parse(dr["CG_FVofCostToday"].ToString()); } GoalProfileVo.GoalProfileDate = DateTime.Parse(dr["CG_GoalProfileDate"].ToString()); GoalProfileVo.GoalYear = int.Parse(dr["CG_GoalYear"].ToString()); GoalProfileVo.IsActice = int.Parse(dr["CG_IsActive"].ToString()); GoalProfileVo.ExpectedROI = double.Parse(dr["CG_ExpectedROI"].ToString()); if (!string.IsNullOrEmpty(dr["CG_LumpsumInvestmentRequired"].ToString())) { GoalProfileVo.LumpsumInvestRequired = double.Parse(dr["CG_LumpsumInvestmentRequired"].ToString()); } if ((dr["CG_CustomerApprovedOn"].ToString()) != string.Empty) { GoalProfileVo.CustomerApprovedOn = DateTime.Parse(dr["CG_CustomerApprovedOn"].ToString()); } if (dr["CG_IsFundFromAsset"] != null) { if (int.Parse(dr["CG_IsFundFromAsset"].ToString()) == 1) { GoalProfileVo.IsFundFromAsset = true; } } if (!string.IsNullOrEmpty(dr["CG_ROIEarned"].ToString())) { GoalProfileVo.ROIEarned = Convert.ToDouble(dr["CG_ROIEarned"].ToString()); } if (!string.IsNullOrEmpty(dr["CG_InflationPer"].ToString())) { GoalProfileVo.InflationPercent = Convert.ToDouble(dr["CG_InflationPer"].ToString()); } //drGoalFundingDetails = new DataRow[dtGoalFund.Rows.Count]; //if (dtGoalFund.Rows.Count > 0) //{ // drGoalFundingDetails = dtGoalFund.Select("CG_GoalId=" + GoalProfileVo.GoalId.ToString()); // if (drGoalFundingDetails.Count() > 0) // { // if (GoalProfileVo.CurrInvestementForGoal != 0) // GoalProfileVo.CurrInvestementForGoal = Convert.ToDouble(drGoalFundingDetails[0][1].ToString()); // GoalProfileVo.CurrentGoalValue = Convert.ToDouble(drGoalFundingDetails[0][2].ToString()); // GoalProfileVo.GoalCompletionPercent = (GoalProfileVo.CurrentGoalValue / GoalProfileVo.CostOfGoalToday) * 100; // } //} GoalProfileList.Add(GoalProfileVo); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerTransactionDao.cs:GetCustomerGoalProfile()"); object[] objects = new object[1]; objects[0] = CustomerId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(GoalProfileList); }