/// <summary> /// Used to Get Customer FP Asset Instrument Details /// </summary> /// <param name="customerId"></param> /// <param name="totalAssetDetails"></param> /// <returns></returns> public List <CustomerProspectAssetDetailsVo> GetCustomerFPAssetInstrumentDetails(DataTable dtCustomerAssetInstrumentDetails) { CustomerProspectDao customerprospectdao = new CustomerProspectDao(); CustomerProspectAssetDetailsVo customerprospectassetdetailsvo; List <CustomerProspectAssetDetailsVo> customerprospectassetdetailsvolist = new List <CustomerProspectAssetDetailsVo>(); try { for (int i = 0; i < dtCustomerAssetInstrumentDetails.Rows.Count; i++) { customerprospectassetdetailsvo = new CustomerProspectAssetDetailsVo(); customerprospectassetdetailsvo.InstrumentDetailsId = int.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_FPInstrumentDetailsId"].ToString()); customerprospectassetdetailsvo.AssetGroupCode = dtCustomerAssetInstrumentDetails.Rows[i]["PAG_AssetGroupCode"].ToString(); customerprospectassetdetailsvo.AssetInstrumentCategoryCode = dtCustomerAssetInstrumentDetails.Rows[i]["PAIC_AssetInstrumentCategoryCode"].ToString(); if (dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_AdjustedValue"] != null && dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_AdjustedValue"].ToString() != "") { customerprospectassetdetailsvo.AdjustedValue = double.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_AdjustedValue"].ToString()); } if (dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_TotalValue"] != null && dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_TotalValue"].ToString() != "") { customerprospectassetdetailsvo.Value = double.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_TotalValue"].ToString()); } if (dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_MaturityDate"] != null && dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_MaturityDate"].ToString() != "") { customerprospectassetdetailsvo.MaturityDate = DateTime.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_MaturityDate"].ToString()); } if (dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_Premium"] != null && dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_Premium"].ToString() != "") { customerprospectassetdetailsvo.Premium = double.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_Premium"].ToString()); } if (dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_SurrenderMarketValue"] != null && dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_SurrenderMarketValue"].ToString() != "") { customerprospectassetdetailsvo.SurrMktVal = double.Parse(dtCustomerAssetInstrumentDetails.Rows[i]["CFPAID_SurrenderMarketValue"].ToString()); } customerprospectassetdetailsvolist.Add(customerprospectassetdetailsvo); } } catch (Exception ex) { throw ex; } return(customerprospectassetdetailsvolist); }
/// <summary> /// Used to Get Customer FP Asset Instrument Details /// </summary> /// <param name="customerId"></param> /// <param name="totalAssetDetails"></param> /// <returns></returns> public List <CustomerProspectAssetDetailsVo> GetCustomerFPAssetInstrumentDetails(int customerId) { DataSet dsCustomerAssetInstrumentDetails = null; CustomerProspectDao customerprospectdao = new CustomerProspectDao(); CustomerProspectAssetDetailsVo customerprospectassetdetailsvo; List <CustomerProspectAssetDetailsVo> customerprospectassetdetailsvolist = new List <CustomerProspectAssetDetailsVo>(); try { dsCustomerAssetInstrumentDetails = customerprospectdao.GetCustomerFPAssetInstrumentDetails(customerId); for (int i = 0; i < dsCustomerAssetInstrumentDetails.Tables[0].Rows.Count; i++) { customerprospectassetdetailsvo = new CustomerProspectAssetDetailsVo(); customerprospectassetdetailsvo.InstrumentDetailsId = int.Parse(dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_FPInstrumentDetailsId"].ToString()); customerprospectassetdetailsvo.AssetGroupCode = dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["PAG_AssetGroupCode"].ToString(); customerprospectassetdetailsvo.AssetInstrumentCategoryCode = dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["PAIC_AssetInstrumentCategoryCode"].ToString(); if (dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Value"] != null && dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Value"].ToString() != "") { customerprospectassetdetailsvo.Value = double.Parse(dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Value"].ToString()); } if (dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_MaturityDate"] != null && dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_MaturityDate"].ToString() != "") { customerprospectassetdetailsvo.MaturityDate = DateTime.Parse(dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_MaturityDate"].ToString()); } if (dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Premium"] != null && dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Premium"].ToString() != "") { customerprospectassetdetailsvo.Premium = double.Parse(dsCustomerAssetInstrumentDetails.Tables[0].Rows[i]["CFPAID_Premium"].ToString()); } customerprospectassetdetailsvolist.Add(customerprospectassetdetailsvo); } } catch (Exception ex) { throw ex; } return(customerprospectassetdetailsvolist); }
/// <summary> /// Used to Update Customer FP Asset Instrument Details /// </summary> /// <param name="customerId"></param> /// <param name="userId"></param> /// <param name="customerProspectAssetDetailsVo"></param> /// <returns></returns> public bool UpdateCustomerFPAssetInstrumentDetails(int customerId, int userId, CustomerProspectAssetDetailsVo customerProspectAssetDetailsVo) { Database db; DbCommand cmdUpdateCustomerFPAssetInstrumentDetails; bool bAssetResult = false; try { db = DatabaseFactory.CreateDatabase("wealtherp"); //Adding Data to the table cmdUpdateCustomerFPAssetInstrumentDetails = db.GetStoredProcCommand("SP_AddCustomerFPAssetInstrumentDetails"); db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@C_CustomerId", DbType.Int32, customerId); if (customerProspectAssetDetailsVo.AssetGroupCode != null) { db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@PAG_AssetGroupCode", DbType.String, customerProspectAssetDetailsVo.AssetGroupCode); } if (customerProspectAssetDetailsVo.AssetInstrumentCategoryCode != null) { db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@PAIC_AssetInstrumentCategoryCode", DbType.String, customerProspectAssetDetailsVo.AssetInstrumentCategoryCode); } if (customerProspectAssetDetailsVo.InstrumentDetailsId != 0) { db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@CFPAID_FPInstrumentDetailsId", DbType.Int32, customerProspectAssetDetailsVo.InstrumentDetailsId); } if (customerProspectAssetDetailsVo.Value != 0.0) { db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@CFPAID_Value", DbType.Decimal, customerProspectAssetDetailsVo.Value); } else { db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@CFPAID_Value", DbType.Decimal, 0.0); } db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@CFPAID_MaturityDate", DbType.DateTime, customerProspectAssetDetailsVo.MaturityDate); db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@CFPAID_Premium", DbType.Decimal, customerProspectAssetDetailsVo.Premium); db.AddInParameter(cmdUpdateCustomerFPAssetInstrumentDetails, "@U_UserId", DbType.Int32, userId); if (db.ExecuteNonQuery(cmdUpdateCustomerFPAssetInstrumentDetails) != 0) { bAssetResult = true; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CustomerProspectDao.cs:UpdateCustomerFPAssetInstrumentDetails(int customerId, int userId, CustomerProspectAssetDetailsVo customerProspectAssetDetailsVo)"); object[] objects = new object[2]; objects[0] = customerId; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bAssetResult); }