Esempio n. 1
0
        private void UpdatePortfolioDetails()
        {
            newCustomerPortfolioVo = new CustomerPortfolioVo();
            dsPortfolioType        = new DataSet();
            try
            {
                if (txtCustomerId.Value != string.Empty)
                {
                    customerId = int.Parse(txtCustomerId.Value);
                }
                newCustomerPortfolioVo.PortfolioId = int.Parse(Session["PortfolioId"].ToString());
                dsPortfolioType = portfolioBo.GetCustomerPortfolioDetails(newCustomerPortfolioVo.PortfolioId);
                newCustomerPortfolioVo.CustomerId = customerId;
                if (dsPortfolioType.Tables[0].Rows[0]["CP_IsMainPortfolio"].ToString() != "")
                {
                    newCustomerPortfolioVo.IsMainPortfolio = int.Parse(dsPortfolioType.Tables[0].Rows[0]["CP_IsMainPortfolio"].ToString());
                }
                newCustomerPortfolioVo.PMSIdentifier     = txtPMSIdentifier.Text;
                newCustomerPortfolioVo.PortfolioName     = txtPortfolioName.Text;
                newCustomerPortfolioVo.PortfolioTypeCode = ddlPortfolioType.SelectedValue;

                portfolioBo.UpdateCustomerPortfolio(newCustomerPortfolioVo, rmVo.UserId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "GroupAccountSetup.ascx:SavePortfolioDetails()");
                object[] objects = new object[0];

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
Esempio n. 2
0
        //protected void gvCustomerPortfolio_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerVo.CustomerId);

        //    DataTable dt = new DataTable();
        //    dt.Columns.Add("PortfolioId");
        //    dt.Columns.Add("lblPortfolioName");

        //    DataRowView drv = e.Row.DataItem as DataRowView;


        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {

        //        DropDownList ddlType;

        //        ddlType = e.Row.FindControl("ddlType") as DropDownList;

        //        RadioButton rbtn;
        //        rbtn = e.Row.FindControl("rbtnPortfolio") as RadioButton;
        //        if (ddlType != null)
        //        {

        //            ddlType.DataSource = BindPortfolioType(path);
        //            ddlType.DataTextField = "PortfolioType";
        //            ddlType.DataValueField = "PortfolioTypeCode";
        //            ddlType.DataBind();
        //            customerPortfolioVo = new CustomerPortfolioVo();
        //            customerPortfolioVo = customerPortfolioList[gvCustomerPortfolio.Rows.Count];
        //            /*Bind the Selected Value to the Drop Down*/

        //            ddlType.SelectedValue = customerPortfolioVo.PortfolioTypeCode.ToString();

        //            if (customerPortfolioVo.IsMainPortfolio == 1)
        //            {



        //                rbtn.Checked = true;

        //            }
        //            else
        //            {
        //                rbtn.Checked = false;
        //            }
        //        }
        //    }
        //    if (e.Row.RowType == DataControlRowType.Footer)
        //    {
        //        DropDownList ddlAddType;

        //        ddlAddType = e.Row.FindControl("ddlAddType") as DropDownList;
        //        if (ddlAddType != null)
        //        {
        //            ddlAddType.DataSource = BindPortfolioType(path);
        //            ddlAddType.DataTextField = "PortfolioType";
        //            ddlAddType.DataValueField = "PortfolioTypeCode";
        //            ddlAddType.DataBind();
        //            ddlAddType.Items.Insert(0, "Select the Portfolio Type");
        //        }

        //    }
        //}

        //protected void gvCustomerPortfolio_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    int index = int.Parse(gvCustomerPortfolio.SelectedRow.RowIndex.ToString());
        //    int portfolioId = int.Parse(gvCustomerPortfolio.DataKeys[index].Value.ToString());
        //    Session[SessionContents.PortfolioId] = portfolioId;
        //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioDashboard','none');", true);
        //}

        protected void btnAddPortfolio_Click(object sender, EventArgs e)
        {
            string newPortfolioName = string.Empty;
            string newPMSIdentifier = string.Empty;
            string newPortfolioType = "RGL";
            int    IsMainPortfolio;

            CustomerPortfolioBo customerPortfolioBo    = new CustomerPortfolioBo();
            CustomerPortfolioVo newCustomerPortfolioVo = new CustomerPortfolioVo();



            GridViewRow footerRow = gvCustomerPortfolio.FooterRow;

            DropDownList ddl = (DropDownList)footerRow.FindControl("ddlAddType");

            if (footerRow.Enabled)
            {
                if (((TextBox)footerRow.FindControl("txtPortfolioName")).Text.Trim() != "")
                {
                    newPortfolioName = ((TextBox)footerRow.FindControl("txtPortfolioName")).Text;
                }
                if (((RadioButton)footerRow.FindControl("rbtnAddMainPortfolio")).Checked)
                {
                    IsMainPortfolio = 1;
                    foreach (GridViewRow oldrow in gvCustomerPortfolio.Rows)
                    {
                        ((RadioButton)oldrow.FindControl("rbtnPortfolio")).Checked = false;
                    }
                }
                else
                {
                    IsMainPortfolio = 0;
                }
                if (((DropDownList)footerRow.FindControl("ddlAddType")).SelectedItem.Value.Trim().ToString() != "")
                {
                    if (ddl.SelectedIndex != 0)
                    {
                        newPortfolioType = ddl.SelectedItem.Value.ToString();
                    }
                }
                if (((TextBox)footerRow.FindControl("txtPMSIdentifier")).Text.Trim() != "")
                {
                    if (newPortfolioType == "PMS")
                    {
                        newPMSIdentifier = ((TextBox)footerRow.FindControl("txtPMSIdentifier")).Text;
                    }
                }

                if (newPMSIdentifier == "" && newPortfolioName == "" && ddl.SelectedIndex == 0)
                {
                }
                else
                {
                    newCustomerPortfolioVo.CustomerId        = customerVo.CustomerId;
                    newCustomerPortfolioVo.IsMainPortfolio   = IsMainPortfolio;
                    newCustomerPortfolioVo.PMSIdentifier     = newPMSIdentifier;
                    newCustomerPortfolioVo.PortfolioName     = newPortfolioName;
                    newCustomerPortfolioVo.PortfolioTypeCode = newPortfolioType;


                    portfolioBo.CreateCustomerPortfolio(newCustomerPortfolioVo, userVo.UserId);

                    newPMSIdentifier = string.Empty;
                    newPortfolioName = string.Empty;
                }
            }



            foreach (GridViewRow dr in gvCustomerPortfolio.Rows)
            {
                if (((Label)dr.FindControl("lblPortfolioName")).Text.Trim() != "")
                {
                    newPortfolioName = ((Label)dr.FindControl("lblPortfolioName")).Text;
                }
                if (((RadioButton)dr.FindControl("rbtnPortfolio")).Checked)
                {
                    IsMainPortfolio = 1;
                }
                else
                {
                    IsMainPortfolio = 0;
                }
                if (((DropDownList)dr.FindControl("ddlType")).SelectedItem.Value.Trim().ToString() != "")
                {
                    DropDownList ddlType = (DropDownList)dr.FindControl("ddlType");

                    newPortfolioType = ddlType.SelectedItem.Value.ToString();
                }
                if (((Label)dr.FindControl("lblPMSIdentifier")).Text.Trim() != "")
                {
                    if (newPortfolioType == "PMS")
                    {
                        newPMSIdentifier = ((Label)dr.FindControl("lblPMSIdentifier")).Text;
                    }
                }
                else
                {
                    newPMSIdentifier = string.Empty;
                }

                newCustomerPortfolioVo.CustomerId        = customerVo.CustomerId;
                newCustomerPortfolioVo.IsMainPortfolio   = IsMainPortfolio;
                newCustomerPortfolioVo.PMSIdentifier     = newPMSIdentifier;
                newCustomerPortfolioVo.PortfolioName     = newPortfolioName;
                newCustomerPortfolioVo.PortfolioTypeCode = newPortfolioType;
                if (((Label)dr.FindControl("PortfolioId")).Text.Trim() != "")
                {
                    newCustomerPortfolioVo.PortfolioId = int.Parse(((Label)dr.FindControl("PortfolioId")).Text);
                }

                portfolioBo.UpdateCustomerPortfolio(newCustomerPortfolioVo, userVo.UserId);
                newPortfolioName = string.Empty;
                newPMSIdentifier = string.Empty;
            }

            customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(customerVo.CustomerId);
            Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
            // BindGrid

            BindGridView();
        }