/// <summary> /// Used to Get Customer FP Asset Sub Instrument Details /// </summary> /// <param name="customerId"></param> /// <param name="totalAssetSubDetails"></param> /// <returns></returns> public List <CustomerProspectAssetSubDetailsVo> GetCustomerFPAssetSubInstrumentDetails(DataTable dtCustomerAssetSubInstrumentDetails) { CustomerProspectDao customerprospectdao = new CustomerProspectDao(); CustomerProspectAssetSubDetailsVo customerprospectassetsubdetailsvo; List <CustomerProspectAssetSubDetailsVo> customerprospectassetsubdetailsvolist = new List <CustomerProspectAssetSubDetailsVo>(); try { if (dtCustomerAssetSubInstrumentDetails != null && dtCustomerAssetSubInstrumentDetails.Rows.Count > 0) { for (int i = 0; i < dtCustomerAssetSubInstrumentDetails.Rows.Count; i++) { customerprospectassetsubdetailsvo = new CustomerProspectAssetSubDetailsVo(); customerprospectassetsubdetailsvo.SubInstrumentDetailsId = int.Parse(dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_FPSubInstrumentDetailsId"].ToString()); customerprospectassetsubdetailsvo.AssetGroupCode = dtCustomerAssetSubInstrumentDetails.Rows[i]["PAG_AssetGroupCode"].ToString(); customerprospectassetsubdetailsvo.AssetInstrumentCategoryCode = dtCustomerAssetSubInstrumentDetails.Rows[i]["PAIC_AssetInstrumentCategoryCode"].ToString(); customerprospectassetsubdetailsvo.AssetInstrumentSubCategoryCode = dtCustomerAssetSubInstrumentDetails.Rows[i]["PAISC_AssetInstrumentSubCategoryCode"].ToString(); if (dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_AdjustedValue"] != null && dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_AdjustedValue"].ToString() != "") { customerprospectassetsubdetailsvo.AdjustedValue = double.Parse(dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_AdjustedValue"].ToString()); } if (dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_TotalValue"] != null && dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_TotalValue"].ToString() != "") { customerprospectassetsubdetailsvo.Value = double.Parse(dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_TotalValue"].ToString()); } if (dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_MaturityDate"] != null && dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_MaturityDate"].ToString() != "") { customerprospectassetsubdetailsvo.MaturityDate = DateTime.Parse(dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_MaturityDate"].ToString()); } if (dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_Premium"] != null && dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_Premium"].ToString() != "") { customerprospectassetsubdetailsvo.Premium = double.Parse(dtCustomerAssetSubInstrumentDetails.Rows[i]["CFPASID_Premium"].ToString()); } customerprospectassetsubdetailsvolist.Add(customerprospectassetsubdetailsvo); } } } catch (Exception ex) { throw ex; } return(customerprospectassetsubdetailsvolist); }
/// <summary> /// Used to Update Customer FP Asset Sub Instrument Details /// </summary> /// <param name="customerId"></param> /// <param name="userId"></param> /// <param name="customerProspectAssetSubDetailsVo"></param> /// <returns></returns> public bool UpdateCustomerFPAssetSubInstrumentDetails(int customerId, int userId, CustomerProspectAssetSubDetailsVo customerProspectAssetSubDetailsVo) { Database db; DbCommand cmdUpdateCustomerFPAssetSubInstrumentDetails; bool bAssetSubResult = false; try { db = DatabaseFactory.CreateDatabase("wealtherp"); //Adding Data to the table cmdUpdateCustomerFPAssetSubInstrumentDetails = db.GetStoredProcCommand("SP_UpdateCustomerFPAssetSubInstrumentDetails"); db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@C_CustomerId", DbType.Int32, customerId); if (customerProspectAssetSubDetailsVo.AssetGroupCode != null) { db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@PAG_AssetGroupCode", DbType.String, customerProspectAssetSubDetailsVo.AssetGroupCode); } if (customerProspectAssetSubDetailsVo.AssetInstrumentCategoryCode != null) { db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@PAIC_AssetInstrumentCategoryCode", DbType.String, customerProspectAssetSubDetailsVo.AssetInstrumentCategoryCode); } if (customerProspectAssetSubDetailsVo.AssetInstrumentSubCategoryCode != null) { db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@PAISC_AssetInstrumentSubCategoryCode", DbType.String, customerProspectAssetSubDetailsVo.AssetInstrumentSubCategoryCode); } if (customerProspectAssetSubDetailsVo.Value != 0) { db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@CFPASID_Value", DbType.Decimal, customerProspectAssetSubDetailsVo.Value); } else { db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@CFPASID_Value", DbType.Decimal, 0.0); } db.AddInParameter(cmdUpdateCustomerFPAssetSubInstrumentDetails, "@U_UserId", DbType.Int32, userId); if (db.ExecuteNonQuery(cmdUpdateCustomerFPAssetSubInstrumentDetails) != 0) { bAssetSubResult = 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:UpdateCustomerFPAssetSubInstrumentDetails(int customerId, int userId, CustomerProspectAssetSubDetailsVo customerProspectAssetSubDetailsVo)"); 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(bAssetSubResult); }