protected void ddlTradeAccountNos_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlTradeAccountNos.SelectedValue != "-1")
            {
                CustomerTransactionBo customerTransactionBo = new CustomerTransactionBo();
                CustomerAccountsVo    customerAccountsVo    = new CustomerAccountsVo();
                CustomerPortfolioVo   customerPortfolioVo   = new CustomerPortfolioVo();
                PortfolioBo           portfolioBo           = new PortfolioBo();
                CustomerVo            customerVo            = customerBo.GetCustomer(Convert.ToInt32(txtParentCustomerId.Value));

                customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(customerVo.CustomerId);
                customerAccountsVo  = customerTransactionBo.GetCustomerEQAccountDetails(int.Parse(ddlTradeAccountNos.SelectedValue.ToString()), customerPortfolioVo.PortfolioId);
                if (rdoDelivery.Checked)
                {
                    hidBrokerRate.Value = customerAccountsVo.BrokerageDeliveryPercentage.ToString();
                }
                else
                {
                    hidBrokerRate.Value = customerAccountsVo.BrokerageSpeculativePercentage.ToString();
                }
                hidOtherCharges.Value = customerAccountsVo.OtherCharges.ToString();
            }
            else
            {
                hidBrokerRate.Value   = "0";
                hidOtherCharges.Value = "0";
            }
        }
示例#2
0
        private void GetLatestValuationDate()
        {
            PortfolioBo portfolioBo = null;

            try
            {
                portfolioBo = new PortfolioBo();
                if (portfolioBo.GetLatestValuationDate(advisorVo.advisorId, "EQ") != null)
                {
                    EQValuationDate = DateTime.Parse(portfolioBo.GetLatestValuationDate(advisorVo.advisorId, "EQ").ToString());
                }
                if (portfolioBo.GetLatestValuationDate(advisorVo.advisorId, "MF") != null)
                {
                    MFValuationDate = DateTime.Parse(portfolioBo.GetLatestValuationDate(advisorVo.advisorId, "MF").ToString());
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "PortfolioDashboard.ascx.cs:GetLatestValuationDate()");
                object[] objects = new object[2];
                objects[0]   = EQValuationDate;
                objects[1]   = MFValuationDate;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void ShowCustomerPortfolios()
        {
            int         customerId  = int.Parse(txtCustomerId.Value.ToString());
            PortfolioBo portfolioBo = new PortfolioBo();
            List <CustomerPortfolioVo> customerPortfolioVoList = new List <CustomerPortfolioVo>();

            tdPortfolios.Visible    = true;
            customerPortfolioVoList = portfolioBo.GetCustomerPortfolios(customerId);
            ddlPortfolios.Items.Clear();
            if (customerPortfolioVoList != null)
            {
                for (int i = 0; i < customerPortfolioVoList.Count; i++)
                {
                    ddlPortfolios.Items.Add(new ListItem(customerPortfolioVoList[i].PortfolioName, customerPortfolioVoList[i].PortfolioId.ToString()));
                    if (customerPortfolioVoList[i].IsMainPortfolio == 1)
                    {
                        ddlPortfolios.Items[i].Selected = true;
                    }
                }
            }
            else
            {
                ddlPortfolios.Items.Add(new ListItem("No Portfolios Available", "NA"));
            }
        }
        /// <summary>
        /// This Returns all portfolio Id of a particular customer. Author:Pramod
        /// </summary>
        /// <param name="customerId"></param>
        /// <returns></returns>
        private string GetCustomerAllPortfolio(int customerId)
        {
            string      portfolioIDs = "";
            PortfolioBo portfolioBo  = new PortfolioBo();

            if (!String.IsNullOrEmpty(customerId.ToString())) //Note : customer Id assigned to txtCustomerId(hidden field) when the user selects customer from customer name suggestion text box
            {
                //int customerId = Convert.ToInt32(txtParentCustomerId.Value);
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId); //Get all the portfolios of the selected customer.
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)                              //One or more folios available for selected customer
                {
                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (custPortfolio.PortfolioName == "MyPortfolio" || custPortfolio.PortfolioName == "MyPortfolioProspect")
                        {
                            portfolioIDs = portfolioIDs + custPortfolio.PortfolioId;
                            portfolioIDs = portfolioIDs + ",";
                        }
                        //checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                        //checkboxList.Items.Add(new ListItem(custPortfolio.PortfolioName, custPortfolio.PortfolioId.ToString()));
                    }
                }
            }

            return(portfolioIDs);
        }
        private void GetLatestValuationDate()
        {
            DateTime    EQValuationDate           = new DateTime();
            DateTime    MFValuationDate           = new DateTime();
            PortfolioBo portfolioBo               = null;
            Dictionary <string, DateTime> genDict = new Dictionary <string, DateTime>();
            AdvisorVo advisorVo = new AdvisorVo();
            int       adviserId = 0;

            advisorVo = (AdvisorVo)Session["advisorVo"];
            adviserId = advisorVo.advisorId;

            try
            {
                portfolioBo = new PortfolioBo();
                if (userVo.UserType == "Advisor")
                {
                    advisorVo = (AdvisorVo)Session["advisorVo"];
                    adviserId = advisorVo.advisorId;
                }
                else if (userVo.UserType == "RM")
                {
                    adviserId = int.Parse(Session["adviserId"].ToString());
                }

                if (portfolioBo.GetLatestValuationDate(adviserId, "EQ") != null)
                {
                    EQValuationDate = DateTime.Parse(portfolioBo.GetLatestValuationDate(adviserId, "EQ").ToString());
                }
                if (portfolioBo.GetLatestValuationDate(adviserId, "MF") != null)
                {
                    MFValuationDate = DateTime.Parse(portfolioBo.GetLatestValuationDate(adviserId, "MF").ToString());
                }
                genDict.Add("EQDate", EQValuationDate);
                genDict.Add("MFDate", MFValuationDate);
                Session["ValuationDate"] = genDict;
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "PortfolioDashboard.ascx.cs:GetLatestValuationDate()");
                object[] objects = new object[3];
                objects[0]   = EQValuationDate;
                objects[1]   = adviserId;
                objects[2]   = MFValuationDate;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#6
0
        protected void ddlActionForProspect_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            int                 userId              = 0;
            UserBo              userBo              = new UserBo();
            bool                isGrpHead           = false;
            CustomerVo          customerVo          = new CustomerVo();
            CustomerPortfolioVo customerPortfolioVo = new CustomerPortfolioVo();
            PortfolioBo         portfolioBo         = new PortfolioBo();
            CustomerBo          customerBo          = new CustomerBo();
            int                 ParentId;

            if (Session[SessionContents.PortfolioId] != null)
            {
                Session.Remove(SessionContents.PortfolioId);
            }
            LinkButton lnkAction = (LinkButton)sender;
            //RadComboBox ddlAction = (RadComboBox)sender;
            GridDataItem item = (GridDataItem)lnkAction.NamingContainer;

            ParentId = int.Parse(gvLeadList.MasterTableView.DataKeyValues[item.ItemIndex]["C_CustomerId"].ToString());

            Session["ParentIdForDelete"] = ParentId;
            customerVo            = customerBo.GetCustomer(ParentId);
            Session["CustomerVo"] = customerVo;
            isGrpHead             = customerBo.CheckCustomerGroupHead(ParentId);

            //to set portfolio Id and its details
            customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(ParentId);
            //Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
            Session["customerPortfolioVo"] = customerPortfolioVo;

            Session["IsDashboard"] = "false";
            customerPortfolioVo    = portfolioBo.GetCustomerDefaultPortfolio(ParentId);
            if (customerVo.IsProspect == 0)
            {
                //Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
                //Session["customerPortfolioVo"] = customerPortfolioVo;
                //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "RMCustomerIndividualDashboard", "loadcontrol('RMCustomerIndividualDashboard','login');", true);
            }
            else
            {
                isGrpHead = customerBo.CheckCustomerGroupHead(ParentId);
                if (isGrpHead == false)
                {
                    ParentId = customerBo.GetCustomerGroupHead(ParentId);
                }
                else
                {
                    ParentId = customerVo.CustomerId;
                }
                Session[SessionContents.FPS_ProspectList_CustomerId]     = ParentId;
                Session[SessionContents.FPS_AddProspectListActionStatus] = "View";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('AddProspectList','login');", true);
                //Session[SessionContents.FPS_TreeView_Status] = "FinanceProfile";
            }
        }
        private void ShowFolios()
        {
            PortfolioBo portfolioBo = new PortfolioBo();

            //divPortfolios.InnerHtml = string.Empty;
            if (!String.IsNullOrEmpty(hdnCustomerId1.Value)) //Note : customer Id assigned to hdnCustomerId(hidden field) when the user selects customer from customer name suggestion text box
            {
                int customerId = Convert.ToInt32(hdnCustomerId1.Value);
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId); //Get all the portfolios of the selected customer.
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)                              //One or more folios available for selected customer
                {
                    StringBuilder checkbox = new StringBuilder();

                    //CheckBoxList checkboxList = new CheckBoxList();
                    //checkboxList.RepeatDirection = RepeatDirection.Horizontal;
                    //checkboxList.CssClass = "Field";
                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (ddlPortfolioGroup.SelectedValue == "MANAGED" && (custPortfolio.IsMainPortfolio != 1))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No managed portfolios found for this customer.Can't create report.</span>");
                            }
                            continue;
                        }
                        else if (ddlPortfolioGroup.SelectedValue == "UN_MANAGED" & (custPortfolio.IsMainPortfolio != 0))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No unmanaged portfolios found for this customer.Can't create report.</span>");
                            }
                            continue;
                        }
                        if (String.IsNullOrEmpty(custPortfolio.PortfolioName))
                        {
                            custPortfolio.PortfolioName = "No Name";
                        }
                        //checkboxList.Items.Add(new ListItem(custPortfolio.PortfolioName, custPortfolio.PortfolioId.ToString()));
                        checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                    }
                    divPortfolios.InnerHtml = checkbox.ToString();
                    //divPortfolios.Controls.Add(checkboxList);
                }
                else //No portfolios found for this customer.
                {
                    divPortfolios.InnerHtml = "<span class='Error'>No portfolios found for this customer.Can't create report.</span>";
                }
            }
            else // Something went wrong :( customer id is not assigned to the hidden field.
            {
                divPortfolios.InnerHtml = "<span class='Error'>Invalid Customer selected.</span>";
            }
            //divGroupCustomers.InnerHtml = string.Empty;
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            PortfolioBo portfolioBo = new PortfolioBo();

            String statusMsg                = string.Empty;
            int    totalFoliosMoved         = 0;
            CustomerPortfolioVo portfolioVo = new CustomerPortfolioVo();

            if (txtCustomerId.Value != string.Empty)
            {
                string portfolio = ddlAdvisorBranchList.SelectedValue;
                portfolioVo = portfolioBo.GetCustomerDefaultPortfolio1((Convert.ToInt32(txtCustomerId.Value)), portfolio);
                if (portfolioVo.PortfolioId < 1)
                {
                    lblMessage.Text    = "No default Portfolio found for the selected customer.";
                    lblMessage.Visible = true;
                    return;
                }
            }
            else
            {
                lblMessage.Text    = "Please select a customer.";
                lblMessage.Visible = true;
                return;
            }


            foreach (GridViewRow dr in gvMFFolio.Rows)
            {
                CheckBox checkBox = (CheckBox)dr.FindControl("chkBox");
                if (checkBox.Checked)
                {
                    int  MFAccountId = Convert.ToInt32(gvMFFolio.DataKeys[dr.RowIndex].Values[0]);
                    bool isUpdated   = PortfolioBo.TransferFolio(MFAccountId, portfolioVo.PortfolioId);
                    if (isUpdated)
                    {
                        totalFoliosMoved++;
                    }
                    else
                    {
                        statusMsg += "<br/>Error occurred while moving folio with mutual fund accountId " + MFAccountId + ".<br/>";
                    }
                }
            }
            if (totalFoliosMoved > 0)
            {
                statusMsg += "<b style='color:Green'>Total Folios moved = " + totalFoliosMoved + "</b>";
            }
            //lblMessage.Text = statusMsg;
            //lblMessage.Visible = true;
            lblTransferMsg.Text = statusMsg;
            divMessage.Attributes.Add("class", "yellow-box");
            BindFolioGridView();
        }
        private void ShowFolios()
        {
            PortfolioBo portfolioBo = new PortfolioBo();

            if (!String.IsNullOrEmpty(hdnCustomerId1.Value))
            {
                int customerId = Convert.ToInt32(hdnCustomerId1.Value);
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId);
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)
                {
                    StringBuilder checkbox = new StringBuilder();


                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (ddlPortfolioGroup.SelectedValue == "MANAGED" && (custPortfolio.IsMainPortfolio != 1))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No managed portfolios found for this customer.Can't create report.</span>");
                            }
                            continue;
                        }
                        else if (ddlPortfolioGroup.SelectedValue == "UN_MANAGED" & (custPortfolio.IsMainPortfolio != 0))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No unmanaged portfolios found for this customer.Can't create report.</span>");
                            }
                            continue;
                        }
                        if (String.IsNullOrEmpty(custPortfolio.PortfolioName))
                        {
                            custPortfolio.PortfolioName = "No Name";
                        }
                        checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                    }
                    divPortfolios.InnerHtml = checkbox.ToString();
                }
                else
                {
                    divPortfolios.InnerHtml = "<span class='Error'>No portfolios found for this customer.Can't create report.</span>";
                }
            }
            else
            {
                divPortfolios.InnerHtml = "<span class='Error'>Invalid Customer selected.</span>";
            }
        }
        private string ShowGroupFolios(int customerId)
        {
            StringBuilder checkbox    = new StringBuilder();
            PortfolioBo   portfolioBo = new PortfolioBo();

            if (!String.IsNullOrEmpty(hdnCustomerId1.Value)) //Note : customer Id assigned to txtCustomerId(hidden field) when the user selects customer from customer name suggestion text box
            {
                //int customerId = Convert.ToInt32(txtParentCustomerId.Value);
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId); //Get all the portfolios of the selected customer.
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)                              //One or more folios available for selected customer
                {
                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (ddlGroupPortfolioGroup.SelectedValue == "MANAGED" && (custPortfolio.IsMainPortfolio != 1))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        else if (ddlGroupPortfolioGroup.SelectedValue == "UN_MANAGED" & (custPortfolio.IsMainPortfolio != 0))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        if (String.IsNullOrEmpty(custPortfolio.PortfolioName))
                        {
                            custPortfolio.PortfolioName = "No Name";
                        }
                        checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                        //checkboxList.Items.Add(new ListItem(custPortfolio.PortfolioName, custPortfolio.PortfolioId.ToString()));
                    }
                    //control.Controls.Add(checkboxList);
                }
                else //No portfolios found for this customer.
                {
                    checkbox.Append("--");
                }
            }
            else // Something went wrong :( customer id is not assigned to the hidden field.
            {
                divPortfolios.InnerHtml = "<span class='Error'>Invalid Customer selected.</span>";
            }
            return(checkbox.ToString());
        }
        private string ShowGroupFolios(int customerId)
        {
            StringBuilder checkbox    = new StringBuilder();
            PortfolioBo   portfolioBo = new PortfolioBo();

            if (!String.IsNullOrEmpty(hdnCustomerId1.Value))
            {
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId);
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)
                {
                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (ddlGroupPortfolioGroup.SelectedValue == "MANAGED" && (custPortfolio.IsMainPortfolio != 1))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        else if (ddlGroupPortfolioGroup.SelectedValue == "UN_MANAGED" & (custPortfolio.IsMainPortfolio != 0))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        if (String.IsNullOrEmpty(custPortfolio.PortfolioName))
                        {
                            custPortfolio.PortfolioName = "No Name";
                        }
                        checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                    }
                }
                else
                {
                    checkbox.Append("--");
                }
            }
            else
            {
                divPortfolios.InnerHtml = "<span class='Error'>Invalid Customer selected.</span>";
            }
            return(checkbox.ToString());
        }
        private string ShowGroupFolios(int customerId)
        {
            StringBuilder checkbox    = new StringBuilder();
            PortfolioBo   portfolioBo = new PortfolioBo();

            if (!String.IsNullOrEmpty(hdnCustomerId1.Value))                                                     //Note : customer Id assigned to txtCustomerId(hidden field) when the user selects customer from customer name suggestion text box
            {
                List <CustomerPortfolioVo> customerPortfolioVos = portfolioBo.GetCustomerPortfolios(customerId); //Get all the portfolios of the selected customer.
                if (customerPortfolioVos != null && customerPortfolioVos.Count > 0)                              //One or more folios available for selected customer
                {
                    foreach (CustomerPortfolioVo custPortfolio in customerPortfolioVos)
                    {
                        if (ddlGroupPortfolioGroup.SelectedValue == "MANAGED" && (custPortfolio.IsMainPortfolio != 1))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        else if (ddlGroupPortfolioGroup.SelectedValue == "UN_MANAGED" & (custPortfolio.IsMainPortfolio != 0))
                        {
                            if (customerPortfolioVos.Count == 1)
                            {
                                checkbox.Append("<span class='Error'>No portfolio</span>");
                            }
                            continue;
                        }
                        if (String.IsNullOrEmpty(custPortfolio.PortfolioName))
                        {
                            custPortfolio.PortfolioName = "No Name";
                        }
                        checkbox.Append("<input type='checkbox' checked name='chk--" + custPortfolio.PortfolioId + "' id='chk--" + custPortfolio.PortfolioId + "'>" + custPortfolio.PortfolioName);
                    }
                }
                else //No portfolios found for this customer.
                {
                    checkbox.Append("--");
                }
            }

            return(checkbox.ToString());
        }
        private void bindDropdownPickPortfolio(int customerId)
        {
            PortfolioBo portfolioBo = new PortfolioBo();

            try
            {
                if (txtCustomerId.Value != null)
                {
                    dsCustomerPortfolioList         = portfolioBo.GetCustomerPortfolio(customerId);
                    ddlPickPortfolio.DataSource     = dsCustomerPortfolioList;
                    ddlPickPortfolio.DataValueField = dsCustomerPortfolioList.Tables[0].Columns["CP_PortfolioId"].ToString();
                    ddlPickPortfolio.DataTextField  = dsCustomerPortfolioList.Tables[0].Columns["CP_PortfolioName"].ToString();
                    ddlPickPortfolio.DataBind();
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
        }
示例#14
0
        private void GetLatestValuationDate()
        {
            DateTime    EQValuationDate = new DateTime();
            DateTime    MFValuationDate = new DateTime();
            PortfolioBo portfolioBo     = null;

            genDict = new Dictionary <string, DateTime>();
            AdvisorVo advisorVo = new AdvisorVo();
            int       adviserId = 0;

            try
            {
                portfolioBo = new PortfolioBo();
                advisorVo   = (AdvisorVo)Session[SessionContents.AdvisorVo];
                adviserId   = advisorVo.advisorId;
                if (portfolioBo.GetLatestValuationDate(adviserId, Constants.MF.ToString()) != null)
                {
                    MFValuationDate = DateTime.Parse(portfolioBo.GetLatestValuationDate(adviserId, Constants.MF.ToString()).ToString());
                }
                genDict.Add(Constants.MFDate.ToString(), MFValuationDate);
                Session[SessionContents.ValuationDate] = genDict;
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "PortfolioDashboard.ascx.cs:GetLatestValuationDate()");
                object[] objects = new object[3];
                objects[0]   = EQValuationDate;
                objects[1]   = adviserId;
                objects[2]   = MFValuationDate;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void btnAddTradeAccount_Click(object sender, EventArgs e)
        {
            CustomerPortfolioVo customerPortfolioVo = new CustomerPortfolioVo();
            PortfolioBo         portfolioBo         = new PortfolioBo();
            CustomerVo          customerVo          = customerBo.GetCustomer(Convert.ToInt32(txtParentCustomerId.Value));

            customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(customerVo.CustomerId);
            Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
            Session["CustomerVo"] = customerVo;

            SaveCurrentPageState();


            string queryString = "?prevPage=MultipleEqEntry";

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('CustomerEQAccountAdd','" + queryString + "');", true);



            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('CustomerEQAccountAdd','none')", true);

            //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('CustomerEQAccountAdd','none');", true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            advisorVo         = (AdvisorVo)Session["advisorVo"];
            userType          = Session["UserType"].ToString().ToLower();
            rmVo              = (RMVo)Session[SessionContents.RmVo];
            rmid              = rmVo.RMId;
            trMessage.Visible = false;
            schemeplanid      = 0;
            //trModalPopup.Visible = false;
            //ValuationDate = DateTime.Now.Date;

            SessionBo.CheckSession();
            userVo    = (UserVo)Session["userVo"];
            rmVo      = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
            bmID      = rmVo.RMId;
            AdviserID = advisorVo.advisorId;


            if (!IsPostBack)
            {
                PortfolioBo portfoliobo = new PortfolioBo();
                string      valuedate   = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));
                hdnValuationDate.Value = valuedate.ToString();
                if (hdnValuationDate.Value == string.Empty)
                {
                    ValuationNotDoneErrorMsg.Visible = true;
                    if (userType == "adviser")
                    {
                        BindBranchDropDown();
                        BindRMDropDown();
                    }
                    else if (userType == "rm")
                    {
                        spnBranch.Visible = false;
                        spnRM.Visible     = false;
                    }
                    else if (userType == "bm")
                    {
                        BindBranchForBMDropDown();
                        BindRMforBranchDropdown(0, bmID, 1);
                    }
                }
                else
                {
                    ValuationNotDoneErrorMsg.Visible = false;

                    if (userType == "rm")
                    {
                        spnBranch.Visible = false;
                        spnRM.Visible     = false;
                    }
                    if (userType == "adviser")
                    {
                        BindBranchDropDown();
                        BindRMDropDown();
                    }
                    if (userType == "bm")
                    {
                        if (!IsPostBack)
                        {
                            BindBranchForBMDropDown();
                            BindRMforBranchDropdown(0, bmID, 1);
                        }
                        hdnbranchId.Value     = "0";
                        hdnbranchHeadId.Value = ddlBranch.SelectedValue;
                        hdnAll.Value          = "2";
                        hdnXWise.Value        = "2";
                        hdnrmId.Value         = "0";
                    }
                }

                if (Request.QueryString["schemeplanid"] != null)
                {
                    schemeplanid        = int.Parse(Request.QueryString["schemeplanid"].ToString());
                    LatestValuationdate = DateTime.Parse(Request.QueryString["latestValuationdate"].ToString());
                }
                else
                {
                    valuedate = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));
                    if (valuedate != "")
                    {
                        LatestValuationdate = Convert.ToDateTime(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));
                        //Valuation date storing in Hiddenfield For all page Export
                        hdnValuationDate.Value = LatestValuationdate.ToString();
                    }
                }
                if (LatestValuationdate != DateTime.MinValue)
                {
                    txtDate.Text = LatestValuationdate.Date.ToShortDateString();
                    bindgrid(LatestValuationdate, schemeplanid);
                }
                //else
                //{
                //    trMessage.Visible = true;
                //    lblMessage.Text = "No valuation done";

                //}
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            advisorVo = (AdvisorVo)Session["advisorVo"];
            path      = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());

            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops")
            {
                userType = "advisor";
            }
            else
            {
                userType = Session[SessionContents.CurrentUserRole].ToString().ToLower();
            }

            advisorId = advisorVo.advisorId;
            PortfolioBo portfoliobo = new PortfolioBo();
            string      valuedate   = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorId, "EQ"));

            hdnValuationDate.Value = valuedate.ToString();
            if (hdnValuationDate.Value == string.Empty)
            {
                if (userType == "advisor")
                {
                    BindBranchDropDown();
                    BindRMDropDown();
                }
                else if (userType == "rm")
                {
                    trBranchRmDpRow.Visible = false;
                }
                else if (userType == "bm")
                {
                    BindBranchForBMDropDown();
                    BindRMforBranchDropdown(0, bmID, 1);
                    trComSecWiseOptions.Visible = true;
                }
            }
            else
            {
                try
                {
                    /* For UserType */
                    advisorVo = (AdvisorVo)Session["advisorVo"];
                    path      = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());

                    if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops")
                    {
                        userType = "advisor";
                    }
                    else
                    {
                        userType = Session[SessionContents.CurrentUserRole].ToString().ToLower();
                    }

                    SessionBo.CheckSession();
                    userVo          = (UserVo)Session["userVo"];
                    rmVo            = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
                    bmID            = rmVo.RMId;
                    gvEQMIS.Visible = false;
                    if (!IsPostBack)
                    {
                        if (valuedate != "")
                        {
                            LatestValuationdate    = Convert.ToDateTime(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "EQ"));
                            hdnValuationDate.Value = LatestValuationdate.ToString();
                        }
                        if (LatestValuationdate != DateTime.MinValue)
                        {
                            txtEQDate.Text = LatestValuationdate.Date.ToShortDateString();
                        }
                        BindMISTypeDropDown();
                    }

                    dsGetLastTradeDate = customertransactionbo.GetLastTradeDate();
                    DateTime dtLastTradeDate;

                    if (valuedate != "")
                    {
                        LatestValuationdate    = Convert.ToDateTime(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "EQ"));
                        hdnValuationDate.Value = LatestValuationdate.ToString();
                    }
                    if (LatestValuationdate != DateTime.MinValue)
                    {
                        txtEQDate.Text = LatestValuationdate.Date.ToShortDateString();
                    }


                    if (dsGetLastTradeDate.Tables[0].Rows.Count != 0)
                    {
                        dtLastTradeDate = (DateTime)dsGetLastTradeDate.Tables[0].Rows[0]["WTD_Date"];
                    }

                    //to hide the dropdown selection for mis type for adviser and bm
                }
                catch (BaseApplicationException Ex)
                {
                    throw Ex;
                }
                catch (Exception Ex)
                {
                    BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                    NameValueCollection      FunctionInfo = new NameValueCollection();

                    FunctionInfo.Add("Method", "AddBranch.ascx:PageLoad()");

                    object[] objects = new object[2];
                    objects[0]   = advisorVo;
                    objects[1]   = path;
                    FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                    exBase.AdditionalInformation = FunctionInfo;
                    ExceptionManager.Publish(exBase);
                    throw exBase;
                }
            }
        }
        /// <summary>
        /// Creating Data Table For "ELIGIBLE CAPITAL GAIN DETAILS & SUMMARY" Report : "Author:Pramod"
        /// </summary>
        /// <param name="reports">"reports" is a object of "MFReportVo" Contails report parameters </param>
        /// <returns> DataTable</returns>
        public DataTable GetEligibleCapitalGainDetailsReport(MFReportVo reports)
        {
            DataTable dtEligibleCapitalGainDetails = new DataTable();

            dtEligibleCapitalGainDetails.Columns.Add("CustomerName");
            dtEligibleCapitalGainDetails.Columns.Add("CustomerId");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioName");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioId");
            dtEligibleCapitalGainDetails.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("RedDate");
            dtEligibleCapitalGainDetails.Columns.Add("RedAmount", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("DaysInvestedFor");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseDate");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseAmount", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("FolioNum");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanCode");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanName");

            dtEligibleCapitalGainDetails.Columns.Add("STCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("LTCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("Category");
            dtEligibleCapitalGainDetails.Columns.Add("CurrNAV", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("CurrVALUE", System.Type.GetType("System.Double"));

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == false && mFPortfolioTransaction.BuyDate < reports.ToDate)
                                {
                                    DataRow drEligibleCapitalGainDetails = dtEligibleCapitalGainDetails.NewRow();

                                    drEligibleCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drEligibleCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drEligibleCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drEligibleCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Units"]      = mFPortfolioTransaction.BuyQuantity;
                                    drEligibleCapitalGainDetails["RedDate"]    = mFPortfolioTransaction.SellDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["RedAmount"]  = mFPortfolioTransaction.NetSalesProceed;

                                    drEligibleCapitalGainDetails["DaysInvestedFor"] = mFPortfolioTransaction.AgeOfInvestment;

                                    drEligibleCapitalGainDetails["PurchaseDate"]   = mFPortfolioTransaction.BuyDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["PurchaseAmount"] = mFPortfolioTransaction.CostOfAcquisition;

                                    drEligibleCapitalGainDetails["FolioNum"]       = mFPortfolioVo.Folio;
                                    drEligibleCapitalGainDetails["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drEligibleCapitalGainDetails["SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drEligibleCapitalGainDetails["STCGTax"]  = mFPortfolioTransaction.STCGTax;
                                    drEligibleCapitalGainDetails["LTCGTax"]  = mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Category"] = mFPortfolioVo.Category;

                                    drEligibleCapitalGainDetails["CurrNAV"]   = mFPortfolioTransaction.CurrentNAV;
                                    drEligibleCapitalGainDetails["CurrVALUE"] = mFPortfolioTransaction.CurrentValue;


                                    dtEligibleCapitalGainDetails.Rows.Add(drEligibleCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtEligibleCapitalGainDetails);
        }
        public DataTable GetCapitalGainSummaryReport(MFReportVo reports)
        {
            DataTable dtCapitalGainSummary = new DataTable();

            dtCapitalGainSummary.Columns.Add("CustomerName");
            dtCapitalGainSummary.Columns.Add("CustomerId");
            dtCapitalGainSummary.Columns.Add("PortfolioName");
            dtCapitalGainSummary.Columns.Add("PortfolioId");
            dtCapitalGainSummary.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtCapitalGainSummary.Columns.Add("FolioNum");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanCode");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanName");


            dtCapitalGainSummary.Columns.Add("STCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("LTCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("Category");


            DataRow dtRow = dtCapitalGainSummary.NewRow();

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == true && mFPortfolioTransaction.SellDate > reports.FromDate && mFPortfolioTransaction.SellDate < reports.ToDate)
                                {
                                    DataRow drCapitalGainDetails = dtCapitalGainSummary.NewRow();

                                    drCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drCapitalGainDetails["GainOrLoss"]          = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["FolioNum"]            = mFPortfolioVo.Folio;
                                    drCapitalGainDetails["PASP_SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drCapitalGainDetails["PASP_SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drCapitalGainDetails["STCGAmount"] = mFPortfolioTransaction.STCGTax;
                                    drCapitalGainDetails["LTCGAmount"] = mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["Category"]   = mFPortfolioVo.Category;

                                    dtCapitalGainSummary.Rows.Add(drCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtCapitalGainSummary);
        }
        public DataTable GetReturnTransactionSummaryReport(MFReportVo reports)
        {
            DataTable            dtReturnTransaction   = new DataTable();
            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();

            dtReturnTransaction.Columns.Add("TransactionType");
            dtReturnTransaction.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("PurchasePrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseCost", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SellDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("SellPrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SaleProceed", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsonDateNAV", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsOnDateValue", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AgeOfInvestment", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("ActualPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("NotionalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("TotalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AbsoluteReturn", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AnnualReturn", System.Type.GetType("System.Double"));


            dtReturnTransaction.Columns.Add("SchemePlanCode");
            dtReturnTransaction.Columns.Add("SchemePlanName");
            dtReturnTransaction.Columns.Add("FolioNum");
            dtReturnTransaction.Columns.Add("CustomerName");
            dtReturnTransaction.Columns.Add("CustomerId");
            dtReturnTransaction.Columns.Add("PortfolioName");
            dtReturnTransaction.Columns.Add("PortfolioId");

            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32 portfoliioId = 0;
                    portfoliioId = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.FromDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                DataRow drReturnTransaction = dtReturnTransaction.NewRow();
                                drReturnTransaction["TransactionType"] = mFPortfolioTransaction.TransactionType;
                                drReturnTransaction["Units"]           = mFPortfolioTransaction.BuyQuantity; //
                                drReturnTransaction["PurchaseDate"]    = mFPortfolioTransaction.BuyDate;
                                drReturnTransaction["PurchasePrice"]   = mFPortfolioTransaction.BuyPrice;
                                drReturnTransaction["PurchaseCost"]    = mFPortfolioTransaction.CostOfAcquisition; //
                                drReturnTransaction["SellDate"]        = mFPortfolioTransaction.SellDate;
                                drReturnTransaction["SellPrice"]       = mFPortfolioTransaction.SellPrice;
                                drReturnTransaction["SaleProceed"]     = mFPortfolioTransaction.RealizedSalesValue;
                                drReturnTransaction["AsonDateNAV"]     = mFPortfolioTransaction.CurrentNAV;//
                                drReturnTransaction["AsOnDateValue"]   = mFPortfolioTransaction.CurrentValue;
                                drReturnTransaction["AgeOfInvestment"] = mFPortfolioTransaction.AgeOfInvestment;
                                drReturnTransaction["ActualPL"]        = mFPortfolioTransaction.RealizedProfitLoss;
                                drReturnTransaction["NotionalPL"]      = mFPortfolioTransaction.NotionalProfitLoss;
                                drReturnTransaction["TotalPL"]         = mFPortfolioTransaction.TotalProfitLoss;
                                drReturnTransaction["AbsoluteReturn"]  = mFPortfolioTransaction.AbsoluteReturns;
                                drReturnTransaction["AnnualReturn"]    = mFPortfolioTransaction.AnnualReturns;


                                drReturnTransaction["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                drReturnTransaction["SchemePlanName"] = mFPortfolioVo.SchemePlan;
                                drReturnTransaction["FolioNum"]       = mFPortfolioVo.Folio;
                                drReturnTransaction["CustomerName"]   = drPortfolioCustomer["C_FirstName"].ToString();
                                drReturnTransaction["CustomerId"]     = mFPortfolioVo.CustomerId;
                                if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                {
                                    drReturnTransaction["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                }
                                drReturnTransaction["PortfolioId"] = portfoliioId;
                                dtReturnTransaction.Rows.Add(drReturnTransaction);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtReturnTransaction);
        }
示例#21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            this.Page.Culture = "en-GB";
            advisorVo         = (AdvisorVo)Session["advisorVo"];
            userType          = Session["UserType"].ToString().ToLower();
            rmVo = (RMVo)Session[SessionContents.RmVo];
            rmid = rmVo.RMId;
            trMessage.Visible = false;
            amcCode           = 0;

            SessionBo.CheckSession();
            userVo    = (UserVo)Session["userVo"];
            rmVo      = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
            bmID      = rmVo.RMId;
            AdviserID = advisorVo.advisorId;

            if (!IsPostBack)
            {
                PortfolioBo portfoliobo = new PortfolioBo();
                string      valuedate   = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));
                hdnValuationDate.Value = valuedate.ToString();
                if (hdnValuationDate.Value == string.Empty)
                {
                    ValuationNotDoneErrorMsg.Visible = true;
                    if (userType == "adviser")
                    {
                        BindBranchDropDown();
                        BindRMDropDown();
                    }
                    else if (userType == "rm")
                    {
                        spnBranch.Visible = false;
                        spnRM.Visible     = false;
                    }
                    else if (userType == "bm")
                    {
                        BindBranchForBMDropDown();
                        BindRMforBranchDropdown(0, bmID, 1);
                    }
                }
                else
                {
                    ValuationNotDoneErrorMsg.Visible = false;

                    if (userType == "rm")
                    {
                        spnBranch.Visible = false;
                        spnRM.Visible     = false;
                    }
                    if (userType == "adviser")
                    {
                        BindBranchDropDown();
                        BindRMDropDown();
                    }
                    if (userType == "bm")
                    {
                        if (!IsPostBack)
                        {
                            BindBranchForBMDropDown();
                            BindRMforBranchDropdown(0, bmID, 1);
                        }
                        hdnbranchId.Value     = "0";
                        hdnbranchHeadId.Value = ddlBranch.SelectedValue;
                        hdnAll.Value          = "2";
                        hdnrmId.Value         = "0";
                        hdnXWise.Value        = "1";
                        if (hdnValuationDate.Value.ToString() != "")
                        {
                            dsMISReport = adviserMISBo.GetMISForBM(int.Parse(hdnrmId.Value.ToString()), int.Parse(hdnbranchId.Value.ToString()), int.Parse(hdnbranchHeadId.Value.ToString()), int.Parse(hdnXWise.Value.ToString()), int.Parse(hdnAll.Value.ToString()), DateTime.Parse(hdnValuationDate.Value.ToString()), amcCode, 0, 1, hdnAMCSearchVal.Value.ToString(), hdnSchemeSearchVal.Value.ToString(), string.Empty, string.Empty, hdnCategoryFilter.Value.ToString(), out count, 0);
                        }
                    }
                }
                if (Request.QueryString["amcCode"] != null)
                {
                    amcCode             = int.Parse(Request.QueryString["amcCode"].ToString());
                    LatestValuationdate = DateTime.Parse(Request.QueryString["latestValuationdate"].ToString());
                }
                else
                {
                    valuedate = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));
                    hdnValuationDate.Value = valuedate.ToString();
                    if (valuedate != "")
                    {
                        LatestValuationdate = Convert.ToDateTime(valuedate);
                        //Valuation date storing in Hiddenfield For all page Export
                        ValuationDate.Value = LatestValuationdate.ToString();
                    }
                }
                if (LatestValuationdate != DateTime.MinValue)
                {
                    txtDate.Text = LatestValuationdate.Date.ToShortDateString();

                    //txtDate.Text = LatestValuationdate.Date.ToShortDateString();
                    bindgrid(LatestValuationdate, amcCode);
                }
                //else
                //{
                //    lblMessage.Text = "No valuation done";
                //    trMessage.Visible = true;
                //}
                hdnDownloadPageType.Value = "single";
            }

            if (hdnDownloadPageType.Value != "" || hdnDownloadPageType.Value != string.Empty)
            {
                hdnDownloadPageType.Value = "single";
            }
        }
示例#22
0
        static void Main(string[] args)
        {
            List <AdvisorVo>           adviserVoList         = new List <AdvisorVo>();
            AdviserMaintenanceBo       adviserMaintenanceBo  = new AdviserMaintenanceBo();
            CustomerPortfolioBo        customerPortfolioBo   = new CustomerPortfolioBo();
            PortfolioBo                portfolioBo           = new PortfolioBo();
            List <CustomerPortfolioVo> customerPortfolioList = new List <CustomerPortfolioVo>();
            List <MFPortfolioVo>       mfPortfolioList       = new List <MFPortfolioVo>();
            List <EQPortfolioVo>       eqPortfolioList       = new List <EQPortfolioVo>();
            List <int> customerList_MF   = new List <int>();
            List <int> customerList_EQ   = new List <int>();
            DataSet    dsMFValuationDate = new DataSet();
            DataSet    dsEQValuationDate = new DataSet();
            DateTime   tradeDate         = new DateTime();
            int        LogId             = 0;
            int        year  = int.Parse(ConfigurationSettings.AppSettings["YEAR"].ToString());
            int        month = int.Parse(ConfigurationSettings.AppSettings["MONTH"].ToString());
            int        day   = int.Parse(ConfigurationSettings.AppSettings["FROMDAY"].ToString());

            tradeDate = new DateTime(year, month, 01);
            while (tradeDate.Year == year && tradeDate.Month == month)
            {
                //if (DateTime.Now.TimeOfDay.Hours < 1)
                //    tradeDate = DateTime.Today.AddDays(-1);
                //else

                Console.WriteLine("Starting for the Year:" + tradeDate.Year.ToString() + "Month:" + tradeDate.Month.ToString());
                DateTime MFValuationDate;
                DateTime EQValuationDate;
                try
                {
                    adviserVoList = adviserMaintenanceBo.GetAdviserList();
                    Console.WriteLine("Starting Valuation Process for " + adviserVoList.Count.ToString() + " Advisers");
                    for (int i = 0; i < adviserVoList.Count; i++)
                    {
                        dsMFValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "MF", tradeDate.Month, tradeDate.Year);
                        dsEQValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "EQ", tradeDate.Month, tradeDate.Year);
                        customerList_MF   = customerPortfolioBo.GetAdviserCustomerList_MF(adviserVoList[i].advisorId);
                        customerList_EQ   = customerPortfolioBo.GetAdviserCustomerList_EQ(adviserVoList[i].advisorId);
                        Console.WriteLine("Starting MF Valuation Process for Adviser: " + adviserVoList[i].OrganizationName.ToString());

                        foreach (DataRow drMF in dsMFValuationDate.Tables[0].Rows)
                        {
                            if (DateTime.Parse(drMF["WTD_Date"].ToString()).Day != DateTime.Now.Day && DateTime.Parse(drMF["WTD_Date"].ToString()).Day > day)
                            {
                                MFValuationDate = DateTime.Parse(drMF["WTD_Date"].ToString());
                                if (drMF["STAT"].ToString() == "Pending. Changes Found")
                                {
                                    customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "MF", MFValuationDate, 0);
                                }
                                if (drMF["STAT"].ToString() != "Completed")
                                {
                                    if (DateTime.Compare(MFValuationDate, DateTime.Today) <= 0)
                                    {
                                        if (customerList_MF != null && customerList_MF.Count != 0)
                                        {
                                            LogId = CreateAdviserEODLog("MF", MFValuationDate, adviserVoList[i].advisorId);
                                            for (int j = 0; j < customerList_MF.Count; j++)
                                            {
                                                customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_MF[j]);
                                                customerPortfolioBo.DeleteMutualFundNetPosition(customerList_MF[j], MFValuationDate);
                                                if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                                {
                                                    for (int k = 0; k < customerPortfolioList.Count; k++)
                                                    {
                                                        Console.WriteLine("Starting MF Valuation Process for Customer:" + j.ToString() + " Portfolio:" + k.ToString() + " Date:" + MFValuationDate.ToShortDateString());
                                                        try
                                                        {
                                                            mfPortfolioList = customerPortfolioBo.GetCustomerMFPortfolio(customerList_MF[j], customerPortfolioList[k].PortfolioId, MFValuationDate, "", "", "");
                                                        }
                                                        catch (Exception ex)
                                                        {
                                                            Console.WriteLine("Exception: " + ex.ToString());
                                                        }
                                                        if (mfPortfolioList != null && mfPortfolioList.Count != 0)
                                                        {
                                                            try
                                                            {
                                                                customerPortfolioBo.AddMutualFundNetPosition(mfPortfolioList, adviserVoList[i].UserId);
                                                            }
                                                            catch (Exception Ex)
                                                            {
                                                                Console.WriteLine("Exception: " + Ex.ToString());
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            UpdateAdviserEODLog("MF", 1, LogId);
                                        }
                                    }
                                }
                            }
                        }
                        #region Equity Valuation
                        Console.WriteLine("Starting EQ Valuation Process for Adviser " + i.ToString());

                        foreach (DataRow drEQ in dsEQValuationDate.Tables[0].Rows)
                        {
                            EQValuationDate = DateTime.Parse(drEQ["WTD_Date"].ToString());
                            if (drEQ["STAT"].ToString() == "Pending. Changes Found")
                            {
                                customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "EQ", EQValuationDate, 0);
                            }
                            if (drEQ["STAT"].ToString() != "Completed")
                            {
                                if (DateTime.Compare(EQValuationDate, DateTime.Today) <= 0)
                                {
                                    if (customerList_EQ != null && customerList_EQ.Count != 0)
                                    {
                                        LogId = CreateAdviserEODLog("EQ", EQValuationDate, adviserVoList[i].advisorId);
                                        for (int j = 0; j < customerList_EQ.Count; j++)
                                        {
                                            customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_EQ[j]);
                                            customerPortfolioBo.DeleteEquityNetPosition(customerList_EQ[j], EQValuationDate);
                                            if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                            {
                                                for (int k = 0; k < customerPortfolioList.Count; k++)
                                                {
                                                    Console.WriteLine("Starting EQ Valuation Process for Customer:" + j.ToString() + " Portfolio:" + k.ToString() + " Date:" + EQValuationDate.ToShortDateString());
                                                    try
                                                    {
                                                        eqPortfolioList = customerPortfolioBo.GetCustomerEquityPortfolio(customerList_EQ[j], customerPortfolioList[k].PortfolioId, EQValuationDate, string.Empty, string.Empty);
                                                    }
                                                    catch (Exception Ex)
                                                    {
                                                        Console.WriteLine("Exception: " + Ex.ToString());
                                                    }
                                                    if (eqPortfolioList != null && eqPortfolioList.Count != 0)
                                                    {
                                                        try
                                                        {
                                                            customerPortfolioBo.AddEquityNetPosition(eqPortfolioList, adviserVoList[i].UserId);
                                                        }
                                                        catch (Exception Ex)
                                                        {
                                                            Console.WriteLine("Exception: " + Ex.ToString());
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        UpdateAdviserEODLog("EQ", 1, LogId);
                                    }
                                }
                            }
                        }
                        #endregion Equity Valuation
                    }
                }
                catch (BaseApplicationException Ex)
                {
                    throw Ex;
                }
                catch (Exception Ex)
                {
                    BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                    NameValueCollection      FunctionInfo = new NameValueCollection();
                    FunctionInfo.Add("Method", "DailyValuation.ascx.cs:CreateAdviserEODLog()");
                    object[] objects = new object[2];
                    objects[0]   = 0;
                    objects[1]   = tradeDate;
                    FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                    exBase.AdditionalInformation = FunctionInfo;
                    ExceptionManager.Publish(exBase);
                    throw exBase;
                }
                tradeDate = tradeDate.AddMonths(1);
            }
        }
示例#23
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            List <AdvisorVo>           adviserVoList         = new List <AdvisorVo>();
            AdviserMaintenanceBo       adviserMaintenanceBo  = new AdviserMaintenanceBo();
            CustomerPortfolioBo        customerPortfolioBo   = new CustomerPortfolioBo();
            PortfolioBo                portfolioBo           = new PortfolioBo();
            List <CustomerPortfolioVo> customerPortfolioList = new List <CustomerPortfolioVo>();
            List <MFPortfolioVo>       mfPortfolioList       = new List <MFPortfolioVo>();
            List <EQPortfolioVo>       eqPortfolioList       = new List <EQPortfolioVo>();
            List <int> customerList_MF   = new List <int>();
            List <int> customerList_EQ   = new List <int>();
            DataSet    dsMFValuationDate = new DataSet();
            DataSet    dsEQValuationDate = new DataSet();
            DateTime   tradeDate         = new DateTime();
            int        LogId             = 0;

            // if (DateTime.Now.TimeOfDay.Hours < 1)
            tradeDate = DateTime.Today;
            // else
            //  tradeDate = DateTime.Today;

            DateTime MFValuationDate;
            DateTime EQValuationDate;

            adviserVoList = adviserMaintenanceBo.GetAdviserList();

            for (int i = 0; i < adviserVoList.Count; i++)
            {
                dsMFValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "MF", tradeDate.Month, tradeDate.Year);
                dsEQValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "EQ", tradeDate.Month, tradeDate.Year);
                customerList_MF   = customerPortfolioBo.GetAdviserCustomerList_MF(adviserVoList[i].advisorId);
                customerList_EQ   = customerPortfolioBo.GetAdviserCustomerList_EQ(adviserVoList[i].advisorId);
                foreach (DataRow drMF in dsMFValuationDate.Tables[0].Rows)
                {
                    MFValuationDate = DateTime.Parse(drMF["WTD_Date"].ToString());
                    if (MFValuationDate != DateTime.Today || DateTime.Today.Hour > 23)
                    {
                        if (drMF["STAT"].ToString() == "Pending. Changes Found")
                        {
                            customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "MF", MFValuationDate, 0);
                        }
                        if (drMF["STAT"].ToString() != "Completed")
                        {
                            if (DateTime.Compare(MFValuationDate, DateTime.Today) <= 0)
                            {
                                if (customerList_MF != null && customerList_MF.Count != 0)
                                {
                                    LogId = CreateAdviserEODLog("MF", MFValuationDate, adviserVoList[i].advisorId);
                                    for (int j = 0; j < customerList_MF.Count; j++)
                                    {
                                        customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_MF[j]);
                                        customerPortfolioBo.DeleteMutualFundNetPosition(customerList_MF[j], MFValuationDate);
                                        if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                        {
                                            for (int k = 0; k < customerPortfolioList.Count; k++)
                                            {
                                                try
                                                {
                                                    mfPortfolioList = customerPortfolioBo.GetCustomerMFPortfolio(customerList_MF[j], customerPortfolioList[k].PortfolioId, MFValuationDate, "", "", "");
                                                }
                                                catch (Exception ex)
                                                {
                                                    Console.WriteLine("Exception: " + ex.ToString());
                                                }
                                                if (mfPortfolioList != null && mfPortfolioList.Count != 0)
                                                {
                                                    try
                                                    {
                                                        customerPortfolioBo.AddMutualFundNetPosition(mfPortfolioList, adviserVoList[i].UserId);
                                                    }
                                                    catch (Exception Ex)
                                                    {
                                                        Console.WriteLine("Exception: " + Ex.ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    UpdateAdviserEODLog("MF", 1, LogId);
                                }
                            }
                        }
                    }
                }

                foreach (DataRow drEQ in dsEQValuationDate.Tables[0].Rows)
                {
                    EQValuationDate = DateTime.Parse(drEQ["WTD_Date"].ToString());
                    if (EQValuationDate != DateTime.Today || DateTime.Today.Hour > 23)
                    {
                        if (drEQ["STAT"].ToString() == "Pending. Changes Found")
                        {
                            customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "EQ", EQValuationDate, 0);
                        }
                        if (drEQ["STAT"].ToString() != "Completed")
                        {
                            if (DateTime.Compare(EQValuationDate, DateTime.Today) <= 0)
                            {
                                if (customerList_EQ != null && customerList_EQ.Count != 0)
                                {
                                    LogId = CreateAdviserEODLog("EQ", EQValuationDate, adviserVoList[i].advisorId);
                                    for (int j = 0; j < customerList_EQ.Count; j++)
                                    {
                                        customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_EQ[j]);
                                        customerPortfolioBo.DeleteEquityNetPosition(customerList_EQ[j], EQValuationDate);
                                        if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                        {
                                            for (int k = 0; k < customerPortfolioList.Count; k++)
                                            {
                                                try
                                                {
                                                    eqPortfolioList = customerPortfolioBo.GetCustomerEquityPortfolio(customerList_EQ[j], customerPortfolioList[k].PortfolioId, EQValuationDate, string.Empty, string.Empty);
                                                }
                                                catch (Exception Ex)
                                                {
                                                    Console.WriteLine("Exception: " + Ex.ToString());
                                                }
                                                if (eqPortfolioList != null && eqPortfolioList.Count != 0)
                                                {
                                                    try
                                                    {
                                                        customerPortfolioBo.AddEquityNetPosition(eqPortfolioList, adviserVoList[i].UserId);
                                                    }
                                                    catch (Exception Ex)
                                                    {
                                                        Console.WriteLine("Exception: " + Ex.ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    UpdateAdviserEODLog("EQ", 1, LogId);
                                }
                            }
                        }
                    }
                }
            }

            ErrorMsg = "";
            return(JobStatus.SuccessFull);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            this.Page.Culture = "en-GB";
            advisorVo         = (AdvisorVo)Session["advisorVo"];
            userType          = Session["UserType"].ToString().ToLower();
            rmVo = (RMVo)Session[SessionContents.RmVo];
            rmid = rmVo.RMId;
            trMessage.Visible = false;
            amcCode           = 0;

            SessionBo.CheckSession();
            userVo                = (UserVo)Session["userVo"];
            rmVo                  = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
            bmID                  = rmVo.RMId;
            AdviserID             = advisorVo.advisorId;
            trExportPopup.Visible = false;
            if (!IsPostBack)
            {
                PortfolioBo portfoliobo = new PortfolioBo();

                ValuationNotDoneErrorMsg.Visible = false;

                if (userType == "rm")
                {
                    spnBranch.Visible = false;
                    spnRM.Visible     = false;
                }
                if (userType == "adviser")
                {
                    BindBranchDropDown();
                    BindRMDropDown();
                }
                if (userType == "bm")
                {
                    BindBranchForBMDropDown();
                    BindRMforBranchDropdown(0, bmID, 1);

                    hdnbranchId.Value     = "0";
                    hdnbranchHeadId.Value = ddlBranch.SelectedValue;
                    hdnAll.Value          = "2";
                    hdnrmId.Value         = "0";
                    hdnXWise.Value        = "1";
                }


                if (Request.QueryString["amcCode"] != null)
                {
                    if (Request.QueryString["BranchSelection"] != "")
                    {
                        BranchSelection          = Request.QueryString["BranchSelection"].ToString();
                        ddlBranch.SelectedValue  = BranchSelection;
                        hdnBranchSelection.Value = BranchSelection;
                    }
                    if (Request.QueryString["RMSelection"] != "")
                    {
                        RMSelection          = Request.QueryString["RMSelection"].ToString();
                        ddlRM.SelectedValue  = RMSelection;
                        hdnRMSelection.Value = RMSelection;
                    }
                    amcCode              = int.Parse(Request.QueryString["amcCode"].ToString());
                    LatestValuationdate  = DateTime.Parse(Request.QueryString["latestValuationdate"].ToString());
                    txtDate.SelectedDate = LatestValuationdate;
                    GenerateMIS();
                }


                hdnDownloadPageType.Value = "single";
            }

            if (hdnDownloadPageType.Value != "" || hdnDownloadPageType.Value != string.Empty)
            {
                hdnDownloadPageType.Value = "single";
            }
            if (Request.QueryString["amcCode"] == null)
            {
                LatestValuationdate = adviserMISBo.GetLatestValuationDateFromHistory(advisorVo.advisorId, "MF");
            }
            hdnValuationDate.Value = LatestValuationdate.ToString("MM/dd/yyyy");
            vlndte        = LatestValuationdate;
            lblValDt.Text = vlndte.ToShortDateString();
        }
        private bool ValidateUserLogin(string userAccountId, string isWerp)
        {
            string                    strOnlineAdviser          = "0";
            bool                      isValidUser               = false;
            UserBo                    userBo                    = new UserBo();
            AssociatesVO              associatesVo              = new AssociatesVO();
            AdvisorBranchVo           advisorBranchVo           = new AdvisorBranchVo();
            AssociatesUserHeirarchyVo associatesUserHeirarchyVo = new AssociatesUserHeirarchyVo();
            AdvisorBo                 advisorBo                 = new AdvisorBo();
            BoDematAccount            boDematAccount            = new BoDematAccount();
            AssociatesBo              associatesBo              = new AssociatesBo();
            AdvisorStaffBo            advisorStaffBo            = new AdvisorStaffBo();
            CustomerBo                customerBo                = new CustomerBo();
            AdvisorBranchBo           advisorBranchBo           = new AdvisorBranchBo();
            PortfolioBo               portfolioBo               = new PortfolioBo();
            CustomerPortfolioVo       customerPortfolioVo       = new CustomerPortfolioVo();

            strOnlineAdviser = ConfigurationSettings.AppSettings["ONLINE_ADVISER"].ToString();
            if (string.IsNullOrEmpty(isWerp))
            {
                userVo = userBo.GetUserAccountDetails(userAccountId, Convert.ToInt32(strOnlineAdviser));
            }
            else
            {
                advisorVo = (AdvisorVo)Session["advisorVo"];
                userVo    = userBo.GetUserAccountDetails(userAccountId, advisorVo.advisorId);
            }

            if (!string.IsNullOrEmpty(isWerp))
            {
                if (userVo != null)
                {
                    customerVo  = customerBo.GetCustomerInfo(userVo.UserId);
                    isValidUser = true;
                }
                Session["CustomerVo"] = customerVo;
            }
            else if (userVo != null)
            {
                isValidUser = true;
                List <string> roleList = new List <string>();
                string        branchLogoSourcePath;
                string        sourcePath;
                string        potentialHomePage = string.Empty;

                roleList = userBo.GetUserRoles(userVo.UserId);

                if (userVo.UserType == "Customer")
                {
                    customerVo = customerBo.GetCustomerInfo(userVo.UserId);
                    advisorVo  = advisorBo.GetAdvisor(advisorBranchBo.GetBranch(customerVo.BranchId).AdviserId);
                    if (customerVo.IsProspect == 0)
                    {
                        customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(customerVo.CustomerId);
                        Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
                    }
                    rmVo = advisorStaffBo.GetAdvisorStaffDetails(customerVo.RmId);

                    Session[SessionContents.LogoPath]        = advisorVo.LogoPath;
                    Session[SessionContents.CurrentUserRole] = "Customer";
                    Session[SessionContents.UserTopRole]     = "Customer";

                    branchLogoSourcePath = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                    sourcePath           = "Images/" + userBo.GetRMLogo(rmVo.RMId);
                    Session[SessionContents.LogoPath]       = sourcePath;
                    Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                    Session["CustomerVo"]     = customerVo;
                    Session["DematAccountVo"] = boDematAccount.GetCustomerActiveDematAccount(customerVo.CustomerId);
                    UserBo.AddLoginTrack(userVo.LoginId, string.Empty, true, HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], HttpContext.Current.Request.UserAgent, userVo.UserId);
                }

                Session["UserVo"]    = userVo;
                Session["advisorVo"] = advisorVo;
                Session["rmVo"]      = rmVo;
                SetAdviserPreference();

                //Session["Theme"] = advisorVo.theme;
                //Session["refreshTheme"] = true;

                Session[SessionContents.LogoPath] = advisorVo.LogoPath;
            }
            return(isValidUser);
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            Page.Header.DataBind();
            advisorVo         = (AdvisorVo)Session["advisorVo"];
            userType          = Session["UserType"].ToString().ToLower();
            rmVo              = (RMVo)Session[SessionContents.RmVo];
            rmid              = rmVo.RMId;
            trMessage.Visible = false;

            SessionBo.CheckSession();
            userVo    = (UserVo)Session["userVo"];
            rmVo      = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
            bmID      = rmVo.RMId;
            AdviserID = advisorVo.advisorId;

            if (!IsPostBack)
            {
                PortfolioBo portfoliobo = new PortfolioBo();
                //string valuedate = Convert.ToString(portfoliobo.GetLatestValuationDate(advisorVo.advisorId, "MF"));


                //if (hdnValuationDate.Value == string.Empty)
                //{
                //    ValuationNotDoneErrorMsg.Visible = true;

                if (userType == "rm")
                {
                    spnBranch.Visible = false;
                    spnRM.Visible     = false;
                }
                if (userType == "adviser")
                {
                    hdnbranchId.Value     = "0";
                    hdnbranchHeadId.Value = AdviserID.ToString();
                    hdnAll.Value          = "2";
                    //hdnXWise.Value = "0";
                    hdnrmId.Value = ddlRM.SelectedValue;

                    BindBranchDropDown();
                    BindRMDropDown();
                    //bindgrid(LatestValuationdate);
                }
                if (userType == "bm")
                {
                    BindBranchForBMDropDown();
                    BindRMforBranchDropdown(0, bmID, 1);

                    hdnbranchId.Value     = "0";
                    hdnbranchHeadId.Value = ddlBranch.SelectedValue;
                    hdnAll.Value          = "2";
                    hdnrmId.Value         = "0";
                    hdnXWise.Value        = "0";
                    // dsMISReport = adviserMISBo.GetMISForBM(int.Parse(hdnrmId.Value.ToString()), int.Parse(hdnbranchId.Value.ToString()), int.Parse(hdnbranchHeadId.Value.ToString()), int.Parse(hdnXWise.Value.ToString()), int.Parse(hdnAll.Value.ToString()), DateTime.Parse(hdnValuationDate.Value.ToString()), 0, 0, 1, hdnAMCSearchVal.Value.ToString(), string.Empty, string.Empty, string.Empty, string.Empty, out count, 0);
                }
            }


            LatestValuationdate = adviserMISBo.GetLatestValuationDateFromHistory(advisorVo.advisorId, "MF");
            vlndte = LatestValuationdate;
            hdnValuationDate.Value = LatestValuationdate.ToString("MM/dd/yyyy");
            lblValDt.Text          = vlndte.ToShortDateString();

            //if (LatestValuationdate != DateTime.MinValue)
            //{
            //    bindgrid(LatestValuationdate);
            //}
            //else
            //{
            //    lblMessage.Text = "No valuation done";
            //    trMessage.Visible = true;
            //}
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            PortfolioBo         portfolioBo = new PortfolioBo();
            int                 isBankAssociatedWithOtherTransactions = 0;
            String              statusMsg        = string.Empty;
            int                 totalFoliosMoved = 0;
            CustomerPortfolioVo portfolioVo      = new CustomerPortfolioVo();

            if (txtCustomerId.Value != string.Empty)
            {
                string portfolio = ddlAdvisorBranchList.SelectedValue;
                portfolioVo = portfolioBo.GetCustomerDefaultPortfolio1((Convert.ToInt32(txtCustomerId.Value)), portfolio);
                if (portfolioVo.PortfolioId < 1)
                {
                    lblMessage.Text = "No default Portfolio found for the selected customer.";
                    //trErrorMsg.Visible = true;
                    tblTransferFolio.Visible = false;
                    tblMoveFolio.Visible     = false;
                    return;
                }
            }
            else
            {
                lblMessage.Text = "Please select a customer.";
                //trErrorMsg.Visible = true;
                tblTransferFolio.Visible = false;
                tblMoveFolio.Visible     = false;
                return;
            }


            foreach (GridDataItem dr in gvMFFolio.Items)
            {
                CheckBox checkBox = (CheckBox)dr.FindControl("chkBox");
                if (checkBox.Checked)
                {
                    int  MFAccountId = Convert.ToInt32(gvMFFolio.MasterTableView.Items[dr.ItemIndex].GetDataKeyValue("FolioId").ToString());
                    bool isUpdated   = PortfolioBo.TransferFolio(MFAccountId, portfolioVo.PortfolioId, isBankAssociatedWithOtherTransactions);
                    if (isUpdated)
                    {
                        totalFoliosMoved++;
                    }
                    else
                    {
                        //statusMsgFailure.InnerText = statusMsg;
                        //statusMsg += "Error occurred while moving folio with mutual fund accountId " + MFAccountId;
                        //trFailure.Visible = true;
                        //statusMsgSuccess.Visible = false;
                        //statusMsgFailure.Visible = true;

                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Cannot transfer this folio the bank is associate with some other transactions');", true);
                    }
                    //lblstatusMsgFailure.Visible = true;
                }
            }
            if (totalFoliosMoved > 0)
            {
                statusMsg += "Total Folios moved = " + totalFoliosMoved;
                statusMsgSuccess.InnerText = statusMsg;
                trFailure.Visible          = true;
                statusMsgSuccess.Visible   = true;
                statusMsgFailure.Visible   = false;

                //    lblstatusMsgSuccess.Text += "<br/>Total Folios moved = " + totalFoliosMoved + ".<br/>";
                //lblstatusMsgSuccess.Visible = true;
                //lblMessage.Text = statusMsg;
                //lblMessage.Visible = true;
                //lblTransferMsg.Text = statusMsg;
                //divMessage.Attributes.Add("class", "yellow-box");
                //if (trTransferMsg.Visible == false)


                //    trTransferMsg.Visible = true;
            }
            BindFolioGridView();
        }