コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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;
            }
        }