protected void Page_Load(object sender, EventArgs e) { try { SessionBo.CheckSession(); collectiblesVo = (CollectiblesVo)Session["collectiblesVo"]; LoadFields(); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioCollectiblesView.ascx:Page_Load()"); object[] objects = new object[1]; objects[0] = collectiblesVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public CollectiblesVo GetCollectiblesAsset(int collectibleId) { CollectiblesDao collectiblesDao = new CollectiblesDao(); CollectiblesVo collectiblesVo = new CollectiblesVo(); try { collectiblesVo = collectiblesDao.GetCollectibleAsset(collectibleId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CollectiblesBo.cs:GetCollectiblesAsset()"); object[] objects = new object[1]; objects[0] = collectibleId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(collectiblesVo); }
public bool CreateCollectiblesPortfolio(CollectiblesVo collectiblesVo, int userId) { CollectiblesDao collectiblesDao = new CollectiblesDao(); bool bResult = false; try { bResult = collectiblesDao.CreateCollectiblesPortfolio(collectiblesVo, userId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CollectiblesBo.cs:CreateCollectiblesPortfolio()"); object[] objects = new object[2]; objects[0] = collectiblesVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
public bool CreateCollectiblesPortfolio(CollectiblesVo collectibleVo, int userId) { bool bResult = false; Database db; DbCommand createCollectiblePortfolioCmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); createCollectiblePortfolioCmd = db.GetStoredProcCommand("SP_CreateCollectiblesNetPosition"); db.AddInParameter(createCollectiblePortfolioCmd, "@CP_PortfolioId", DbType.Int32, collectibleVo.PortfolioId); db.AddInParameter(createCollectiblePortfolioCmd, "@PAIC_AssetInstrumentCategoryCode", DbType.String, collectibleVo.AssetCategoryCode); db.AddInParameter(createCollectiblePortfolioCmd, "@PAG_AssetGroupCode", DbType.String, collectibleVo.AssetGroupCode); db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_Name", DbType.String, collectibleVo.Name); if (collectibleVo.PurchaseDate != DateTime.MinValue) { db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_PurchaseDate", DbType.DateTime, collectibleVo.PurchaseDate); } else { db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_PurchaseDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_PurchaseValue", DbType.Decimal, collectibleVo.PurchaseValue); db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_CurrentValue", DbType.Decimal, collectibleVo.CurrentValue); db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_Remark", DbType.String, collectibleVo.Remark); db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_CreatedBy", DbType.Int32, userId); db.AddInParameter(createCollectiblePortfolioCmd, "@CCNP_ModifiedBy", DbType.Int32, userId); if (db.ExecuteNonQuery(createCollectiblePortfolioCmd) != 0) { bResult = true; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CollectibleDao.cs:SP_CreateCollectiblesNetPosition()"); object[] objects = new object[2]; objects[0] = collectibleVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
protected void btnSaveChanges_Click(object sender, EventArgs e) { CollectiblesVo newCollectibleVo = new CollectiblesVo(); try { newCollectibleVo = new CollectiblesVo(); CollectiblesVo collectibleVo = (CollectiblesVo)Session["collectiblesVo"]; newCollectibleVo.AssetGroupCode = "CL"; newCollectibleVo.AssetCategoryCode = ddlCategory.SelectedItem.Value.ToString(); newCollectibleVo.CollectibleId = collectibleVo.CollectibleId; //newCollectibleVo.CurrentPrice=float.Parse( newCollectibleVo.CurrentValue = float.Parse(txtCurrentValue.Text.ToString()); newCollectibleVo.PortfolioId = collectibleVo.PortfolioId; newCollectibleVo.Name = txtName.Text; if (txtPurchaseDate.Text.ToString() != string.Empty) { newCollectibleVo.PurchaseDate = DateTime.Parse(txtPurchaseDate.Text.Trim()); } else { newCollectibleVo.PurchaseDate = DateTime.MinValue; } if (txtPurchaseValue.Text.ToString() != string.Empty) { newCollectibleVo.PurchaseValue = float.Parse(txtPurchaseValue.Text.ToString()); } else { newCollectibleVo.PurchaseValue = 0; } newCollectibleVo.Remark = txtRemarks.Text.ToString(); collectiblesBo.UpdateCollectiblesPortfolio(newCollectibleVo, userVo.UserId); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('ViewCollectiblesPortfolio','none');", true); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioCollectiblesEntry.ascx:btnSaveChanges_Click()"); object[] objects = new object[1]; objects[0] = newCollectibleVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void lnkEdit_Click(object sender, EventArgs e) { CollectiblesVo collectibleVo = new CollectiblesVo(); try { collectibleVo = (CollectiblesVo)Session["collectiblesVo"]; txtCurrentValue.Text = collectibleVo.CurrentValue.ToString(); txtCurrentValue.Enabled = true; txtName.Text = collectibleVo.Name.ToString(); txtName.Enabled = true; txtPurchaseValue.Text = collectibleVo.PurchaseValue.ToString(); txtPurchaseValue.Enabled = true; txtRemarks.Text = collectibleVo.Remark.ToString(); txtRemarks.Enabled = true; if (collectibleVo.PurchaseDate != DateTime.MinValue) { txtPurchaseDate.Text = collectibleVo.PurchaseDate.ToShortDateString().ToString(); } else { txtPurchaseDate.Text = ""; } ddlCategory.Items.Insert(0, collectibleVo.AssetCategoryCode.ToString()); LoadCategory(); ddlCategory.Enabled = true; btnSaveChanges.Visible = true; lnkEdit.Visible = false; txtPurchaseDate.Enabled = true; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioCollectiblesEntry.ascx:btnSubmit_Click()"); object[] objects = new object[1]; objects[0] = collectibleVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public List <CollectiblesVo> GetCollectiblesPortfolio(int PortfolioId, int CurrentPage, string sortOrder, out int count) { List <CollectiblesVo> collectiblesList = null; CollectiblesVo collectiblesVo; Database db; DbCommand getCollectiblesPortfolioCmd; DataSet dsGetCollectiblesPortfolio; DataTable dtGetCollectiblesPortfolio; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getCollectiblesPortfolioCmd = db.GetStoredProcCommand("SP_GetCollectiblesNetPosition"); db.AddInParameter(getCollectiblesPortfolioCmd, "@CP_PortfolioId", DbType.Int32, PortfolioId); db.AddInParameter(getCollectiblesPortfolioCmd, "@CurrentPage", DbType.Int32, CurrentPage); db.AddInParameter(getCollectiblesPortfolioCmd, "@sortOrder", DbType.String, sortOrder); dsGetCollectiblesPortfolio = db.ExecuteDataSet(getCollectiblesPortfolioCmd); dtGetCollectiblesPortfolio = dsGetCollectiblesPortfolio.Tables[0]; if (dsGetCollectiblesPortfolio.Tables[1] != null && dsGetCollectiblesPortfolio.Tables[1].Rows.Count > 0) { count = Int32.Parse(dsGetCollectiblesPortfolio.Tables[1].Rows[0][0].ToString()); } else { count = 0; } if (dsGetCollectiblesPortfolio.Tables[0].Rows.Count > 0) { collectiblesList = new List <CollectiblesVo>(); foreach (DataRow dr in dtGetCollectiblesPortfolio.Rows) { collectiblesVo = new CollectiblesVo(); collectiblesVo.PortfolioId = int.Parse(dr["CP_PortfolioId"].ToString()); collectiblesVo.CollectibleId = int.Parse(dr["CCNP_CollectibleNPId"].ToString()); collectiblesVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); collectiblesVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); collectiblesVo.Name = dr["CCNP_Name"].ToString(); if (dr["CCNP_PurchaseDate"].ToString() != string.Empty) { collectiblesVo.PurchaseDate = DateTime.Parse(dr["CCNP_PurchaseDate"].ToString()); } collectiblesVo.PurchaseValue = float.Parse(dr["CCNP_PurchaseValue"].ToString()); collectiblesVo.CurrentValue = float.Parse(dr["CCNP_CurrentValue"].ToString()); collectiblesVo.Remark = dr["CCNP_Remark"].ToString(); collectiblesVo.AssetCategoryName = dr["PAIC_AssetInstrumentCategoryName"].ToString(); collectiblesList.Add(collectiblesVo); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CollectiblesDao.cs:SP_GetCollectiblesNetPosition()"); object[] objects = new object[1]; objects[0] = PortfolioId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(collectiblesList); }
public CollectiblesVo GetCollectibleAsset(int collectibleId) { CollectiblesVo collectiblesVo = null; Database db; DbCommand getCollectiblesPortfolioCmd; DataSet dsGetCollectiblesPortfolio; DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getCollectiblesPortfolioCmd = db.GetStoredProcCommand("SP_GetCollectibleAsset"); db.AddInParameter(getCollectiblesPortfolioCmd, "@CCNP_CollectibleNPId", DbType.Int32, collectibleId); dsGetCollectiblesPortfolio = db.ExecuteDataSet(getCollectiblesPortfolioCmd); if (dsGetCollectiblesPortfolio.Tables[0].Rows.Count > 0) { dr = dsGetCollectiblesPortfolio.Tables[0].Rows[0]; collectiblesVo = new CollectiblesVo(); collectiblesVo.PortfolioId = int.Parse(dr["CP_PortfolioId"].ToString()); collectiblesVo.CollectibleId = int.Parse(dr["CCNP_CollectibleNPId"].ToString()); collectiblesVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); collectiblesVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); collectiblesVo.Name = dr["CCNP_Name"].ToString(); if (dr["CCNP_PurchaseDate"].ToString() != string.Empty) { collectiblesVo.PurchaseDate = DateTime.Parse(dr["CCNP_PurchaseDate"].ToString()); } // collectiblesVo.PurchasePrice = float.Parse(dr["CCNP_PurchasePrice"].ToString()); //collectiblesVo.Quantity = float.Parse(dr["CCNP_Quantity"].ToString()); collectiblesVo.PurchaseValue = float.Parse(dr["CCNP_PurchaseValue"].ToString()); //collectiblesVo.CurrentPrice = float.Parse(dr["CCNP_CurrentPrice"].ToString()); collectiblesVo.CurrentValue = float.Parse(dr["CCNP_CurrentValue"].ToString()); collectiblesVo.Remark = dr["CCNP_Remark"].ToString(); collectiblesVo.AssetCategoryName = dr["PAIC_AssetInstrumentCategoryName"].ToString(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "CollectiblesDao.cs:GetCollectibleAsset()"); object[] objects = new object[1]; objects[0] = collectibleId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(collectiblesVo); }
protected void BindData() { try { int count; customerVo = (CustomerVo)Session["CustomerVo"]; collectiblesList = collectiblesBo.GetCollectiblesPortfolio(portfolioId, mypager.CurrentPage, hdnSort.Value, out count); if (count > 0) { DivPager.Style.Add("display", "visible"); } lblTotalRows.Text = hdnRecordCount.Value = count.ToString(); if (collectiblesList == null) { lblMessage.Visible = true; lblCurrentPage.Visible = false; lblTotalRows.Visible = false; DivPager.Visible = false; gvCollectiblesPortfolio.DataSource = null; gvCollectiblesPortfolio.DataBind(); } else { lblMessage.Visible = false; lblTotalRows.Visible = true; lblCurrentPage.Visible = true; DivPager.Visible = true; DataTable dtCollectiblesPortfolio = new DataTable(); dtCollectiblesPortfolio.Columns.Add("CollectibleId"); dtCollectiblesPortfolio.Columns.Add("Instrument Category"); dtCollectiblesPortfolio.Columns.Add("Particulars"); dtCollectiblesPortfolio.Columns.Add("Purchase Date"); dtCollectiblesPortfolio.Columns.Add("Purchase Value"); dtCollectiblesPortfolio.Columns.Add("Current Value"); dtCollectiblesPortfolio.Columns.Add("Remarks"); DataRow drCollectiblesPortfolio; for (int i = 0; i < collectiblesList.Count; i++) { drCollectiblesPortfolio = dtCollectiblesPortfolio.NewRow(); collectiblesVo = new CollectiblesVo(); collectiblesVo = collectiblesList[i]; drCollectiblesPortfolio[0] = collectiblesVo.CollectibleId.ToString(); drCollectiblesPortfolio[1] = collectiblesVo.AssetCategoryName.ToString(); drCollectiblesPortfolio[2] = collectiblesVo.Name.ToString(); if (collectiblesVo.PurchaseDate != DateTime.MinValue) { drCollectiblesPortfolio[3] = collectiblesVo.PurchaseDate.ToShortDateString().ToString(); } else { drCollectiblesPortfolio[3] = " "; } if (collectiblesVo.PurchaseValue.ToString() != "") { drCollectiblesPortfolio[4] = String.Format("{0:n2}", decimal.Parse(collectiblesVo.PurchaseValue.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"))); } else { drCollectiblesPortfolio[4] = "0"; } drCollectiblesPortfolio[5] = String.Format("{0:n2}", decimal.Parse(collectiblesVo.CurrentValue.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"))); drCollectiblesPortfolio[6] = collectiblesVo.Remark.ToString(); dtCollectiblesPortfolio.Rows.Add(drCollectiblesPortfolio); } gvCollectiblesPortfolio.DataSource = dtCollectiblesPortfolio; gvCollectiblesPortfolio.DataBind(); this.GetPageCount(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ViewCollectiblesPortfolio.ascx:Page_Load()"); object[] objects = new object[3]; objects[0] = customerVo; objects[1] = collectiblesVo; objects[2] = collectiblesList; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }