public GoldVo GetGoldAsset(int GoldNPId) { GoldDao goldDao = new GoldDao(); GoldVo goldVo = new GoldVo(); try { goldVo = goldDao.GetGoldAsset(GoldNPId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "GoldBo.cs:GetGoldAsset()"); object[] objects = new object[1]; objects[0] = GoldNPId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(goldVo); }
public bool CreateGoldNetPosition(GoldVo goldVo, int userId) { GoldDao goldDao = new GoldDao(); bool bResult = false; try { bResult = goldDao.CreateGoldNetPosition(goldVo, userId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "GoldBo.cs:CreateGoldNetPosition()"); object[] objects = new object[2]; objects[0] = goldVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
protected void BindData() { try { customerVo = (CustomerVo)Session["CustomerVo"]; int count; goldList = goldBo.GetGoldNetPosition(portfolioId, mypager.CurrentPage, hdnSort.Value, out count); lblTotalRows.Text = hdnRecordCount.Value = count.ToString(); if (count > 0) { DivPager.Style.Add("display", "visible"); } if (goldList == null) { lblMessage.Visible = true; lblCurrentPage.Visible = false; lblTotalRows.Visible = false; gvGoldPortfolio.DataSource = null; gvGoldPortfolio.DataBind(); } else { lblMessage.Visible = false; lblTotalRows.Visible = true; lblCurrentPage.Visible = true; DataTable dtGoldPortfolio = new DataTable(); dtGoldPortfolio.Columns.Add("GoldNPId"); dtGoldPortfolio.Columns.Add("Instrument Category"); dtGoldPortfolio.Columns.Add("Purchase Date"); dtGoldPortfolio.Columns.Add("Purchase Value"); dtGoldPortfolio.Columns.Add("Current Value"); dtGoldPortfolio.Columns.Add("Remarks"); DataRow drGoldPortfolio; for (int i = 0; i < goldList.Count; i++) { drGoldPortfolio = dtGoldPortfolio.NewRow(); goldVo = new GoldVo(); goldVo = goldList[i]; drGoldPortfolio[0] = goldVo.GoldNPId.ToString(); drGoldPortfolio[1] = goldVo.AssetCategoryName.ToString(); if (goldVo.PurchaseDate != DateTime.MinValue) { drGoldPortfolio[2] = goldVo.PurchaseDate.ToString("dd/MM/yyyy"); } drGoldPortfolio[3] = goldVo.PurchaseValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); drGoldPortfolio[4] = goldVo.CurrentValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); drGoldPortfolio[5] = goldVo.Remarks.ToString(); dtGoldPortfolio.Rows.Add(drGoldPortfolio); } gvGoldPortfolio.DataSource = dtGoldPortfolio; gvGoldPortfolio.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", "ViewGoldPortfolio.ascx:BindData()"); object[] objects = new object[4]; objects[0] = customerVo; objects[1] = goldVo; objects[2] = goldList; objects[3] = portfolioId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnSaveChanges_Click(object sender, EventArgs e) { GoldVo newGoldVo = new GoldVo(); try { if (string.IsNullOrEmpty(txtQuantity.Text)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Message", "alert('Please enter Quantity');", true); } else { if (string.IsNullOrEmpty(txtPurchasePrice.Text)) { //txtPurchaseValue.Text = "0.00"; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Message", "alert('Please enter Purchase Rate');", true); } else { if (string.IsNullOrEmpty(txtPurchaseValue.Text)) { //txtPurchasePrice.Text = "0.00"; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Message", "alert('Please enter Purchase Cost');", true); } else { goldVo = (GoldVo)Session["goldVo"]; userVo = (UserVo)Session["userVo"]; newGoldVo.AssetCategoryCode = goldVo.AssetCategoryCode.ToString().Trim(); newGoldVo.AssetGroupCode = goldVo.AssetGroupCode.ToString().Trim(); if (txtCurrentPrice.Text.Trim() != string.Empty) { newGoldVo.CurrentPrice = float.Parse(txtCurrentPrice.Text); } if (txtCurrentValue.Text.Trim() != string.Empty) { newGoldVo.CurrentValue = float.Parse(txtCurrentValue.Text); } newGoldVo.PortfolioId = goldVo.PortfolioId; newGoldVo.GoldNPId = goldVo.GoldNPId; //newGoldVo.MeasureCode = ddlMeasureCode.SelectedValue.ToString().Trim(); newGoldVo.MeasureCode = "GR"; newGoldVo.Name = txtName.Text; if (txtPurchaseDate.Text.Trim() != string.Empty) { newGoldVo.PurchaseDate = DateTime.Parse(txtPurchaseDate.Text); } if (txtPurchasePrice.Text.Trim() != string.Empty) { newGoldVo.PurchasePrice = float.Parse(txtPurchasePrice.Text); } if (txtPurchaseValue.Text.Trim() != string.Empty) { newGoldVo.PurchaseValue = float.Parse(txtPurchaseValue.Text); } if (txtQuantity.Text.Trim() != string.Empty) { newGoldVo.Quantity = float.Parse(txtQuantity.Text); } newGoldVo.Remarks = (txtRemarks.Text); if (txtSaleDate.Text.Trim() != "") { newGoldVo.SellDate = DateTime.Parse(txtSaleDate.Text.Trim()); } else { newGoldVo.SellDate = DateTime.MinValue; } if (txtSaleRate.Text.Trim() != "") { newGoldVo.SellPrice = float.Parse(txtSaleRate.Text.Trim()); } else { newGoldVo.SellPrice = float.Parse("0"); } if (txtSaleValue.Text.Trim() != "") { newGoldVo.SellValue = float.Parse(txtSaleValue.Text.Trim()); } else { newGoldVo.SellValue = float.Parse("0"); } if (goldBo.UpdateGoldNetPosition(newGoldVo, userVo.UserId)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('ViewGoldPortfolio', 'none')", true); //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('ViewGoldPortfolio','none');", true); } } } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioGoldEntry.ascx:btnSaveChanges_Click()"); object[] objects = new object[3]; objects[0] = userVo; objects[1] = goldVo; objects[2] = newGoldVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void SetViewFields() { try { //lblHeader.Text = "Gold Details View Form"; goldVo = (GoldVo)Session["goldVo"]; lnkEdit.Visible = true; btnSaveChanges.Visible = false; btnSubmit.Visible = false; // Asset Group - Gold // Asset Category lblAssetCategory.Text = goldVo.AssetCategoryName.ToString().Trim(); ddlCategory.Visible = false; // Purchase Date if (goldVo.PurchaseDate != DateTime.MinValue) { txtPurchaseDate.Text = goldVo.PurchaseDate.ToShortDateString().ToString(); } txtPurchaseDate.Enabled = false; txtPurchaseDate_CalendarExtender.Enabled = false; // Sale Date if (goldVo.SellDate != DateTime.MinValue) { txtSaleDate.Text = goldVo.SellDate.ToShortDateString().ToString(); } txtSaleDate.Enabled = false; txtSaleDate_CalendarExtender.Enabled = false; // Current Price txtCurrentPrice.Text = goldVo.CurrentPrice.ToString(); txtCurrentPrice.Enabled = false; // Current Value txtCurrentValue.Text = goldVo.CurrentValue.ToString(); txtCurrentValue.Enabled = false; // Particulars / Name txtName.Text = goldVo.Name.ToString(); txtName.Enabled = false; // Purchase Price txtPurchasePrice.Text = goldVo.PurchasePrice.ToString(); txtPurchasePrice.Enabled = false; // Purchase Value txtPurchaseValue.Text = goldVo.PurchaseValue.ToString(); txtPurchaseValue.Enabled = false; // Quantity txtQuantity.Text = goldVo.Quantity.ToString(); txtQuantity.Enabled = false; // Remarks txtRemarks.Text = goldVo.Remarks.ToString(); txtRemarks.Enabled = false; // Sales Rate / Sell Price if (goldVo.SellPrice != 0) { txtSaleRate.Text = goldVo.SellPrice.ToString(); } txtSaleRate.Enabled = false; // Sale Value if (goldVo.SellValue != 0) { txtSaleValue.Text = goldVo.SellValue.ToString(); } txtSaleValue.Enabled = false; // MeasureCode LoadMeasureCode(); ddlMeasureCode.SelectedValue = goldVo.MeasureCode.ToString().Trim(); ddlMeasureCode.Enabled = false; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioGoldEntry.ascx:SetViewFields()"); object[] objects = new object[1]; objects[0] = goldVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public bool UpdateGoldNetPosition(GoldVo goldVo, int userId) { bool bResult = false; Database db; DbCommand updateGoldPortfolioCmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updateGoldPortfolioCmd = db.GetStoredProcCommand("SP_UpdateGoldNetPosition"); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_GoldNPId", DbType.Int32, goldVo.GoldNPId); db.AddInParameter(updateGoldPortfolioCmd, "@CP_PortfolioId", DbType.Int32, goldVo.PortfolioId); db.AddInParameter(updateGoldPortfolioCmd, "@PAIC_AssetInstrumentCategoryCode", DbType.String, goldVo.AssetCategoryCode); db.AddInParameter(updateGoldPortfolioCmd, "@PAG_AssetGroupCode", DbType.String, goldVo.AssetGroupCode); db.AddInParameter(updateGoldPortfolioCmd, "@XMC_MeasureCode", DbType.String, goldVo.MeasureCode); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_Name", DbType.String, goldVo.Name); if (goldVo.PurchaseDate != DateTime.MinValue) { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_PurchaseDate", DbType.DateTime, goldVo.PurchaseDate); } else { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_PurchaseDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_PurchasePrice", DbType.Decimal, goldVo.PurchasePrice); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_Quantity", DbType.Decimal, goldVo.Quantity); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_PurchaseValue", DbType.Decimal, goldVo.PurchaseValue); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_CurrentPrice", DbType.Decimal, goldVo.CurrentPrice); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_CurrentValue", DbType.Decimal, goldVo.CurrentValue); if (goldVo.SellDate != DateTime.MinValue) { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellDate", DbType.DateTime, goldVo.SellDate); } else { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellDate", DbType.DateTime, DBNull.Value); } if (goldVo.SellPrice != 0) { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellPrice", DbType.Decimal, goldVo.SellPrice); } else { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellPrice", DbType.Decimal, DBNull.Value); } if (goldVo.SellValue != 0) { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellValue", DbType.Decimal, goldVo.SellValue); } else { db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellValue", DbType.Decimal, DBNull.Value); } //db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellDate", DbType.DateTime, goldVo.SellDate); //db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellPrice", DbType.Decimal, goldVo.SellPrice); //db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_SellValue", DbType.Decimal, goldVo.SellValue); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_ModifiedBy", DbType.Int32, userId); db.AddInParameter(updateGoldPortfolioCmd, "@CGNP_Remark", DbType.String, goldVo.Remarks); if (db.ExecuteNonQuery(updateGoldPortfolioCmd) != 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", "GoldDao.cs:UpdateGoldNetPosition()"); object[] objects = new object[2]; objects[0] = goldVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
public GoldVo GetGoldAsset(int GoldNPId) { GoldVo goldVo = null; Database db; DbCommand getGoldPortfolioCmd; DataSet dsGetGoldPortfolio; DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getGoldPortfolioCmd = db.GetStoredProcCommand("SP_GetGoldAsset"); db.AddInParameter(getGoldPortfolioCmd, "@CGNP_GoldNPId", DbType.Int32, GoldNPId); dsGetGoldPortfolio = db.ExecuteDataSet(getGoldPortfolioCmd); if (dsGetGoldPortfolio.Tables[0].Rows.Count > 0) { dr = dsGetGoldPortfolio.Tables[0].Rows[0]; goldVo = new GoldVo(); goldVo.PortfolioId = int.Parse(dr["CP_PortfolioId"].ToString()); goldVo.GoldNPId = int.Parse(dr["CGNP_GoldNPId"].ToString()); goldVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); goldVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); goldVo.MeasureCode = dr["XMC_MeasureCode"].ToString(); goldVo.Name = dr["CGNP_Name"].ToString(); if (dr["CGNP_PurchaseDate"] != null && dr["CGNP_PurchaseDate"] != DBNull.Value) { goldVo.PurchaseDate = DateTime.Parse(dr["CGNP_PurchaseDate"].ToString()); } if (dr["CGNP_PurchasePrice"] != DBNull.Value && dr["CGNP_PurchasePrice"] != string.Empty) { goldVo.PurchasePrice = double.Parse(dr["CGNP_PurchasePrice"].ToString()); } if (dr["CGNP_Quantity"] != DBNull.Value && dr["CGNP_Quantity"] != "") { goldVo.Quantity = float.Parse(dr["CGNP_Quantity"].ToString()); } if (dr["CGNP_PurchaseValue"] != DBNull.Value && dr["CGNP_PurchaseValue"] != "") { goldVo.PurchaseValue = double.Parse(dr["CGNP_PurchaseValue"].ToString()); } if (dr["CGNP_CurrentPrice"] != DBNull.Value && dr["CGNP_CurrentPrice"] != "") { goldVo.CurrentPrice = double.Parse(dr["CGNP_CurrentPrice"].ToString()); } if (dr["CGNP_CurrentValue"] != DBNull.Value && dr["CGNP_CurrentValue"] != "") { goldVo.CurrentValue = double.Parse(dr["CGNP_CurrentValue"].ToString()); } if (dr["CGNP_SellDate"].ToString() != "") { goldVo.SellDate = DateTime.Parse(dr["CGNP_SellDate"].ToString()); } if (dr["CGNP_SellPrice"] != DBNull.Value && dr["CGNP_SellPrice"].ToString() != "") { goldVo.SellPrice = double.Parse(dr["CGNP_SellPrice"].ToString()); } if (dr["CGNP_SellValue"] != DBNull.Value && dr["CGNP_SellValue"].ToString() != "") { goldVo.SellValue = double.Parse(dr["CGNP_SellValue"].ToString()); } goldVo.Remarks = dr["CGNP_Remark"].ToString(); goldVo.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", "GoldDao.cs:GetGoldAsset()"); object[] objects = new object[1]; objects[0] = GoldNPId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(goldVo); }
public List <GoldVo> GetGoldNetPosition(int portfolioId, int CurrentPage, string SortOrder, out int Count) { List <GoldVo> goldList = null; GoldVo goldVo; Database db; DbCommand getGoldPortfolioCmd; DataSet dsGetGoldPortfolio; DataTable dtGetGoldPortfolio; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getGoldPortfolioCmd = db.GetStoredProcCommand("SP_GetGoldNetPosition"); db.AddInParameter(getGoldPortfolioCmd, "@CP_PortfolioId", DbType.Int32, portfolioId); db.AddInParameter(getGoldPortfolioCmd, "@CurrentPage", DbType.Int32, CurrentPage); db.AddInParameter(getGoldPortfolioCmd, "@SortOrder", DbType.String, SortOrder); dsGetGoldPortfolio = db.ExecuteDataSet(getGoldPortfolioCmd); if (dsGetGoldPortfolio.Tables[0].Rows.Count > 0) { dtGetGoldPortfolio = dsGetGoldPortfolio.Tables[0]; goldList = new List <GoldVo>(); foreach (DataRow dr in dtGetGoldPortfolio.Rows) { goldVo = new GoldVo(); goldVo.PortfolioId = int.Parse(dr["CP_PortfolioId"].ToString()); goldVo.GoldNPId = int.Parse(dr["CGNP_GoldNPId"].ToString()); goldVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); goldVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); goldVo.MeasureCode = dr["XMC_MeasureCode"].ToString(); goldVo.Name = dr["CGNP_Name"].ToString(); if (dr["CGNP_PurchaseDate"] != DBNull.Value) { goldVo.PurchaseDate = DateTime.Parse(dr["CGNP_PurchaseDate"].ToString()); } goldVo.PurchasePrice = double.Parse(dr["CGNP_PurchasePrice"].ToString()); goldVo.Quantity = float.Parse(dr["CGNP_Quantity"].ToString()); goldVo.PurchaseValue = double.Parse(dr["CGNP_PurchaseValue"].ToString()); goldVo.CurrentPrice = double.Parse(dr["CGNP_CurrentPrice"].ToString()); goldVo.CurrentValue = double.Parse(dr["CGNP_CurrentValue"].ToString()); goldVo.Remarks = dr["CGNP_Remark"].ToString(); goldVo.AssetCategoryName = dr["PAIC_AssetInstrumentCategoryName"].ToString(); //goldVo.SellDate=DateTime.Parse( dr["CGNP_SellDate"].ToString()); //goldVo.SellPrice=float.Parse( dr["CGNP_SellPrice"].ToString()); //goldVo.SellValue=float.Parse( dr["CGNP_SellValue"].ToString()); goldList.Add(goldVo); } } if (dsGetGoldPortfolio.Tables[1] != null && dsGetGoldPortfolio.Tables[0].Rows.Count > 0) { Count = Int32.Parse(dsGetGoldPortfolio.Tables[1].Rows[0][0].ToString()); } else { Count = 0; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "GoldDao.cs:GetGoldNetPosition()"); object[] objects = new object[1]; objects[0] = portfolioId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(goldList); }