public PropertyVo update(PropertyVo input, Guid?propertyId = null) { using (var db = new MainDb()) { if (propertyId == null) { propertyId = input.propertyId; } var res = db.properties.FirstOrDefault(e => e.propertyId == propertyId); if (res == null) { return(null); } input.created = res.created; // input.createdBy = res.createdBy; db.Entry(res).CurrentValues.SetValues(input); db.SaveChanges(); return(res); } }
public PropertyVo GetPropertyAsset(int propertyId) { PropertyDao propertyDao = new PropertyDao(); PropertyVo propertyVo = new PropertyVo(); try { propertyVo = propertyDao.GetPropertyAsset(propertyId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyBo.cs:GetPropertyAsset()"); object[] objects = new object[1]; objects[0] = propertyId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(propertyVo); }
public int CreatePropertyPortfolio(PropertyVo propertyVo, int userId) { PropertyDao propertyDao = new PropertyDao(); int PropertyId = 0; try { PropertyId = propertyDao.CreatePropertyPortfolio(propertyVo, userId); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyBo.cs:CreatePropertyPortfolio()"); object[] objects = new object[2]; objects[0] = propertyVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(PropertyId); }
//public List<ImageCheckBoxInfo> imagesToRemove { get; set; } public PropertyVm() { property = new PropertyVo(); this.result = new List <PropertyVo>(); if (paging == null) { paging = new Paging(); } }
public PropertyVm(PropertyVo input) { property = input; this.result = new List <PropertyVo>(); if (paging == null) { paging = new Paging(); } }
public ActionResult Edit(Guid id, PropertyVo input) { if (this.ModelState.IsValid) { var res = propertyManager.update(input, id); return(RedirectToAction("Index")); } return(View(input)); }
public PropertyVo insert(PropertyVo input) { using (var db = new MainDb()) { db.properties.Add(input); db.SaveChanges(); return(input); } }
public ActionResult Create(PropertyVo input) { if (this.ModelState.IsValid) { var item = propertyManager.insert(input); return(RedirectToAction("Index")); } return(View(input)); }
private void BindDropDowns(PropertyVo propertyVo, CustomerAccountsVo customerAccountsVo, string path) { try { userVo = (UserVo)Session["userVo"]; customerVo = (CustomerVo)Session["CustomerVo"]; dtMeasureCode = XMLBo.GetMeasureCode(path, AssetGroupCode); ddlMeasureCode.DataSource = dtMeasureCode; ddlMeasureCode.DataTextField = "Measure"; ddlMeasureCode.DataValueField = "MeasureCode"; ddlMeasureCode.DataBind(); ddlMeasureCode.Items.Insert(0, new ListItem("Select a Measure Code", "Select a Measure Code")); // Bind the Instrument Category for an Asset dsInstrumentCategory = assetBo.GetAssetInstrumentCategory(AssetGroupCode); ddlInstrumentCat.DataSource = dsInstrumentCategory.Tables[0]; ddlInstrumentCat.DataTextField = "PAIC_AssetInstrumentCategoryName"; ddlInstrumentCat.DataValueField = "PAIC_AssetInstrumentCategoryCode"; ddlInstrumentCat.DataBind(); ddlInstrumentCat.Items.Insert(0, new ListItem("Select an Instrument Category", "Select an Instrument Category")); ddlInstrumentSubCat.Items.Clear(); // Bind State Drop Downs dtStates = XMLBo.GetStates(path); ddlState.DataSource = dtStates; ddlState.DataTextField = "StateName"; ddlState.DataValueField = "StateCode"; ddlState.DataBind(); ddlState.Items.Insert(0, new ListItem("Select a State", "Select a State")); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioPropertyEntry.ascx:BindDropDowns()"); object[] objects = new object[5]; objects[0] = userVo; objects[1] = propertyVo; objects[2] = customerAccountsVo; objects[3] = path; objects[4] = customerVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void ddlMenu_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownList ddlAction = (DropDownList)sender; GridViewRow gvr = (GridViewRow)ddlAction.NamingContainer; int selectedRow = gvr.RowIndex; int propertyId = int.Parse(gvrProperty.DataKeys[selectedRow].Value.ToString()); // Set the VO into the Session propertyVo = propertyBo.GetPropertyAsset(propertyId); Session["propertyVo"] = propertyVo; Session["customerAccountVo"] = customerAccountsBo.GetCustomerPropertyAccount(propertyVo.AccountId); if (ddlAction.SelectedItem.Value.ToString() == "Edit") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioPropertyEntry','?action=edit');", true); } if (ddlAction.SelectedItem.Value.ToString() == "View") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioPropertyEntry','?action=view');", true); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioProperty.ascx:ddlMenu_SelectedIndexChanged()"); object[] objects = new object[1]; objects[0] = propertyVo; FunctionInfo = exBase.AddObject(FunctionInfo, null);/*, objects*/ exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void ddlMenu_SelectedIndexChanged(object sender, EventArgs e) { try { //GridViewRow gvr = (GridViewRow)ddlAction.NamingContainer; //int selectedRow = gvr.RowIndex; //int propertyId = int.Parse(gvrProperty.DataKeys[selectedRow].Value.ToString()); DropDownList ddlAction = (DropDownList)sender; GridDataItem gvr = (GridDataItem)ddlAction.NamingContainer; int selectedRow = gvr.ItemIndex + 1; int propertyId = int.Parse(gvrProperty.MasterTableView.DataKeyValues[selectedRow - 1]["PropertyId"].ToString()); hdndeleteId.Value = propertyId.ToString(); // Set the VO into the Session propertyVo = propertyBo.GetPropertyAsset(propertyId); Session["propertyVo"] = propertyVo; Session["customerAccountVo"] = customerAccountsBo.GetCustomerPropertyAccount(propertyVo.AccountId); if (ddlAction.SelectedItem.Value.ToString() == "Edit") { if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1") { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true); } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioPropertyEntry','action=Edit');", true); } } else if (ddlAction.SelectedItem.Value.ToString() == "View") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioPropertyEntry','action=View');", true); } else if (ddlAction.SelectedItem.Value.ToString() == "Delete") { if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1") { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "showmessage();", true); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioProperty.ascx:ddlMenu_SelectedIndexChanged()"); object[] objects = new object[1]; objects[0] = propertyVo; FunctionInfo = exBase.AddObject(FunctionInfo, null);/*, objects*/ exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public bool UpdatePropertyPortfolio(PropertyVo propertyVo, int userId) { bool bResult = false; Database db; DbCommand updatePropertyPortfolioCmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updatePropertyPortfolioCmd = db.GetStoredProcCommand("SP_UpdatePropertyNetPosition"); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyNPId", DbType.Int32, propertyVo.PropertyId); db.AddInParameter(updatePropertyPortfolioCmd, "@XMC_MeasureCode", DbType.String, propertyVo.MeasureCode); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_Name", DbType.String, propertyVo.Name); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyAdrLine1", DbType.String, propertyVo.PropertyAdrLine1); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyAdrLine2", DbType.String, propertyVo.PropertyAdrLine2); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyAdrLine3", DbType.String, propertyVo.PropertyAdrLine3); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyCity", DbType.String, propertyVo.PropertyCity); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyState", DbType.String, propertyVo.PropertyState); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyCountry", DbType.String, propertyVo.PropertyCountry); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PropertyPinCode", DbType.Int32, propertyVo.PropertyPinCode); if (propertyVo.PurchaseDate != DateTime.MinValue) { db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PurchaseDate", DbType.DateTime, propertyVo.PurchaseDate); } else { db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PurchaseDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PurchasePrice", DbType.Decimal, propertyVo.PurchasePrice); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_Quantity", DbType.Decimal, propertyVo.Quantity); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_CurrentPrice", DbType.Decimal, propertyVo.CurrentPrice); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_CurrentValue", DbType.Decimal, propertyVo.CurrentValue); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_PurchaseValue", DbType.Decimal, propertyVo.PurchaseValue); if (propertyVo.SellDate != DateTime.MinValue) { db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_SellDate", DbType.DateTime, propertyVo.SellDate); } else { db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_SellDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_SellPrice", DbType.Decimal, propertyVo.SellPrice); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_SellValue", DbType.Decimal, propertyVo.SellValue); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_Remark", DbType.String, propertyVo.Remark); db.AddInParameter(updatePropertyPortfolioCmd, "@CPNP_ModifiedBy", DbType.Decimal, userId); if (db.ExecuteNonQuery(updatePropertyPortfolioCmd) != 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", "PropertyDao.cs:UpdatePropertyPortfolio()"); object[] objects = new object[2]; objects[0] = propertyVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(bResult); }
public void LoadPropertyGrid(int portfolioId) { List <PropertyVo> propertyList = new List <PropertyVo>(); try { string path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString()); int count; propertyList = propertyBo.GetPropertyPortfolio(portfolioId, mypager.CurrentPage, hdnSort.Value, out count); if (count > 0) { lblTotalRows.Text = hdnRecordCount.Value = count.ToString(); tblPager.Visible = true; } if (propertyList != null) { lblMsg.Visible = false; DataTable dtProperty = new DataTable(); //dtProperty.Columns.Add("SI.No"); dtProperty.Columns.Add("PropertyId"); dtProperty.Columns.Add("Sub Category"); dtProperty.Columns.Add("Particulars"); dtProperty.Columns.Add("City"); dtProperty.Columns.Add("Area"); dtProperty.Columns.Add("Measurement Unit"); dtProperty.Columns.Add("Purchase Date"); dtProperty.Columns.Add("Purchase Cost"); dtProperty.Columns.Add("Current Value"); DataRow drProperty; for (int i = 0; i < propertyList.Count; i++) { drProperty = dtProperty.NewRow(); propertyVo = new PropertyVo(); propertyVo = propertyList[i]; //drProperty[0] = (i + 1).ToString(); drProperty[0] = propertyVo.PropertyId.ToString(); drProperty[1] = propertyVo.AssetSubCategoryName.ToString(); drProperty[2] = propertyVo.Name.ToString(); drProperty[3] = propertyVo.PropertyCity.ToString(); drProperty[4] = propertyVo.Quantity.ToString("f0"); drProperty[5] = XMLBo.GetMeasureCodeName(path, propertyVo.MeasureCode.ToString()); if (propertyVo.PurchaseDate != DateTime.MinValue) { drProperty[6] = propertyVo.PurchaseDate.ToString("dd/MM/yyyy"); } else { drProperty[6] = string.Empty; } drProperty[7] = propertyVo.PurchaseValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); drProperty[8] = propertyVo.CurrentValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); dtProperty.Rows.Add(drProperty); } gvrProperty.DataSource = dtProperty; gvrProperty.DataBind(); this.GetPageCount(); } else { lblMsg.Visible = true; gvrProperty.DataSource = null; gvrProperty.DataBind(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioProperty.ascx:LoadPropertyGrid()"); object[] objects = new object[2]; objects[0] = propertyVo; objects[1] = propertyList; FunctionInfo = exBase.AddObject(FunctionInfo, null);/*, objects*/ exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public int CreatePropertyPortfolio(PropertyVo propertyVo, int userId) { int PropertyId = 0; Database db; DbCommand createPropertyPortfolioCmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); createPropertyPortfolioCmd = db.GetStoredProcCommand("SP_CreatePropertyNetPosition"); db.AddInParameter(createPropertyPortfolioCmd, "@CPA_AccountId", DbType.Int32, propertyVo.AccountId); db.AddInParameter(createPropertyPortfolioCmd, "@PAISC_AssetInstrumentSubCategoryCode", DbType.String, propertyVo.AssetSubCategoryCode); db.AddInParameter(createPropertyPortfolioCmd, "@PAIC_AssetInstrumentCategoryCode", DbType.String, propertyVo.AssetCategoryCode); db.AddInParameter(createPropertyPortfolioCmd, "@PAG_AssetGroupCode", DbType.String, propertyVo.AssetGroupCode); db.AddInParameter(createPropertyPortfolioCmd, "@XMC_MeasureCode", DbType.String, propertyVo.MeasureCode); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_Name", DbType.String, propertyVo.Name); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyAdrLine1", DbType.String, propertyVo.PropertyAdrLine1); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyAdrLine2", DbType.String, propertyVo.PropertyAdrLine2); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyAdrLine3", DbType.String, propertyVo.PropertyAdrLine3); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyCity", DbType.String, propertyVo.PropertyCity); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyState", DbType.String, propertyVo.PropertyState); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyCountry", DbType.String, propertyVo.PropertyCountry); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PropertyPinCode", DbType.Int32, propertyVo.PropertyPinCode); if (propertyVo.PurchaseDate != DateTime.MinValue) { db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PurchaseDate", DbType.DateTime, propertyVo.PurchaseDate); } else { db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PurchaseDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PurchasePrice", DbType.Decimal, propertyVo.PurchasePrice); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_Quantity", DbType.Decimal, propertyVo.Quantity); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_CurrentPrice", DbType.Decimal, propertyVo.CurrentPrice); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_CurrentValue", DbType.Decimal, propertyVo.CurrentValue); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_PurchaseValue", DbType.Decimal, propertyVo.PurchaseValue); if (propertyVo.SellDate != DateTime.MinValue) { db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_SellDate", DbType.DateTime, propertyVo.SellDate); } else { db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_SellDate", DbType.DateTime, DBNull.Value); } db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_SellPrice", DbType.Decimal, propertyVo.SellPrice); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_SellValue", DbType.Decimal, propertyVo.SellValue); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_Remark", DbType.String, propertyVo.Remark); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_CreatedBy", DbType.Decimal, userId); db.AddInParameter(createPropertyPortfolioCmd, "@CPNP_ModifiedBy", DbType.Decimal, userId); db.AddOutParameter(createPropertyPortfolioCmd, "@PropertyId", DbType.Int32, 500); if (db.ExecuteNonQuery(createPropertyPortfolioCmd) != 0) { PropertyId = int.Parse(db.GetParameterValue(createPropertyPortfolioCmd, "PropertyId").ToString()); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyDao.cs:CreatePropertyPortfolio()"); object[] objects = new object[2]; objects[0] = propertyVo; objects[1] = userId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(PropertyId); }
public PropertyVo GetPropertyAsset(int propertyId) { PropertyVo propertyVo = null; Database db; DbCommand getPropertyPortfolioCmd; DataSet dsGetPropertyPortfolio; DataRow dr; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getPropertyPortfolioCmd = db.GetStoredProcCommand("SP_GetPropertyNetPosition"); db.AddInParameter(getPropertyPortfolioCmd, "@CPNP_PropertyNPId", DbType.Int32, propertyId); dsGetPropertyPortfolio = db.ExecuteDataSet(getPropertyPortfolioCmd); if (dsGetPropertyPortfolio.Tables[0].Rows.Count > 0) { propertyVo = new PropertyVo(); dr = dsGetPropertyPortfolio.Tables[0].Rows[0]; propertyVo.AccountId = int.Parse(dr["CPA_AccountId"].ToString()); propertyVo.PropertyId = int.Parse(dr["CPNP_PropertyNPId"].ToString()); propertyVo.AssetSubCategoryCode = dr["PAISC_AssetInstrumentSubCategoryCode"].ToString(); propertyVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); propertyVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); propertyVo.MeasureCode = dr["XMC_MeasureCode"].ToString(); propertyVo.Name = dr["CPNP_Name"].ToString(); propertyVo.PropertyAdrLine1 = dr["CPNP_PropertyAdrLine1"].ToString(); propertyVo.PropertyAdrLine2 = dr["CPNP_PropertyAdrLine2"].ToString(); propertyVo.PropertyAdrLine3 = dr["CPNP_PropertyAdrLine3"].ToString(); propertyVo.PropertyCity = dr["CPNP_PropertyCity"].ToString(); propertyVo.PropertyState = dr["CPNP_PropertyState"].ToString(); propertyVo.PropertyCountry = dr["CPNP_PropertyCountry"].ToString(); propertyVo.PropertyPinCode = int.Parse(dr["CPNP_PropertyPinCode"].ToString()); if (dr["CPNP_PurchaseDate"].ToString() != "") { propertyVo.PurchaseDate = DateTime.Parse(dr["CPNP_PurchaseDate"].ToString()); } propertyVo.PurchasePrice = float.Parse(dr["CPNP_PurchasePrice"].ToString()); propertyVo.Quantity = float.Parse(dr["CPNP_Quantity"].ToString()); propertyVo.CurrentPrice = float.Parse(dr["CPNP_CurrentPrice"].ToString()); propertyVo.CurrentValue = float.Parse(dr["CPNP_CurrentValue"].ToString()); propertyVo.PurchaseValue = float.Parse(dr["CPNP_PurchaseValue"].ToString()); if (dr["CPNP_SellDate"].ToString() != "") { propertyVo.SellDate = DateTime.Parse(dr["CPNP_SellDate"].ToString()); } if (dr["CPNP_SellPrice"].ToString() != "") { propertyVo.SellPrice = float.Parse(dr["CPNP_SellPrice"].ToString()); } if (dr["CPNP_SellValue"].ToString() != "") { propertyVo.SellValue = float.Parse(dr["CPNP_SellValue"].ToString()); } propertyVo.Remark = dr["CPNP_Remark"].ToString(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyDao.cs:GetPropertyAsset()"); object[] objects = new object[1]; objects[0] = propertyId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(propertyVo); }
public List <PropertyVo> GetPropertyPortfolio(int portfolioId, int CurrentPage, string SortOrder, out int Count) { List <PropertyVo> propertyList = null; PropertyVo propertyVo = new PropertyVo(); Database db; DbCommand getPropertyPortfolioCmd; DataSet dsGetPropertyPortfolio; DataTable dtGetPropertyPortfolio; try { db = DatabaseFactory.CreateDatabase("wealtherp"); getPropertyPortfolioCmd = db.GetStoredProcCommand("SP_GetPropertyNetPositionList"); db.AddInParameter(getPropertyPortfolioCmd, "@CP_PortfolioId", DbType.Int32, portfolioId); db.AddInParameter(getPropertyPortfolioCmd, "@CurrentPage", DbType.Int32, CurrentPage); db.AddInParameter(getPropertyPortfolioCmd, "@SortOrder", DbType.String, SortOrder); dsGetPropertyPortfolio = db.ExecuteDataSet(getPropertyPortfolioCmd); dtGetPropertyPortfolio = dsGetPropertyPortfolio.Tables[0]; if (dsGetPropertyPortfolio.Tables[1] != null && dsGetPropertyPortfolio.Tables[1].Rows.Count > 0) { Count = Int32.Parse(dsGetPropertyPortfolio.Tables[1].Rows[0][0].ToString()); } else { Count = 0; } if (dsGetPropertyPortfolio.Tables[0].Rows.Count > 0) { propertyList = new List <PropertyVo>(); foreach (DataRow dr in dtGetPropertyPortfolio.Rows) { propertyVo = new PropertyVo(); propertyVo.AccountId = int.Parse(dr["CPA_AccountId"].ToString()); propertyVo.PropertyId = int.Parse(dr["CPNP_PropertyNPId"].ToString()); propertyVo.AssetSubCategoryCode = dr["PAISC_AssetInstrumentSubCategoryCode"].ToString(); propertyVo.AssetCategoryCode = dr["PAIC_AssetInstrumentCategoryCode"].ToString(); propertyVo.AssetGroupCode = dr["PAG_AssetGroupCode"].ToString(); propertyVo.MeasureCode = dr["XMC_MeasureCode"].ToString(); propertyVo.Name = dr["CPNP_Name"].ToString(); propertyVo.PropertyAdrLine1 = dr["CPNP_PropertyAdrLine1"].ToString(); propertyVo.PropertyAdrLine2 = dr["CPNP_PropertyAdrLine2"].ToString(); propertyVo.PropertyAdrLine3 = dr["CPNP_PropertyAdrLine3"].ToString(); propertyVo.PropertyCity = dr["CPNP_PropertyCity"].ToString(); propertyVo.PropertyState = dr["CPNP_PropertyState"].ToString(); propertyVo.PropertyCountry = dr["CPNP_PropertyCountry"].ToString(); propertyVo.PropertyPinCode = int.Parse(dr["CPNP_PropertyPinCode"].ToString()); if (dr["CPNP_PurchaseDate"].ToString() != "") { propertyVo.PurchaseDate = DateTime.Parse(dr["CPNP_PurchaseDate"].ToString()); } propertyVo.PurchasePrice = float.Parse(dr["CPNP_PurchasePrice"].ToString()); propertyVo.Quantity = float.Parse(dr["CPNP_Quantity"].ToString()); propertyVo.CurrentPrice = float.Parse(dr["CPNP_CurrentPrice"].ToString()); propertyVo.CurrentValue = float.Parse(dr["CPNP_CurrentValue"].ToString()); propertyVo.PurchaseValue = float.Parse(dr["CPNP_PurchaseValue"].ToString()); if (dr["CPNP_SellDate"].ToString() != "") { propertyVo.SellDate = DateTime.Parse(dr["CPNP_SellDate"].ToString()); } if (dr["CPNP_SellPrice"].ToString() != "") { propertyVo.SellPrice = float.Parse(dr["CPNP_SellPrice"].ToString()); } if (dr["CPNP_SellValue"].ToString() != "") { propertyVo.SellValue = float.Parse(dr["CPNP_SellValue"].ToString()); } propertyVo.Remark = dr["CPNP_Remark"].ToString(); propertyVo.AssetSubCategoryName = dr["PAISC_AssetInstrumentSubCategoryName"].ToString(); propertyVo.JointHolderName = dr["JntName"].ToString(); propertyVo.Nominee = dr["NName"].ToString(); propertyList.Add(propertyVo); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PropertyDao.cs:GetPropertyPortfolio()"); object[] objects = new object[1]; objects[0] = portfolioId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(propertyList); }
private void SetControls(string action, PropertyVo propertyVo, CustomerAccountsVo customerAccountsVo, string path) { try { txtAccountNum.Enabled = false; txtModeofHolding.Enabled = false; //txtPurchaseDate.Enabled = false; txtModeofHolding.Text = XMLBo.GetModeOfHoldingName(path, customerAccountsVo.ModeOfHolding.ToString()); txtAccountNum.Text = customerAccountsVo.AccountNum.ToString(); if (customerAccountsVo.AccountOpeningDate != DateTime.MinValue) { txtPurchaseDate.Text = customerAccountsVo.AccountOpeningDate.ToShortDateString(); } //txtPropertyName.Text = customerAccountsVo. // Joint Holders // Nominees // Bind Initial Drop Downs BindDropDowns(propertyVo, customerAccountsVo, path); BindInstrumentSubCategory(customerAccountsVo); ddlInstrumentCat.SelectedValue = customerAccountsVo.AssetCategory.ToString().Trim(); ddlInstrumentSubCat.SelectedValue = customerAccountsVo.AssetSubCategory.Trim(); if (action == "entry") { // Clear all controls here txtPropertyName.Text = ""; txtAdrLine1.Text = ""; txtAdrLine2.Text = ""; txtAdrLine3.Text = ""; txtPinCode.Text = ""; txtCity.Text = ""; txtPurchaseDate.Text = ""; txtPurchaseDate_CalendarExtender.Enabled = true; txtPurchaseDate_TextBoxWatermarkExtender.Enabled = true; //imgPurchaseDate.Visible = true; //dvPurchaseDate.Visible = true; txtQuantity.Text = ""; txtPurchasePrice.Text = ""; txtPurchaseValue.Text = ""; txtCurrentPrice.Text = ""; txtCurrentValue.Text = ""; txtSaleDate.Text = ""; txtSaleDate_CalendarExtender.Enabled = true; txtSaleDate_TextBoxWatermarkExtender.Enabled = true; //imgSaleDate.Visible = true; //dvSaleDate.Visible = true; txtSaleRate.Text = ""; txtSaleProceeds.Text = ""; txtRemarks.Text = ""; // Enable/Disable Controls ddlInstrumentCat.Enabled = false; ddlInstrumentSubCat.Enabled = false; txtPropertyName.Enabled = true; txtAdrLine1.Enabled = true; txtAdrLine2.Enabled = true; txtAdrLine3.Enabled = true; txtPinCode.Enabled = true; txtCity.Enabled = true; txtPurchaseDate.Enabled = true; txtQuantity.Enabled = true; txtPurchasePrice.Enabled = true; txtPurchaseValue.Enabled = true; txtCurrentPrice.Enabled = true; txtCurrentValue.Enabled = true; txtSaleDate.Enabled = true; txtSaleRate.Enabled = true; txtSaleProceeds.Enabled = true; txtRemarks.Enabled = true; trSubmitButton.Visible = true; btnSubmit.Text = "Submit"; } else { ddlInstrumentCat.Enabled = false; ddlInstrumentSubCat.Enabled = false; // Set the Drop Downs to respective values ddlMeasureCode.SelectedValue = propertyVo.MeasureCode.Trim(); ddlState.SelectedValue = propertyVo.PropertyState.ToString(); // Bind values to the respective controls txtPropertyName.Text = propertyVo.Name.ToString().Trim(); txtAdrLine1.Text = propertyVo.PropertyAdrLine1.ToString().Trim(); txtAdrLine2.Text = propertyVo.PropertyAdrLine2.ToString().Trim(); txtAdrLine3.Text = propertyVo.PropertyAdrLine3.ToString().Trim(); txtPinCode.Text = propertyVo.PropertyPinCode.ToString(); txtCity.Text = propertyVo.PropertyCity.ToString().Trim();; if (propertyVo.PurchaseDate != DateTime.MinValue) { txtPurchaseDate.Text = propertyVo.PurchaseDate.ToShortDateString().Trim(); } ; txtQuantity.Text = propertyVo.Quantity.ToString().Trim(); txtPurchasePrice.Text = propertyVo.PurchasePrice.ToString(); txtPurchaseValue.Text = propertyVo.PurchaseValue.ToString(); txtCurrentPrice.Text = propertyVo.CurrentPrice.ToString(); txtCurrentValue.Text = propertyVo.CurrentValue.ToString(); if (propertyVo.SellDate != DateTime.MinValue) { txtSaleDate.Text = propertyVo.SellDate.ToShortDateString(); } txtSaleRate.Text = propertyVo.SellPrice.ToString(); txtSaleProceeds.Text = propertyVo.SellValue.ToString(); if (propertyVo.Remark != null) { txtRemarks.Text = propertyVo.Remark.ToString().Trim(); } else { txtRemarks.Text = ""; } EnableDisableControls(action); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioPropertyEntry.ascx:SetControls()"); object[] objects = new object[4]; objects[0] = action; objects[1] = propertyVo; objects[2] = customerAccountsVo; objects[3] = path; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void Page_Load(object sender, EventArgs e) { try { SessionBo.CheckSession(); cvPurchaseDate1.ValueToCompare = DateTime.Now.ToShortDateString(); setMode(); //Set Add/Edit/View Mode based on the query string parameter. if (!IsPostBack) { userVo = (UserVo)Session["userVo"]; customerVo = (CustomerVo)Session["CustomerVo"]; customerAccountsVo = (CustomerAccountsVo)Session["customerAccountVo"]; propertyVo = (PropertyVo)Session["propertyVo"]; path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString()); if (Request.QueryString["action"] != null) { Manage = Request.QueryString["action"].ToString(); } if (propertyVo != null) { if (mode == Mode.Edit) { lblHeader.Text = "Edit Property"; SetControls("edit", propertyVo, customerAccountsVo, path); } else if (mode == Mode.View) { lblHeader.Text = "View Property"; SetControls("view", propertyVo, customerAccountsVo, path); } else if (mode == Mode.Add) { lblHeader.Text = "Add Property"; SetControls("entry", propertyVo, customerAccountsVo, path); } } else { lblHeader.Text = "Add Property"; SetControls("entry", propertyVo, customerAccountsVo, path); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioPropertyEntry.ascx:Page_Load()"); object[] objects = new object[6]; objects[0] = userVo; objects[1] = customerVo; objects[2] = customerAccountsVo; objects[3] = propertyVo; objects[4] = path; objects[5] = Manage; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { userVo = (UserVo)Session["userVo"]; customerVo = (CustomerVo)Session["CustomerVo"]; customerAccountsVo = (CustomerAccountsVo)Session["customerAccountVo"]; propertyVo = new PropertyVo(); if (btnSubmit.Text == "Submit") { propertyVo.AccountId = Int32.Parse(customerAccountsVo.AccountId.ToString()); propertyVo.AssetSubCategoryCode = customerAccountsVo.AssetSubCategory; propertyVo.AssetCategoryCode = customerAccountsVo.AssetCategory; propertyVo.AssetGroupCode = "PR"; //Replace with the actual group code propertyVo.MeasureCode = ddlMeasureCode.SelectedItem.Value.ToString(); propertyVo.Name = txtPropertyName.Text.ToString(); propertyVo.PropertyAdrLine1 = txtAdrLine1.Text.ToString(); propertyVo.PropertyAdrLine2 = txtAdrLine2.Text.ToString(); propertyVo.PropertyAdrLine3 = txtAdrLine3.Text.ToString(); propertyVo.PropertyCity = txtCity.Text.ToString(); if (txtPinCode.Text != string.Empty) { propertyVo.PropertyPinCode = int.Parse(txtPinCode.Text.ToString()); } propertyVo.PropertyState = ddlState.SelectedItem.Value.ToString(); propertyVo.PropertyCountry = ddlCountry.SelectedItem.Value.ToString(); if (txtPurchaseDate.Text != string.Empty) { propertyVo.PurchaseDate = DateTime.Parse(txtPurchaseDate.Text); } if (txtPurchasePrice.Text != string.Empty) { propertyVo.PurchasePrice = float.Parse(txtPurchasePrice.Text); } if (txtQuantity.Text != string.Empty) { propertyVo.Quantity = float.Parse(txtQuantity.Text.ToString()); } if (txtPurchaseValue.Text != string.Empty) { propertyVo.PurchaseValue = float.Parse(txtPurchaseValue.Text.ToString()); } if (txtCurrentPrice.Text != string.Empty) { propertyVo.CurrentPrice = float.Parse(txtCurrentPrice.Text.ToString()); } if (txtCurrentValue.Text != string.Empty) { propertyVo.CurrentValue = float.Parse(txtCurrentValue.Text.ToString()); } if (txtSaleDate.Text != "") { propertyVo.SellDate = Convert.ToDateTime(txtSaleDate.Text); } if (txtSaleRate.Text != "") { propertyVo.SellPrice = float.Parse(txtSaleRate.Text.ToString()); } if (txtSaleProceeds.Text != "") { propertyVo.SellValue = float.Parse(txtSaleProceeds.Text.ToString()); } propertyVo.Remark = txtRemarks.Text.ToString().Trim(); string url = Request.UrlReferrer.ToString(); int PropertyId = 0; PropertyId = propertyBo.CreatePropertyPortfolio(propertyVo, userVo.UserId); if (PropertyId != 0) { if (Session["test"] != null) //&& Request.QueryString["retURL"] == "liabilities") { Session["propertyVo"] = propertyBo.GetPropertyAsset(PropertyId); Session["propertyVo"] = propertyBo.GetPropertyAsset(PropertyId); Session["test"] = null; string queryString = "?prevPage=propertyEntry"; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('LiabilitiesMaintenanceForm','" + queryString + "');", true); } else if (Session[SessionContents.LoanProcessTracking] != null) { Session["propertyVo"] = propertyBo.GetPropertyAsset(PropertyId); Session["LoanProcessAction"] = "add"; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('LoanProcessTracking','login');", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('PortfolioProperty','none');", true); } } } else if (btnSubmit.Text == "Update") { propertyVo = (PropertyVo)Session["propertyVo"]; propertyVo.MeasureCode = ddlMeasureCode.SelectedItem.Value.ToString(); propertyVo.Name = txtPropertyName.Text.ToString(); propertyVo.PropertyAdrLine1 = txtAdrLine1.Text.ToString(); propertyVo.PropertyAdrLine2 = txtAdrLine2.Text.ToString(); propertyVo.PropertyAdrLine3 = txtAdrLine3.Text.ToString(); propertyVo.PropertyCity = txtCity.Text.ToString(); propertyVo.PropertyPinCode = int.Parse(txtPinCode.Text.ToString()); propertyVo.PropertyState = ddlState.SelectedItem.Value.ToString(); propertyVo.PropertyCountry = ddlCountry.SelectedItem.Value.ToString(); if (txtPurchaseDate.Text != string.Empty) { propertyVo.PurchaseDate = DateTime.Parse(txtPurchaseDate.Text); } if (txtPurchasePrice.Text != string.Empty) { propertyVo.PurchasePrice = float.Parse(txtPurchasePrice.Text.ToString()); } if (txtQuantity.Text != string.Empty) { propertyVo.Quantity = float.Parse(txtQuantity.Text.ToString()); } if (txtPurchaseValue.Text != string.Empty) { propertyVo.PurchaseValue = float.Parse(txtPurchaseValue.Text.ToString()); } if (txtCurrentPrice.Text != string.Empty) { propertyVo.CurrentPrice = float.Parse(txtCurrentPrice.Text.ToString()); } if (txtCurrentValue.Text != string.Empty) { propertyVo.CurrentValue = float.Parse(txtCurrentValue.Text.ToString()); } if (txtSaleDate.Text != "") { propertyVo.SellDate = Convert.ToDateTime(txtSaleDate.Text); } else { propertyVo.SellDate = DateTime.MinValue; } if (txtSaleRate.Text != "") { propertyVo.SellPrice = float.Parse(txtSaleRate.Text.ToString()); } if (txtSaleProceeds.Text != "") { propertyVo.SellValue = float.Parse(txtSaleProceeds.Text.ToString()); } propertyVo.Remark = txtRemarks.Text.ToString().Trim(); if (propertyBo.UpdatePropertyPortfolio(propertyVo, userVo.UserId)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('PortfolioProperty','none');", true); //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('PortfolioProperty','none');", true); } } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioPropertyEntry.ascx:btnSubmit_Click()"); object[] objects = new object[5]; objects[0] = propertyVo; objects[1] = AssetGroupCode; objects[2] = userVo; objects[3] = customerVo; objects[4] = customerAccountsVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public ActionResult Create() { var vo = new PropertyVo(); return(View(vo)); }