public int CountAdvisorBranch()
        {
            AdvisorBranchBo        advisorBranchBo   = new AdvisorBranchBo();
            List <AdvisorBranchVo> advisorBranchList = null;
            int count;

            try
            {
                advisorBranchList = advisorBranchBo.GetAdvisorBranches(advisorVo.advisorId, "");
                count             = advisorBranchList.Count;
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "AdvisorDashBoard.ascx:CountAdvisorBranch()");


                object[] objects = new object[2];
                objects[0] = advisorBranchBo;
                objects[1] = advisorBranchList;


                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(count);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            UserVo userVo = new UserVo();
            RMVo   rmVo   = new RMVo();
            //userType = Session["UserType"].ToString().ToLower();
            AdvisorStaffBo  advisorStaffBo  = new AdvisorStaffBo();
            AdvisorBranchVo advisorBranchVo = new AdvisorBranchVo();
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            int             branchId;

            userVo = (UserVo)Session["userVo"];
            rmVo   = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
            rmId   = rmVo.RMId;

            Session["rmVo"] = rmVo;
            branchId        = advisorBranchBo.GetBranchId(rmVo.RMId);



            advisorBranchVo            = advisorBranchBo.GetBranch(branchId);
            Session["advisorBranchVo"] = advisorBranchVo;

            if (!IsPostBack)
            {
                BindBranchDropDown();
                bindGrid(0, int.Parse(ddlBMBranch.SelectedValue.ToString()), 1);
                bindChart(0, int.Parse(ddlBMBranch.SelectedValue.ToString()), 1);
            }
        }
示例#3
0
        protected void btnReassignRM_Click(object sender, EventArgs e)
        {
            string          selectedCusmoerIds = "";
            StringBuilder   allPageCustomerIds = new StringBuilder();
            AdvisorBranchBo adviserBranchBo    = new AdvisorBranchBo();
            DataTable       dtAllPagesCustomer;

            if (hndAllPageSelect.Value == "1")
            {
                dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value);
                foreach (DataRow dr in dtAllPagesCustomer.Rows)
                {
                    allPageCustomerIds.Append(dr["C_CustomerId"].ToString());
                    allPageCustomerIds.Append("~");
                }
                selectedCusmoerIds = allPageCustomerIds.ToString();
            }
            else
            {
                selectedCusmoerIds = Convert.ToString(GetSelectedCustomerIdString());
            }

            if (ddlBranchRMList.Visible == true && ddlBranchRMList.SelectedIndex != 0)
            {
                advisorBranchBO.ReassignCustomersBranchRM(selectedCusmoerIds, int.Parse(ddlBranchList.SelectedValue), int.Parse(ddlBranchRMList.SelectedValue));
                SuccessMsg.Visible = true;
                this.BindCustomer(mypager.CurrentPage);
            }
        }
示例#4
0
        protected void DeleteAssocCategory(object sender, GridViewDeleteEventArgs e)
        {
            int  AssocCategoryId = 0;
            int  rowindexval     = e.RowIndex;
            int  count           = 0;
            bool result          = false;
            AdviserAssociateCategorySetupBo AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupBo();
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();

            if (gvAssocCatSetUpBounded.DataKeys[rowindexval].Value != System.DBNull.Value)
            {
                AssocCategoryId = Convert.ToInt32(gvAssocCatSetUpBounded.DataKeys[rowindexval].Value);
            }

            count = advisorBranchBo.CheckAssociateBranchCategory(AssocCategoryId);

            if (count > 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Sorry, This category cannot be deleted as this is associated with one or more branches !');", true);
            }
            else
            {
                result = AdviserAssociateCategorySetup.DeleteAdviserAssociateCategory(AssocCategoryId);
            }

            if (result)
            {
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('AdviserAssociateCategorySetup','login');", true);
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Deleted Successfully !');", true);
                FillGrid();
            }
        }
        public void setAdvisorBranch()
        {
            AdvisorBranchBo        advisorBranchBo   = new AdvisorBranchBo();
            List <AdvisorBranchVo> advisorBranchList = null;
            AdvisorBranchVo        advisorBranchVo   = null;

            try
            {
                advisorBranchList = advisorBranchBo.GetAdvisorBranches(advisorVo.advisorId, "");
                DataTable dtAdvisorBranch = new DataTable();
                dtAdvisorBranch.Columns.Add("Sl.No.");

                dtAdvisorBranch.Columns.Add("Branch Name");
                dtAdvisorBranch.Columns.Add("Email");


                DataRow drAdvisorBranch;
                for (int i = 0; i < advisorBranchList.Count; i++)
                {
                    drAdvisorBranch    = dtAdvisorBranch.NewRow();
                    advisorBranchVo    = new AdvisorBranchVo();
                    advisorBranchVo    = advisorBranchList[i];
                    drAdvisorBranch[0] = (i + 1).ToString();
                    drAdvisorBranch[1] = advisorBranchVo.BranchName;
                    drAdvisorBranch[2] = advisorBranchVo.Email;
                    dtAdvisorBranch.Rows.Add(drAdvisorBranch);
                }

                gvAdvisorBranch.DataSource = dtAdvisorBranch;
                gvAdvisorBranch.DataBind();
                gvAdvisorBranch.Visible = true;
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "AdvisorDashBoard.ascx:setAdvisorLOB()");


                object[] objects = new object[4];
                objects[0] = advisorBranchBo;
                objects[1] = advisorBranchList;
                objects[2] = advisorVo;
                objects[3] = advisorBranchVo;


                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void btnSubmitMoveFolio_Click(object sender, EventArgs e)
        {
            try
            {
                customerVo = (CustomerVo)Session["customerVo"];
                CustomerPortfolioVo portfolioVo = new CustomerPortfolioVo();
                CheckBox            chkBox      = new CheckBox();
                chkBox = GetchkBox();
                int    accountID;
                int    customerId = customerVo.CustomerId;
                int    TofolioId  = Convert.ToInt32(ddlPickPortfolio.SelectedValue);
                bool   PortFolioUpdate;
                string statusMsg = string.Empty;

                foreach (GridDataItem dr in gvMFFolio.Items)
                {
                    int selectedRow = 0;
                    //int rowIndex = dr.RowIndex;
                    //DataKey dKey = gvMFFolio.DataKeys[rowIndex];

                    if (((CheckBox)dr.FindControl("chkBox")).Checked == true)
                    {
                        AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
                        accountID = Convert.ToInt32(gvMFFolio.MasterTableView.DataKeyValues[selectedRow]["FolioId"].ToString());
                        //string folioNo = gvMFFolio.MasterTableView.DataKeyValues[selectedRow]["FolioId"].ToString();
                        string folioNo = gvMFFolio.MasterTableView.Items[dr.ItemIndex].GetDataKeyValue("Folio No").ToString();

                        PortFolioUpdate = adviserBranchBo.FolioMoveToPortfolio(customerId, folioNo, TofolioId, accountID);
                        if (PortFolioUpdate == true)
                        {
                            statusMsg = "Portfolio Moved to Another Portfolio";
                            statusMsgSuccess.InnerText = statusMsg;
                            trFailure.Visible          = true;
                            statusMsgSuccess.Visible   = true;
                            statusMsgFailure.Visible   = false;
                        }
                        else
                        {
                            statusMsgFailure.InnerText = statusMsg;
                            statusMsg                = "Portfolio Has not been moved";
                            trFailure.Visible        = true;
                            statusMsgSuccess.Visible = false;
                            statusMsgFailure.Visible = true;
                        }
                    }
                }
                this.BindFolioGridView();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
        }
示例#7
0
        /// <summary>
        /// Used to bind branches of the Branch dropdown
        /// </summary>
        /// <param name="advisorVo"></param>
        /// <param name="rmVo"></param>
        private void BindBranch(AdvisorVo advisorVo, RMVo rmVo)
        {
            AdvisorBranchBo advisorBranchBo  = new AdvisorBranchBo();
            UploadCommonBo  uploadsCommonDao = new UploadCommonBo();
            //DataSet ds = uploadsCommonDao.GetAdviserBranchList(advisorVo.advisorId, "adviser");
            DataSet ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A");

            if (ds != null)
            {
                ddlPickBranch.DataSource     = ds;
                ddlPickBranch.DataValueField = ds.Tables[0].Columns["AB_BranchId"].ToString();
                ddlPickBranch.DataTextField  = ds.Tables[0].Columns["AB_BranchName"].ToString();
                ddlPickBranch.DataBind();
            }
        }
        protected void bindFolioDropDown(int customerId, int amcCode, string fnumber)
        {
            lblerror.Visible = false;
            DataSet         folioDs;
            AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();

            folioDs = new DataSet();
            folioDs = adviserBranchBo.GetCustomerFolioMergeList(customerId, amcCode, fnumber);
            if (folioDs.Tables[0].Rows.Count == 0)
            {
                lblerror.Visible = true;
            }
            ddlAdvisorBranchList.DataSource     = folioDs;
            ddlAdvisorBranchList.DataValueField = folioDs.Tables[0].Columns["CMFA_FolioNum"].ToString();
            ddlAdvisorBranchList.DataBind();
        }
        /// <summary>
        /// Modified this function to add a new column(No. of customers) to the Branch AUM grid
        /// </summary>
        ///

        private void LoadAdminBranchPerformance()
        {
            List <AdvisorBranchVo> branchList      = new List <AdvisorBranchVo>();
            AdvisorBranchBo        advisorBranchBo = new AdvisorBranchBo();

            DataTable dt       = new DataTable();
            DataRow   drResult = null;
            DataRow   dr       = null;

            dt = CreateBranchPerformanceTable();
            try
            {
                if (dt.Rows.Count > 0)
                {
                    gvrAdminBranchPerform.DataSource = dt;
                    gvrAdminBranchPerform.DataBind();
                    gvrAdminBranchPerform.Visible = true;


                    lblGT.Text = Math.Round(double.Parse(String.Format("{0:n2}", ds.Tables[1].Rows[0]["Total"].ToString())), 0).ToString("#,#", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));
                    //GetPageCount();
                }
                else
                {
                    lblGT.Visible  = false;
                    lblGTT.Visible = false;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "IFAAdminMainDashboard.ascx:LoadAdminBranchPerformance()");
                object[] objects = new object[3];
                objects[0]   = advisorVo;
                objects[1]   = branchList;
                objects[2]   = ds;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void DeleteTerminalId()
        {
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            bool            result          = false;
            int             Id = 0;

            try
            {
                foreach (GridViewRow dr in gvTerminalList.Rows)
                {
                    CheckBox checkBox = (CheckBox)dr.FindControl("chkBx");
                    if (checkBox.Checked)
                    {
                        Id     = Convert.ToInt32(gvTerminalList.DataKeys[dr.RowIndex].Values["TerminalId"].ToString());
                        result = advisorBranchBo.DeleteBranchTerminal(Id);
                        if (result)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Deleted Successfully..');", true);
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Sorry..');", true);
                        }
                    }
                }
                LoadTerminalId();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewBranchDetails.ascx.cs:DeleteTerminalId()");
                object[] objects = new object[2];
                objects[0]   = Id;
                objects[1]   = result;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#11
0
        protected void ddlBranchRMList_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool            groupHead          = false;
            string          allCustomersId     = "";
            StringBuilder   allPageCustomerIds = new StringBuilder();
            AdvisorBranchBo adviserBranchBo    = new AdvisorBranchBo();
            //ddlBranchRMList.Visible = false;
            DataTable dtAllPagesCustomer;

            if (ddlAdvisorBranchList.SelectedIndex != 0)
            {
                if (hndAllPageSelect.Value == "1")
                {
                    dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value);
                    foreach (DataRow dr in dtAllPagesCustomer.Rows)
                    {
                        allPageCustomerIds.Append(dr["C_CustomerId"].ToString());
                        allPageCustomerIds.Append("~");
                    }
                    allCustomersId = allPageCustomerIds.ToString();
                }
                else
                {
                    allCustomersId = Convert.ToString(GetSelectedCustomerIdString());
                    if (string.IsNullOrEmpty(allCustomersId))
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Please select some customer for RM reassign');", true);
                        return;
                    }
                }

                groupHead = advisorBranchBO.CheckCustomerGroupHead(allCustomersId);

                if (groupHead == true)
                {
                    hndIsGroupHead.Value = "true";
                }
                else
                {
                    hndIsGroupHead.Value = "false";
                }
            }
        }
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            CheckBox rdbGVRow = new CheckBox();

            rdbGVRow = GetGvRadioButton();
            foreach (GridViewRow dr in gvCustomerFolioMerge.Rows)
            {
                int     rowIndex = dr.RowIndex;
                DataKey dKey     = gvCustomerFolioMerge.DataKeys[rowIndex];

                int    customerId = int.Parse(dKey.Values["CustomerId"].ToString());
                int    amcCode    = int.Parse(dKey.Values["AMCCode"].ToString());
                string fnumber    = dKey.Values["Count"].ToString();

                if (((CheckBox)dr.FindControl("rdbGVRow")).Checked == true)
                {
                    AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
                    string          ffromfolio      = ddlAdvisorBranchList.SelectedValue.ToString();
                    bool            folioDs         = adviserBranchBo.CustomerFolioMerged(ffromfolio, fnumber, customerId);
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('AdvisorCustomerAccounts','none');", true);
                }
            }
        }
        private void CreateMainBranch()
        {
            AdvisorBranchVo branchVo        = new AdvisorBranchVo();
            AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
            List <int>      adviserIds      = new List <int>();

            adviserIds              = (List <int>)Session["IDs"];
            branchVo.BranchHeadId   = adviserIds[2];
            branchVo.BranchName     = txtOrganization.Text;
            branchVo.City           = txtCity.Text;
            branchVo.Email          = txtEmail.Text;
            branchVo.BranchTypeCode = 1;

            branchVo.MobileNumber = Convert.ToInt64(txtMobile.Text);

            branchVo.AddressLine1   = string.Empty;
            branchVo.AddressLine2   = string.Empty;
            branchVo.AddressLine3   = string.Empty;
            branchVo.Country        = string.Empty;
            branchVo.BranchTypeCode = 1;
            branchVo.PinCode        = 0;
            branchVo.State          = null;
            branchVo.Fax            = 0;
            branchVo.FaxIsd         = 0;
            branchVo.FaxStd         = 0;
            branchVo.Phone1Isd      = 0;
            branchVo.Phone2Isd      = 0;
            branchVo.Phone1Number   = 0;
            branchVo.Phone2Number   = 0;
            branchVo.Phone1Std      = 0;
            branchVo.Phone2Std      = 0;

            branchVo.IsHeadBranch = 1;
            branchVo.BranchId     = adviserBranchBo.CreateAdvisorBranch(branchVo, adviserIds[1], adviserIds[0]);
            adviserBranchBo.AssociateBranch(adviserIds[2], branchVo.BranchId, 1, adviserIds[0]);
        }
        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);
        }
        private void BindCustomer()
        {
            //Dictionary<string, string> genDictParent = new Dictionary<string, string>();
            //Dictionary<string, string> genDictRM = new Dictionary<string, string>();
            //Dictionary<string, string> genDictReassignRM = new Dictionary<string, string>();

            Dictionary <string, string> advisorBranchList = new Dictionary <string, string>();
            string            customer        = "";
            AdvisorBranchBo   adviserBranchBo = new AdvisorBranchBo();
            List <CustomerVo> customerList    = new List <CustomerVo>();

            //
            List <CustomerVo> allcustomerList = new List <CustomerVo>();

            RMVo      customerRMVo     = new RMVo();
            DataTable dtRMCustomer     = new DataTable();
            DataTable dtRMCustomerFull = new DataTable();

            try
            {
                DropDownList ddl = new DropDownList();
                Label        lbl = new Label();

                //customer = Session["Customer"].ToString();
                //if (customer.ToLower().Trim() == "find customer" || customer.ToLower().Trim() == "")
                //    customer = "";

                rmVo = (RMVo)Session["rmVo"];

                adviserVo = (AdvisorVo)Session["advisorVo"];

                //if (hdnCurrentPage.Value.ToString() != "")
                //{
                //    mypager.CurrentPage = Int32.Parse(hdnCurrentPage.Value.ToString());
                //    hdnCurrentPage.Value = "";
                //}

                int Count = 0;

                // Search Term is input into this hidden field
                //hdnNameFilter.Value = customer;

                //customerList = adviserBranchBo.(adviserVo.advisorId, mypager.CurrentPage, out Count, hdnSort.Value, hdnNameFilter.Value, hdnAreaFilter.Value, hdnPincodeFilter.Value, hdnParentFilter.Value, hdnRMFilter.Value, out genDictParent, out genDictRM, out genDictReassignRM);
                customerList    = adviserBranchBo.GetAdviserCustomerListForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, 0, out Count, hdnSort.Value, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnAreaFilter.Value, hdnCityFilter.Value, out advisorBranchList);
                allcustomerList = adviserBranchBo.GetAdviserCustomerListForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, 0, out Count, hdnSort.Value, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnAreaFilter.Value, hdnCityFilter.Value, out advisorBranchList);
                // lblTotalRows.Text = hdnRecordCount.Value = Count.ToString();

                #region forcustomerlist
                dtRMCustomer.Columns.Add("CustomerId");
                dtRMCustomer.Columns.Add("UserId");
                dtRMCustomer.Columns.Add("RMId");
                dtRMCustomer.Columns.Add("Parent");
                dtRMCustomer.Columns.Add("Cust_Comp_Name");
                dtRMCustomer.Columns.Add("PAN Number");
                dtRMCustomer.Columns.Add("Mobile Number");
                dtRMCustomer.Columns.Add("Phone Number");
                dtRMCustomer.Columns.Add("Email");
                dtRMCustomer.Columns.Add("Address");
                dtRMCustomer.Columns.Add("Area");
                dtRMCustomer.Columns.Add("City");
                dtRMCustomer.Columns.Add("Pincode");
                dtRMCustomer.Columns.Add("RMName");
                dtRMCustomer.Columns.Add("BranchName");
                dtRMCustomer.Columns.Add("BranchId");
                dtRMCustomer.Columns.Add("CustomerType");
                #endregion


                #region forallcustomerlist
                dtRMCustomerFull.Columns.Add("CustomerId");
                dtRMCustomerFull.Columns.Add("UserId");
                dtRMCustomerFull.Columns.Add("RMId");
                dtRMCustomerFull.Columns.Add("Parent");
                dtRMCustomerFull.Columns.Add("Cust_Comp_Name");
                dtRMCustomerFull.Columns.Add("PAN Number");
                dtRMCustomerFull.Columns.Add("Mobile Number");
                dtRMCustomerFull.Columns.Add("Phone Number");
                dtRMCustomerFull.Columns.Add("Email");
                dtRMCustomerFull.Columns.Add("Address");
                dtRMCustomerFull.Columns.Add("Area");
                dtRMCustomerFull.Columns.Add("City");
                dtRMCustomerFull.Columns.Add("Pincode");
                dtRMCustomerFull.Columns.Add("RMName");
                dtRMCustomerFull.Columns.Add("BranchName");
                dtRMCustomerFull.Columns.Add("BranchId");
                dtRMCustomerFull.Columns.Add("CustomerType");
                #endregion

                if (customerList == null)
                {
                    //DataRow drRMCustomer = dtRMCustomer.NewRow();
                    //drRMCustomer[0] = string.Empty;
                    //drRMCustomer[1] = string.Empty;
                    //drRMCustomer[2] = string.Empty;
                    //drRMCustomer[3] = string.Empty;
                    //drRMCustomer[4] = string.Empty;
                    //drRMCustomer[5] = string.Empty;
                    //drRMCustomer[6] = string.Empty;
                    //drRMCustomer[7] = string.Empty;
                    //drRMCustomer[8] = string.Empty;
                    //drRMCustomer[9] = string.Empty;
                    //drRMCustomer[10] = string.Empty;
                    //drRMCustomer[11] = string.Empty;
                    //drRMCustomer[12] = string.Empty;
                    //drRMCustomer[13] = string.Empty;
                    //drRMCustomer[14] = string.Empty;
                    //drRMCustomer[15] = string.Empty;
                    //drRMCustomer[16] = string.Empty;
                    //dtRMCustomer.Rows.Add(drRMCustomer);

                    //gvAssociation.DataSource = dtRMCustomer;
                    //gvAssociation.DataBind();
                    //gvAssociation.Columns[4].Visible = false;
                    ////gvAssociation.Columns[5].Visible = false;
                    //gvAssociation.Columns[8].Visible = false;

                    hdnRecordCount.Value = "0";

                    ErrorMessage.Visible = true;
                    trPager.Visible      = false;
                    // lblTotalRows.Visible = false;
                    lblCurrentPage.Visible = false;
                    btnReassignRM.Visible  = false;
                    trReassignRM.Visible   = false;
                }
                else
                {
                    if (rdReassignRM.Checked == true)
                    {
                        trReassignRM.Visible  = true;
                        btnReassignRM.Visible = true;
                    }

                    ErrorMessage.Visible = false;
                    //trPager.Visible = true;
                    // lblTotalRows.Visible = true;
                    //lblCurrentPage.Visible = true;

                    DataRow drRMCustomer;
                    DataRow drRMCustomerALL;

                    #region customer list according to pagecount

                    for (int i = 0; i < customerList.Count; i++)
                    {
                        drRMCustomer             = dtRMCustomer.NewRow();
                        customerVo               = new CustomerVo();
                        customerVo               = customerList[i];
                        drRMCustomer[0]          = customerVo.CustomerId.ToString();
                        drRMCustomer[1]          = customerVo.UserId.ToString();
                        drRMCustomer[2]          = customerVo.RmId.ToString();
                        drRMCustomer["BranchId"] = customerVo.BranchId.ToString();
                        if (customerVo.ParentCustomer != null)
                        {
                            drRMCustomer[3] = customerVo.ParentCustomer.ToString();
                        }

                        drRMCustomer[4] = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString();

                        //if (customerVo.Type.ToUpper().ToString() == "IND" || customerVo.Type == "")
                        //{
                        //    if (customerVo.ParentCustomer != null)
                        //    {
                        //        drRMCustomer[3] = customerVo.ParentCustomer.ToString();
                        //    }
                        //    else
                        //    {
                        //        drRMCustomer[3] = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString();
                        //    }
                        //    drRMCustomer[4] = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString();
                        //}
                        //else if (customerVo.Type.ToUpper().ToString() == "NIND")
                        //{
                        //    if (customerVo.ParentCompany != null)
                        //    {
                        //        drRMCustomer[3] = customerVo.ParentCompany.ToString();
                        //    }
                        //    else
                        //    {
                        //        drRMCustomer[3] = customerVo.CompanyName.ToString();
                        //    }
                        //    drRMCustomer[4] = customerVo.CompanyName.ToString();
                        //}
                        if (customerVo.PANNum != null)
                        {
                            drRMCustomer[5] = customerVo.PANNum.ToString();
                        }
                        else
                        {
                            drRMCustomer[5] = "";
                        }
                        drRMCustomer[6] = customerVo.Mobile1.ToString();
                        drRMCustomer[7] = customerVo.ResISDCode.ToString() + "-" + customerVo.ResSTDCode.ToString() + "-" + customerVo.ResPhoneNum.ToString();
                        drRMCustomer[8] = customerVo.Email.ToString();
                        if (customerVo.Adr1Line1 == null)
                        {
                            customerVo.Adr1Line1 = "";
                        }
                        if (customerVo.Adr1Line2 == null)
                        {
                            customerVo.Adr1Line2 = "";
                        }
                        if (customerVo.Adr1Line3 == null)
                        {
                            customerVo.Adr1Line3 = "";
                        }
                        if (customerVo.Adr1City == null)
                        {
                            customerVo.Adr1City = "";
                        }
                        if (customerVo.Adr1Line1.ToString() == "" && customerVo.Adr1Line2.ToString() == "")
                        {
                            drRMCustomer[9] = "-";
                        }
                        else if (customerVo.Adr1Line1.ToString() == "" && customerVo.Adr1Line2.ToString() != "")
                        {
                            drRMCustomer[9] = customerVo.Adr1Line2.ToString();
                        }
                        else if (customerVo.Adr1Line1.ToString() != "" && customerVo.Adr1Line2.ToString() == "")
                        {
                            drRMCustomer[9] = customerVo.Adr1Line1.ToString();
                        }
                        else if (customerVo.Adr1Line1.ToString() != "" && customerVo.Adr1Line2.ToString() != "")
                        {
                            drRMCustomer[9] = customerVo.Adr1Line1.ToString() + "," + customerVo.Adr1Line2.ToString() + "," + customerVo.Adr1Line3.ToString() + "," + customerVo.Adr1City.ToString();
                        }

                        drRMCustomer[10] = customerVo.Adr1Line3.ToString() + "," + customerVo.Adr1City.ToString();
                        if (customerVo.Adr1City.ToString() != "" && customerVo.Adr1Line3.ToString() != "")
                        {
                            drRMCustomer[11] = customerVo.Adr1City.ToString() + "," + customerVo.Adr1Line3.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() != "" && customerVo.Adr1Line3.ToString() == "")
                        {
                            drRMCustomer[11] = customerVo.Adr1City.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() == "" && customerVo.Adr1Line3.ToString() != "")
                        {
                            drRMCustomer[11] = customerVo.Adr1Line3.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() == "" && customerVo.Adr1Line3.ToString() == "")
                        {
                            drRMCustomer[11] = "-";
                        }
                        drRMCustomer[12] = customerVo.Adr1PinCode.ToString();
                        drRMCustomer[13] = customerVo.AssignedRM.ToString();
                        drRMCustomer[14] = customerVo.BranchName.ToString();
                        drRMCustomer[16] = customerVo.UserType.ToString();
                        dtRMCustomer.Rows.Add(drRMCustomer);
                    }

                    #endregion

                    #region customerlist full

                    for (int i = 0; i < allcustomerList.Count; i++)
                    {
                        drRMCustomerALL             = dtRMCustomerFull.NewRow();
                        customerVo                  = new CustomerVo();
                        customerVo                  = allcustomerList[i];
                        drRMCustomerALL[0]          = customerVo.CustomerId.ToString();
                        drRMCustomerALL[1]          = customerVo.UserId.ToString();
                        drRMCustomerALL[2]          = customerVo.RmId.ToString();
                        drRMCustomerALL["BranchId"] = customerVo.BranchId.ToString();
                        if (customerVo.ParentCustomer != null)
                        {
                            drRMCustomerALL[3] = customerVo.ParentCustomer.ToString();
                        }

                        drRMCustomerALL[4] = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString();
                        if (customerVo.PANNum != null)
                        {
                            drRMCustomerALL[5] = customerVo.PANNum.ToString();
                        }
                        else
                        {
                            drRMCustomerALL[5] = "";
                        }
                        drRMCustomerALL[6] = customerVo.Mobile1.ToString();
                        drRMCustomerALL[7] = customerVo.ResISDCode.ToString() + "-" + customerVo.ResSTDCode.ToString() + "-" + customerVo.ResPhoneNum.ToString();
                        drRMCustomerALL[8] = customerVo.Email.ToString();
                        if (customerVo.Adr1Line1 == null)
                        {
                            customerVo.Adr1Line1 = "";
                        }
                        if (customerVo.Adr1Line2 == null)
                        {
                            customerVo.Adr1Line2 = "";
                        }
                        if (customerVo.Adr1Line3 == null)
                        {
                            customerVo.Adr1Line3 = "";
                        }
                        if (customerVo.Adr1City == null)
                        {
                            customerVo.Adr1City = "";
                        }
                        if (customerVo.Adr1Line1.ToString() == "" && customerVo.Adr1Line2.ToString() == "")
                        {
                            drRMCustomerALL[9] = "-";
                        }
                        else if (customerVo.Adr1Line1.ToString() == "" && customerVo.Adr1Line2.ToString() != "")
                        {
                            drRMCustomerALL[9] = customerVo.Adr1Line2.ToString();
                        }
                        else if (customerVo.Adr1Line1.ToString() != "" && customerVo.Adr1Line2.ToString() == "")
                        {
                            drRMCustomerALL[9] = customerVo.Adr1Line1.ToString();
                        }
                        else if (customerVo.Adr1Line1.ToString() != "" && customerVo.Adr1Line2.ToString() != "")
                        {
                            drRMCustomerALL[9] = customerVo.Adr1Line1.ToString() + "," + customerVo.Adr1Line2.ToString() + "," + customerVo.Adr1Line3.ToString() + "," + customerVo.Adr1City.ToString();
                        }

                        drRMCustomerALL[10] = customerVo.Adr1Line3.ToString() + "," + customerVo.Adr1City.ToString();
                        if (customerVo.Adr1City.ToString() != "" && customerVo.Adr1Line3.ToString() != "")
                        {
                            drRMCustomerALL[11] = customerVo.Adr1City.ToString() + "," + customerVo.Adr1Line3.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() != "" && customerVo.Adr1Line3.ToString() == "")
                        {
                            drRMCustomerALL[11] = customerVo.Adr1City.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() == "" && customerVo.Adr1Line3.ToString() != "")
                        {
                            drRMCustomerALL[11] = customerVo.Adr1Line3.ToString();
                        }
                        else if (customerVo.Adr1City.ToString() == "" && customerVo.Adr1Line3.ToString() == "")
                        {
                            drRMCustomerALL[11] = "-";
                        }
                        drRMCustomerALL[12] = customerVo.Adr1PinCode.ToString();
                        drRMCustomerALL[13] = customerVo.AssignedRM.ToString();
                        drRMCustomerALL[14] = customerVo.BranchName.ToString();
                        drRMCustomerALL[16] = customerVo.UserType.ToString();
                        dtRMCustomerFull.Rows.Add(drRMCustomerALL);
                    }

                    #endregion

                    gvAssociations.DataSource = dtRMCustomer;
                    gvAssociations.DataBind();

                    #region customerlist

                    if (Cache["gvAssociation" + adviserVo.advisorId] == null)
                    {
                        Cache.Insert("gvAssociation" + adviserVo.advisorId, dtRMCustomer);
                    }
                    else
                    {
                        Cache.Remove("gvAssociation" + adviserVo.advisorId);
                        Cache.Insert("gvAssociation" + adviserVo.advisorId, dtRMCustomer);
                    }

                    #endregion

                    #region customerlist full
                    if (Cache["gvAssociationFull" + adviserVo.advisorId] == null)
                    {
                        Cache.Insert("gvAssociationFull" + adviserVo.advisorId, dtRMCustomerFull);
                    }
                    else
                    {
                        Cache.Remove("gvAssociationFull" + adviserVo.advisorId);
                        Cache.Insert("gvAssociationFull" + adviserVo.advisorId, dtRMCustomerFull);
                    }

                    #endregion



                    gvAssociations.Columns[4].Visible = false;
                    //gvAssociation.Columns[5].Visible = false;
                    gvAssociations.Columns[8].Visible = false;
                    //ReAssignRMControl(genDictRM);

                    //if (genDictParent.Count > 0)
                    //{
                    //    DropDownList ddlParent = GetParentDDL();
                    //    if (ddlParent != null)
                    //    {
                    //        ddlParent.DataSource = genDictParent;
                    //        ddlParent.DataTextField = "Key";
                    //        ddlParent.DataValueField = "Value";
                    //        ddlParent.DataBind();
                    //        ddlParent.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select"));
                    //    }
                    //    if (hdnParentFilter.Value != "")
                    //    {
                    //        ddlParent.SelectedValue = hdnParentFilter.Value.ToString();
                    //    }
                    //}

                    if (advisorBranchList.Count > 0)
                    {
                        if (ddlAdvisorBranchList != null)
                        {
                            ddlAdvisorBranchList.DataSource     = advisorBranchList;
                            ddlAdvisorBranchList.DataTextField  = "Value";
                            ddlAdvisorBranchList.DataValueField = "Key";
                            ddlAdvisorBranchList.DataBind();
                            ddlAdvisorBranchList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0"));
                        }
                        if (hdnRMFilter.Value != "")
                        {
                            ddlAdvisorBranchList.SelectedIndex = 0;
                        }
                    }
                    if (advisorBranchList.Count > 0 && !Page.IsPostBack)
                    {
                        if (ddlAdvisorBranchList != null)
                        {
                            ddlBranchList.DataSource     = advisorBranchList;
                            ddlBranchList.DataTextField  = "Value";
                            ddlBranchList.DataValueField = "Key";
                            ddlBranchList.DataBind();
                            ddlBranchList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select a Branch", "0"));
                        }
                        if (hdnRMFilter.Value != "")
                        {
                            ddlBranchList.SelectedIndex = 0;
                        }
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "AdviserCustomer.ascx.cs:BindCustomer()");
                object[] objects = new object[3];
                objects[0]   = rmVo;
                objects[1]   = customerVo;
                objects[2]   = customerList;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        //private void BindBranchAssociation()
        //{
        //    DataSet ds;
        //    DataTable dt;
        //    DataRow dr;
        //    try
        //    {
        //        if (rmVo.IsExternal == 1)
        //        {
        //            setBranchList("Y");
        //        }
        //        else
        //        {
        //            setBranchList("N");
        //        }


        //        if (Session["CurrentrmVo"] != null)
        //        {
        //            rmVo = (RMVo)Session["CurrentrmVo"];
        //        }
        //        else
        //        {
        //            rmVo = (RMVo)Session["rmVo"];
        //        }


        //        if (Session["advisorVo"] != null)
        //        {
        //            ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A");
        //        }
        //        else
        //        {
        //            ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A");
        //        }

        //        if (ds != null)
        //        {
        //            trBranchAssoication.Visible = true;
        //            dt = new DataTable();
        //            dt.Columns.Add("BranchId");

        //            dt.Columns.Add("Branch Code");
        //            dt.Columns.Add("Branch Name");

        //            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //            {
        //                dr = dt.NewRow();
        //                dr["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString();
        //                dr["Branch Code"] = ds.Tables[0].Rows[i]["AB_BranchCode"].ToString();
        //                dr["Branch Name"] = ds.Tables[0].Rows[i]["AB_BranchName"].ToString();
        //                dt.Rows.Add(dr);
        //            }
        //            associatedBranch.DataSource = dt;
        //            associatedBranch.DataTextField = "Branch Name";
        //            associatedBranch.DataValueField = "Branch Code";
        //            associatedBranch.DataBind();
        //            associatedBranch.Enabled = false;
        //            availableBranch.Enabled = false;
        //            //gvRMBranch.DataSource = dt;
        //            //gvRMBranch.DataBind();
        //            //gvRMBranch.Visible = true;
        //        }
        //        else
        //        {
        //            //trBranchAssoication.Visible = false;
        //            //gvRMBranch.DataSource = null;
        //            //gvRMBranch.DataBind();
        //            //gvRMBranch.Visible = false;
        //        }
        //    }
        //    catch (BaseApplicationException Ex)
        //    {
        //        throw Ex;
        //    }
        //    catch (Exception Ex)
        //    {
        //        BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex);
        //        NameValueCollection FunctionInfo = new NameValueCollection();

        //        FunctionInfo.Add("Method", "ViewRMDetails.ascx.cs:BindBranchAssociation()");

        //        object[] objects = new object[2];
        //        objects[0] = rmVo;
        //        objects[1] = advisorVo;

        //        FunctionInfo = exBase.AddObject(FunctionInfo, objects);
        //        exBase.AdditionalInformation = FunctionInfo;
        //        ExceptionManager.Publish(exBase);
        //        throw exBase;
        //    }


        //}

        private void BindBranchAssociation()
        {
            DataSet ds;
            //DataTable dt;
            DataTable dtList;
            //DataRow dr;
            DataRow         drList;
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();

            try
            {
                if (Session["CurrentrmVo"] != null)
                {
                    rmVo = (RMVo)Session["CurrentrmVo"];
                }
                else
                {
                    rmVo = (RMVo)Session["rmVo"];
                }

                if (Session["advisorVo"] != null)
                {
                    ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, advisorVo.advisorId, "A");
                }
                else
                {
                    ds = advisorBranchBo.GetRMBranchAssociation(rmVo.RMId, 0, "A");
                }

                if (ds != null)
                {
                    _commondatasetdestination = ds;
                    //dt = new DataTable();
                    //dt.Columns.Add("BranchId");
                    //dt.Columns.Add("RMId");
                    //dt.Columns.Add("Branch Name");
                    //dt.Columns.Add("Branch Code");
                    dtList = new DataTable();
                    dtList.Columns.Add("Branch");
                    dtList.Columns.Add("BranchId");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //dr = dt.NewRow();
                        //dr["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString();
                        //dr["RMId"] = ds.Tables[0].Rows[i]["AR_RMId"].ToString();
                        //dr["Branch Code"] = ds.Tables[0].Rows[i]["AB_BranchCode"].ToString();
                        //dr["Branch Name"] = ds.Tables[0].Rows[i]["AB_BranchName"].ToString();

                        drList             = dtList.NewRow();
                        drList["Branch"]   = ((ds.Tables[0].Rows[i]["AB_BranchName"].ToString()) + "," + (ds.Tables[0].Rows[i]["AB_BranchCode"].ToString()));
                        drList["BranchId"] = ds.Tables[0].Rows[i]["AB_BranchId"].ToString();
                        //dt.Rows.Add(dr);
                        dtList.Rows.Add(drList);
                        hdnExistingBranches.Value += drList["BranchId"].ToString() + ",";
                    }

                    Session["AssociatedBranch"] = dtList;

                    // Show binded contents in List box
                    associatedBranch.DataSource     = dtList;
                    associatedBranch.DataTextField  = "Branch";
                    associatedBranch.DataValueField = "BranchId";
                    associatedBranch.DataBind();



                    if (rmVo.IsExternal == 1)
                    {
                        setBranchList("Y");
                    }
                    else
                    {
                        setBranchList("N");
                    }
                }
                else
                {
                    if (rmVo.IsExternal == 1)
                    {
                        setBranchList("Y");
                    }
                    else
                    {
                        setBranchList("N");
                    }

                    //gvBranchList.Visible = false;
                }
                associatedBranch.Enabled = false;
                availableBranch.Enabled  = false;
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "ViewRMDetails.ascx.cs:BindBranchAssociation()");

                object[] objects = new object[2];
                objects[0] = rmVo;
                objects[1] = advisorVo;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserVo          userVo          = new UserVo();
            RMVo            rmVo            = new RMVo();
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();

            try
            {
                lblDate.Text = DateTime.Now.ToLongDateString();

                AdvisorLogo.Style.Add("display", "block");
                BranchLogo.Style.Add("display", "block");

                if (Session["userVo"] != null)
                {
                    userVo = (UserVo)(Session["userVo"]);
                    rmVo   = (RMVo)(Session[SessionContents.RmVo]);

                    lblUserName.Text      = "Welcome " + " " + userVo.FirstName + " " + userVo.LastName;
                    lblSignOut.Text       = "SignOut";
                    LinkButtonSignIn.Text = "";
                    if (Session[SessionContents.LogoPath] != null)
                    {
                        logoPath = (Session[SessionContents.LogoPath].ToString());
                    }
                    else
                    {
                        if (Session["advisorVo"] != null)
                        {
                            logoPath = "Images/" + ((AdvisorVo)Session["advisorVo"]).LogoPath;
                        }
                    }
                    if (Session[SessionContents.BranchLogoPath] != null)
                    {
                        branchLogoPath = (Session[SessionContents.BranchLogoPath].ToString());
                    }
                    else
                    {
                        if (rmVo != null)
                        {
                            branchLogoPath = "Images/" + (advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId))).LogoPath;
                        }
                    }

                    if (logoPath != "Images/")
                    {
                        AdvisorLogo.Src = logoPath;
                    }
                    if (branchLogoPath != "Images/")
                    {
                        BranchLogo.Src = branchLogoPath;
                    }
                    //if (Session["advisorVo"] != null)
                    //{
                    //    //GeneralMenu.Visible = false;
                    //    //AdvisorHeader.Visible = true;
                    //    GeneralMenu.Style.Add("display", "none");
                    //    AdvisorHeader.Style.Add("display", "block");
                    //    RMHeader.Style.Add("display", "none");
                    //    CustomerIndividualHeader.Style.Add("display", "none");
                    //    CustomerNonIndividualHeader.Style.Add("display", "none");
                    //    RMCLientHeaderIndividual.Style.Add("display", "none");
                    //    RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //    BMHeader.Style.Add("display", "none");

                    //}
                    //if (Session["CustomerVo"] != null && Session["rmVo"] == null)
                    //{
                    //    //GeneralMenu.Visible = false;
                    //    //AdvisorHeader.Visible = true;
                    //    GeneralMenu.Style.Add("display", "none");
                    //    AdvisorHeader.Style.Add("display", "none");
                    //    RMHeader.Style.Add("display", "none");

                    CustomerVo customerVo = new CustomerVo();
                    customerVo = (CustomerVo)(Session["CustomerVo"]);

                    //    if (customerVo.Type == "IND")
                    //    {
                    //        CustomerIndividualHeader.Style.Add("display", "block");
                    //        CustomerNonIndividualHeader.Style.Add("display", "none");
                    //    }
                    //    else if (customerVo.Type == "NIND")
                    //    {
                    //        CustomerIndividualHeader.Style.Add("display", "none");
                    //        CustomerNonIndividualHeader.Style.Add("display", "block");
                    //    }

                    //    RMCLientHeaderIndividual.Style.Add("display", "none");
                    //    RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //    BMHeader.Style.Add("display", "none");
                    //}
                    //if (Session["rmVo"] != null)
                    //{
                    //    if (Session["CustomerVo"] != null)
                    //    {
                    //        if (userVo.UserType != "Customer")
                    //        {
                    //            GeneralMenu.Style.Add("display", "none");
                    //            AdvisorHeader.Style.Add("display", "none");
                    //            RMHeader.Style.Add("display", "none");
                    //            CustomerIndividualHeader.Style.Add("display", "none");
                    //            CustomerNonIndividualHeader.Style.Add("display", "none");
                    //            BMHeader.Style.Add("display", "none");

                    //            CustomerVo customerVo = new CustomerVo();
                    //            customerVo = (CustomerVo)(Session["CustomerVo"]);

                    //            if (customerVo.Type == "IND")
                    //            {
                    //                RMCLientHeaderIndividual.Style.Add("display", "block");
                    //                RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //            }
                    //            else if (customerVo.Type == "NIND")
                    //            {
                    //                RMCLientHeaderIndividual.Style.Add("display", "none");
                    //                RMCLientHeaderNonIndividual.Style.Add("display", "block");
                    //            }
                    //        }
                    //        else
                    //        {
                    //            GeneralMenu.Style.Add("display", "none");
                    //            AdvisorHeader.Style.Add("display", "none");
                    //            RMHeader.Style.Add("display", "none");
                    //            RMCLientHeaderIndividual.Style.Add("display", "none");
                    //            RMCLientHeaderNonIndividual.Style.Add("display", "none");

                    //            BMHeader.Style.Add("display", "none");

                    //            CustomerVo customerVo = new CustomerVo();
                    //            customerVo = (CustomerVo)(Session["CustomerVo"]);

                    //            if (customerVo.Type == "IND")
                    //            {
                    //                CustomerIndividualHeader.Style.Add("display", "block");
                    //                CustomerNonIndividualHeader.Style.Add("display", "none");
                    //            }
                    //            else if (customerVo.Type == "NIND")
                    //            {
                    //                CustomerIndividualHeader.Style.Add("display", "none");
                    //                CustomerNonIndividualHeader.Style.Add("display", "block");
                    //            }
                    //        }
                    //}
                    //else
                    //{
                    //    if (rmVo.RMRole == "RM")
                    //    {
                    //        GeneralMenu.Style.Add("display", "none");
                    //        AdvisorHeader.Style.Add("display", "none");
                    //        RMHeader.Style.Add("display", "block");
                    //        CustomerIndividualHeader.Style.Add("display", "none");
                    //        CustomerNonIndividualHeader.Style.Add("display", "none");
                    //        RMCLientHeaderIndividual.Style.Add("display", "none");
                    //        RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //        BMHeader.Style.Add("display", "none");
                    //    }
                    //    else if (rmVo.RMRole == "Branch Man")
                    //    {
                    //        GeneralMenu.Style.Add("display", "none");
                    //        AdvisorHeader.Style.Add("display", "none");
                    //        RMHeader.Style.Add("display", "none");
                    //        CustomerIndividualHeader.Style.Add("display", "none");
                    //        CustomerNonIndividualHeader.Style.Add("display", "none");
                    //        RMCLientHeaderIndividual.Style.Add("display", "none");
                    //        RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //        BMHeader.Style.Add("display", "block");
                    //    }
                    //}
                    //}
                }
                else
                {
                    // If User Sessions are empty, load the login control
                    //GeneralMenu.Style.Add("display", "block");
                    //AdvisorHeader.Style.Add("display", "none");
                    //RMHeader.Style.Add("display", "none");
                    //CustomerIndividualHeader.Style.Add("display", "none");
                    //CustomerNonIndividualHeader.Style.Add("display", "none");
                    //RMCLientHeaderIndividual.Style.Add("display", "none");
                    //RMCLientHeaderNonIndividual.Style.Add("display", "none");
                    //BMHeader.Style.Add("display", "none");
                    AdvisorLogo.Style.Add("display", "none");
                    BranchLogo.Style.Add("display", "none");

                    if (!IsPostBack)
                    {
                        if (Request.QueryString["UserId"] != null)
                        {
                            string userId = Request.QueryString["UserId"].ToString();
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','" + userId + "','');", true);
                        }
                        else
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','','');", true);
                        }
                    }
                }

                if (AdvisorLogo.Src == "")
                {
                    AdvisorLogo.Style.Add("display", "none");
                }

                if (BranchLogo.Src == "")
                {
                    BranchLogo.Style.Add("display", "none");
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "Default.aspx:PageLoad()");

                object[] objects = new object[1];
                objects[0] = userVo;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void LoadBranchAssociation(int currentPage)
        {
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            AdvisorStaffBo  advisorStaffBo  = new AdvisorStaffBo();
            UserVo          userVo          = null;
            DataSet         ds = null;

            try
            {
                int Count;
                ds = advisorBranchBo.GetBranchAssociation(advisorVo.advisorId, currentPage, out Count, hdnBranchFilter.Value, hdnRMFilter.Value, hdnSort.Value, out genDictBranch, out genDictRM);

                if (Count > 0)
                {
                    lblTotalRows.Text = hdnRecordCount.Value = Count.ToString();
                    tblPager.Visible  = true;
                }

                if (ds != null)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        lblMsg.Visible = false;

                        DataTable dt = new DataTable();
                        dt.Columns.Add("BranchId");
                        dt.Columns.Add("RMId");
                        dt.Columns.Add("Branch Name");
                        dt.Columns.Add("RM Name");

                        DataRow dr;
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            dr                = dt.NewRow();
                            dr["BranchId"]    = ds.Tables[0].Rows[i]["branchId"].ToString();
                            dr["RMId"]        = ds.Tables[0].Rows[i]["RMId"].ToString();
                            dr["Branch Name"] = ds.Tables[0].Rows[i]["BranchName"].ToString();
                            dr["RM Name"]     = ds.Tables[0].Rows[i]["RMName"].ToString();
                            dt.Rows.Add(dr);
                        }
                        gvBranchList.DataSource = dt;
                        gvBranchList.DataBind();

                        if (genDictBranch.Count > 0)
                        {
                            DropDownList ddlBranch = GetBranchDDL();
                            if (ddlBranch != null)
                            {
                                ddlBranch.DataSource     = genDictBranch;
                                ddlBranch.DataTextField  = "Value";
                                ddlBranch.DataValueField = "Key";
                                ddlBranch.DataBind();
                                ddlBranch.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select"));
                            }
                            if (hdnBranchFilter.Value != "")
                            {
                                ddlBranch.SelectedValue = hdnBranchFilter.Value.ToString();
                            }
                        }

                        if (genDictRM.Count > 0)
                        {
                            DropDownList ddlRM = GetRMDDL();
                            if (ddlRM != null)
                            {
                                ddlRM.DataSource     = genDictRM;
                                ddlRM.DataTextField  = "Value";
                                ddlRM.DataValueField = "Key";
                                ddlRM.DataBind();
                                ddlRM.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select"));
                            }
                            if (hdnRMFilter.Value != "")
                            {
                                ddlRM.SelectedValue = hdnRMFilter.Value.ToString();
                            }
                        }

                        gvBranchList.Visible = true;
                        this.GetPageCount();
                    }
                }
                else
                {
                    gvBranchList.DataSource = null;
                    gvBranchList.DataBind();

                    lblMsg.Visible = true;
                    lblMsg.Text    = "Branch Association is not done..! ";
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewBranchAssociation.ascx.cs:LoadBranchAssociation()");
                object[] objects = new object[2];
                objects[0]   = ds;
                objects[1]   = userVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#19
0
        /// <summary>
        /// Modified this function to add a new column(No. of customers) to the Branch AUM grid
        /// </summary>
        private void LoadAdminBranchPerformance()
        {
            List <AdvisorBranchVo> branchList      = new List <AdvisorBranchVo>();
            AdvisorBranchBo        advisorBranchBo = new AdvisorBranchBo();

            DataTable dt       = new DataTable();
            DataRow   drResult = null;
            DataRow   dr       = null;
            int       Count    = 0;

            mfTotal = 0;
            total   = 0;
            try
            {
                ds = assetBo.GetAdviserBranchMF_EQ_In_AggregateCurrentValues(advisorVo.advisorId, out Count, mypager.CurrentPage, out total);
                lblTotalRows.Text = hdnRecordCount.Value = Count.ToString();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblGT.Visible  = true;
                    lblGTT.Visible = true;


                    dt.Columns.Add("Branch Id");
                    dt.Columns.Add("Branch Name");
                    dt.Columns.Add("Branch Code");
                    //dt.Columns.Add("Equity");
                    dt.Columns.Add("Equity");
                    dt.Columns.Add("MF");
                    dt.Columns.Add("Insurance");
                    dt.Columns.Add("NoOfCustomers");
                    //dt.Columns.Add(new DataColumn("Equity", typeof(decimal)));
                    //dt.Columns.Add(new DataColumn("MF", typeof(decimal)));
                    //dt.Columns.Add(new DataColumn("Insurance", typeof(decimal)));

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        dr       = dt.NewRow();
                        drResult = ds.Tables[0].Rows[i];
                        dr[0]    = drResult["A_AdviserId"].ToString();
                        dr[1]    = drResult["AB_BranchName"].ToString();
                        dr[2]    = drResult["AB_BranchCode"].ToString();
                        if (Convert.ToDecimal(drResult["EquityAggr"].ToString()) == 0)
                        {
                            dr[3] = "0";
                        }
                        else
                        {
                            dr[3] = decimal.Parse(drResult["EquityAggr"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));
                        }
                        eqTotal = eqTotal + Convert.ToDecimal(drResult["EquityAggr"].ToString());

                        if (Convert.ToDecimal(drResult["MFAggr"].ToString()) == 0)
                        {
                            dr[4] = "0";
                        }
                        else
                        {
                            dr[4] = decimal.Parse(drResult["MFAggr"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));
                        }
                        mfTotal = mfTotal + Convert.ToDecimal(drResult["MFAggr"].ToString());

                        if (Convert.ToDecimal(drResult["InsuranceAggr"].ToString()) == 0)
                        {
                            dr[5] = "0";
                        }
                        else
                        {
                            dr[5] = decimal.Parse(drResult["InsuranceAggr"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));
                        }
                        insuranceTotal = insuranceTotal + Convert.ToDecimal(drResult["InsuranceAggr"].ToString());


                        dr[6]         = drResult["NoOfCustomers"].ToString();
                        customerTotal = customerTotal + Int32.Parse(drResult["NoOfCustomers"].ToString());

                        dt.Rows.Add(dr);
                    }


                    gvrAdminBranchPerform.DataSource = dt;
                    gvrAdminBranchPerform.DataBind();
                    gvrAdminBranchPerform.Visible = true;
                    GetPageCount();
                }
                else
                {
                    lblGT.Visible  = false;
                    lblGTT.Visible = false;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "IFAAdminMainDashboard.ascx:LoadAdminBranchPerformance()");
                object[] objects = new object[3];
                objects[0]   = advisorVo;
                objects[1]   = branchList;
                objects[2]   = ds;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#20
0
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            UserVo          userVo               = new UserVo();
            UserBo          userBo               = new UserBo();
            AdvisorStaffBo  advisorStaffBo       = new AdvisorStaffBo();
            AdvisorBranchBo advisorBranchBo      = new AdvisorBranchBo();
            AdvisorBranchVo advisorBranchVo      = new AdvisorBranchVo();
            RMVo            rmVo                 = new RMVo();
            AdvisorBo       advisorBo            = new AdvisorBo();
            AdvisorVo       advisorVo            = new AdvisorVo();
            CustomerBo      customerBo           = new CustomerBo();
            CustomerVo      customerVo           = new CustomerVo();
            List <string>   roleList             = new List <string>();
            string          sourcePath           = "";
            string          branchLogoSourcePath = "";
            int             count;
            bool            isGrpHead = false;

            if (!CheckSuperAdmin())
            {
                if (txtLoginId.Text == "" || txtPassword.Text == "")
                {
                    lblIllegal.Visible = true;
                    lblIllegal.Text    = "Username and Password does not match";
                }
                else
                {
                    if (userBo.ValidateUser(txtLoginId.Text, txtPassword.Text))  // Validating the User Using the Username and Password
                    {
                        Session["id"]      = "";
                        lblIllegal.Visible = true;


                        userVo            = userBo.GetUser(txtLoginId.Text);
                        Session["UserVo"] = userVo;
                        AddLoginTrack(txtLoginId.Text, txtPassword.Text, true, userVo.UserId);

                        if (userVo.theme != null)
                        {
                            Session["Theme"]        = userVo.theme.ToString();
                            Session["refreshTheme"] = true;
                        }
                        else
                        {
                            Session["Theme"]        = "Purple";
                            Session["refreshTheme"] = true;
                        }

                        if (userVo.IsTempPassword == 0)
                        {
                            string UserName = userVo.FirstName + " " + userVo.LastName;


                            if (userVo.UserType == "Advisor")
                            {
                                Session[SessionContents.CurrentUserRole] = "Admin";
                                Session["advisorVo"] = advisorBo.GetAdvisorUser(userVo.UserId);
                                Session["rmVo"]      = advisorStaffBo.GetAdvisorStaff(userVo.UserId);
                                advisorVo            = (AdvisorVo)Session["advisorVo"];
                                rmVo = (RMVo)Session["rmVo"];
                                Session["adviserId"] = advisorBo.GetRMAdviserId(rmVo.RMId);
                                if (advisorVo.LogoPath == null || advisorVo.LogoPath == "")
                                {
                                    advisorVo.LogoPath = "spacer.png";
                                }
                                else
                                {
                                    sourcePath = "Images/" + advisorVo.LogoPath.ToString();
                                    if (!System.IO.File.Exists(Server.MapPath(sourcePath)))
                                    {
                                        sourcePath = "";
                                    }
                                }

                                Session[SessionContents.LogoPath] = sourcePath;

                                roleList = userBo.GetUserRoles(userVo.UserId);
                                count    = roleList.Count;

                                if (count == 3)
                                {
                                    advisorBranchVo            = advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId));
                                    Session["advisorBranchVo"] = advisorBranchVo;
                                    branchLogoSourcePath       = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                    Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdvisorRMBMDashBoard','login','" + UserName + "','" + sourcePath + "');", true);
                                    //login user role Type
                                    Session["S_CurrentUserRole"] = "Admin";
                                }
                                if (count == 2)
                                {
                                    if (roleList.Contains("RM") && roleList.Contains("BM"))
                                    {
                                        advisorBranchVo            = advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId));
                                        Session["advisorBranchVo"] = advisorBranchVo;
                                        //login user role Type
                                        Session["S_CurrentUserRole"]            = "RM";
                                        branchLogoSourcePath                    = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                        Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('BMRMDashBoard','login','" + UserName + "','" + sourcePath + "','" + branchLogoSourcePath + "');", true);
                                    }
                                    else if (roleList.Contains("RM") && roleList.Contains("Admin"))
                                    {
                                        advisorBranchVo            = advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId));
                                        Session["advisorBranchVo"] = advisorBranchVo;
                                        //login user role Type
                                        Session["S_CurrentUserRole"]            = "Admin";
                                        branchLogoSourcePath                    = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                        Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdvisorRMDashBoard','login','" + UserName + "','" + sourcePath + "');", true);
                                    }
                                    else if (roleList.Contains("BM") && roleList.Contains("Admin"))
                                    {
                                        advisorBranchVo            = advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId));
                                        Session["advisorBranchVo"] = advisorBranchVo;
                                        branchLogoSourcePath       = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                        Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                        //login user role Type
                                        Session["S_CurrentUserRole"] = "Admin";
                                    }
                                }


                                if (count == 1)
                                {
                                    if (roleList.Contains("RM"))
                                    {
                                        Session["adviserId"] = advisorBo.GetRMAdviserId(rmVo.RMId);
                                        //Session["advisorVo"]=advisorBo.GetAdvisor(
                                        branchLogoSourcePath = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                        sourcePath           = "Images/" + userBo.GetRMLogo(rmVo.RMId);
                                        Session[SessionContents.LogoPath]       = sourcePath;
                                        Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                        //login user role Type Issue Reported by Ajay on July 1 2010
                                        Session["S_CurrentUserRole"] = "RM";
                                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('RMDashBoard','login','" + UserName + "','" + sourcePath + "','" + branchLogoSourcePath + "');", true);
                                    }
                                    else if (roleList.Contains("BM"))
                                    {
                                        advisorBranchVo            = advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId));
                                        Session["advisorBranchVo"] = advisorBranchVo;
                                        branchLogoSourcePath       = "Images/" + userBo.GetRMBranchLogo(rmVo.RMId);
                                        Session[SessionContents.BranchLogoPath] = branchLogoSourcePath;
                                        //login user role Type Issue Reported by Ajay on July 1 2010
                                        Session["S_CurrentUserRole"] = "BM";
                                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('BMDashBoard','login','" + UserName + "','" + sourcePath + "','" + branchLogoSourcePath + "');", true);
                                    }
                                    else
                                    {
                                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdvisorDashBoard','login','" + UserName + "','" + sourcePath + "');", true);
                                    }
                                }
                                GetLatestValuationDate();
                            }

                            else if (userVo.UserType == "Customer")
                            {
                                customerVo = customerBo.GetCustomerInfo(userVo.UserId);
                                //Session["advisorVo"] = advisorBo.GetAdvisorUser(userVo.UserId);
                                Session["CustomerVo"] = customerVo;
                                customerVo            = (CustomerVo)Session["CustomerVo"];

                                advisorVo            = advisorBo.GetAdvisor(advisorBranchBo.GetBranch(customerVo.BranchId).AdviserId);
                                rmVo                 = advisorStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                                Session["rmVo"]      = rmVo;
                                Session["advisorVo"] = advisorVo;

                                //if(customerVo!=null){

                                sourcePath = "Images/" + userBo.GetCustomerLogo(customerVo.CustomerId);
                                Session[SessionContents.LogoPath] = sourcePath;
                                Session["S_CurrentUserRole"]      = "Customer";
                                GetLatestValuationDate();

                                Session["IsDashboard"] = "true";
                                isGrpHead = customerBo.CheckCustomerGroupHead(customerVo.CustomerId);
                                if (isGrpHead == true)
                                {
                                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdvisorRMCustGroupDashboard','login','" + UserName + "','" + sourcePath + "');", true);
                                }
                                else
                                {
                                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdvisorRMCustIndiDashboard','login','" + UserName + "','" + sourcePath + "');", true);
                                }
                            }

                            else if (userVo.UserType == "Admin")
                            {
                                Session["refreshTheme"] = false;
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loginloadcontrol('AdminUpload','login','" + UserName + "','');", true);
                            }
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ChangeTempPassword','none');", true);
                        }
                    }

                    else
                    {
                        lblIllegal.Visible = true;
                        lblIllegal.Text    = "Username and Password does not match";
                        AddLoginTrack(txtLoginId.Text, txtPassword.Text, false, 0);
                    }
                }
            }
        }
        private void BindCustomer(int CurrentPage)
        {
            int             count;
            DataSet         dsCustomerFolio;
            AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
            DataTable       dtCustomerFolio = new DataTable();

            try
            {
                if (hdnCurrentPage.Value.ToString() != "")
                {
                    mypager.CurrentPage  = Int32.Parse(hdnCurrentPage.Value.ToString());
                    hdnCurrentPage.Value = "";
                }


                dsCustomerFolio   = adviserBranchBo.GetAdviserCustomerFolioMerge(adviserVo.advisorId, mypager.CurrentPage, hdnNameFilter.Value.ToString(), out count);
                lblTotalRows.Text = hdnRecordCount.Value = count.ToString();

                dtCustomerFolio.Columns.Add("CustomerId");
                dtCustomerFolio.Columns.Add("CustomerName");
                dtCustomerFolio.Columns.Add("AMCName");
                dtCustomerFolio.Columns.Add("AMCCode");
                dtCustomerFolio.Columns.Add("Count");
                dtCustomerFolio.Columns.Add("portfilionumber");
                dtCustomerFolio.Columns.Add("mergerstatus");

                if (dsCustomerFolio.Tables[0].Rows.Count == 0)
                {
                    //hdnRecordCount.Value = "0";

                    ErrorMessage.Visible   = true;
                    trPager.Visible        = false;
                    lblTotalRows.Visible   = false;
                    lblCurrentPage.Visible = false;
                }
                else
                {
                    //trPager.Visible = true;
                    //lblTotalRows.Visible = true;
                    //lblCurrentPage.Visible = true;

                    DataRow   drCustomerFolio;
                    DataTable dtCustomer = dsCustomerFolio.Tables[0];
                    ErrorMessage.Visible   = false;
                    trPager.Visible        = true;
                    lblTotalRows.Visible   = true;
                    lblCurrentPage.Visible = true;
                    for (int i = 0; i < dtCustomer.Rows.Count; i++)
                    {
                        drCustomerFolio = dtCustomerFolio.NewRow();

                        drCustomerFolio["CustomerId"]      = dtCustomer.Rows[i]["customerid"];
                        drCustomerFolio["CustomerName"]    = dtCustomer.Rows[i]["name"];
                        drCustomerFolio["AMCName"]         = dtCustomer.Rows[i]["amcname"];
                        drCustomerFolio["AMCCode"]         = dtCustomer.Rows[i]["amccode"];
                        drCustomerFolio["Count"]           = dtCustomer.Rows[i]["number"];
                        drCustomerFolio["portfilionumber"] = dtCustomer.Rows[i]["portfilionumber"];
                        drCustomerFolio["mergerstatus"]    = dtCustomer.Rows[i]["mergerstatus"];
                        dtCustomerFolio.Rows.Add(drCustomerFolio);
                    }

                    gvCustomerFolioMerge.DataSource = dtCustomerFolio;
                    gvCustomerFolioMerge.DataBind();

                    //Customer search
                    //TextBox txtBranch = GetBranchTextBox();
                    //if (txtBranch != null)
                    //{
                    //    if (hdnBranchFilter.Value != "")
                    //    {
                    //        txtBranch.Text = hdnBranchFilter.Value.ToString();
                    //    }
                    //}

                    this.GetPageCount();
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "CustomerFolioMerge.ascx.cs:BindCustomer()");
                object[] objects = new object[3];
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
示例#22
0
        protected void ddlAdvisorBranchList_SelectedIndexChanged(object sender, EventArgs e)
        {
            AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
            //ddlBranchRMList.Visible = false;
            DataTable dtAllPagesCustomer;
            bool      groupHead = false;

            if (ddlAdvisorBranchList.SelectedIndex != 0)
            {
                if (hndAllPageSelect.Value == "1")
                {
                    dtAllPagesCustomer = adviserBranchBo.GetAllpagesAdvisorCustomerForAssociation(int.Parse(hndBranchIdFilter.Value.ToString()), adviserVo.advisorId, hdnNameFilter.Value, hdnBranchFilter.Value, hdnRMNameFilter.Value, hdnCityFilter.Value);

                    DataTable dtRMList = advisorStaffBo.GetBranchRMList(int.Parse(ddlAdvisorBranchList.SelectedValue.ToString()));
                    ddlBranchRMList.DataSource     = dtRMList;
                    ddlBranchRMList.DataTextField  = dtRMList.Columns["RMName"].ToString();
                    ddlBranchRMList.DataValueField = dtRMList.Columns["AR_RMId"].ToString();
                    ddlBranchRMList.DataBind();
                    ddlBranchRMList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0"));
                    foreach (DataRow dr in dtAllPagesCustomer.Rows)
                    {
                        dtRMList.DefaultView.Sort = "AR_RMId";
                        int i = dtRMList.DefaultView.Find(dr["AR_RMId"]);

                        if (i == (0 - 1))
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Some of the selected customer need to change RM also, please select the RM');", true);
                            trReassignRM.Visible = true;
                        }
                        else
                        {
                            trReassignRM.Visible = false;
                        }
                    }
                }
                else
                {
                    string allCustomersId = Convert.ToString(GetSelectedCustomerIdString());
                    if (string.IsNullOrEmpty(allCustomersId))
                    {
                        ddlAdvisorBranchList.SelectedIndex = 0;
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Please select some customer for branch reassign');", true);
                        return;
                    }
                    groupHead = advisorBranchBO.CheckCustomerGroupHead(allCustomersId);
                    if (groupHead == true)
                    {
                        hndIsGroupHead.Value = "true";
                    }
                    else
                    {
                        hndIsGroupHead.Value = "false";
                    }
                    //if (groupHead == true)
                    //{
                    //    //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "window.confirm('The search fee will now be deducted for the criteria entered. Do you wish to continue?');", true);
                    //    //AjaxControlToolkit.ConfirmButtonExtender cbExt = new AjaxControlToolkit.ConfirmButtonExtender();
                    //    //cbExt.ConfirmText
                    //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "confirm('Unable to locate your search item. Do you want to search the closest match from your item?');", true);

                    //}
                    DataTable dtRMList = advisorStaffBo.GetBranchRMList(int.Parse(ddlAdvisorBranchList.SelectedValue.ToString()));
                    ddlBranchRMList.DataSource     = dtRMList;
                    ddlBranchRMList.DataTextField  = dtRMList.Columns["RMName"].ToString();
                    ddlBranchRMList.DataValueField = dtRMList.Columns["AR_RMId"].ToString();
                    ddlBranchRMList.DataBind();
                    ddlBranchRMList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "0"));
                    foreach (GridViewRow dr in gvAssociation.Rows)
                    {
                        int     rowIndex = dr.RowIndex;
                        DataKey dKey     = gvAssociation.DataKeys[rowIndex];

                        int    customerId = int.Parse(dKey.Values["CustomerId"].ToString());
                        int    userId     = int.Parse(dKey.Values["UserId"].ToString());
                        string rmId       = dKey.Values["RMId"].ToString();
                        int    branchId   = int.Parse(dKey.Values["BranchId"].ToString());

                        if (((CheckBox)dr.FindControl("chkId")).Checked == true)
                        {
                            dtRMList.DefaultView.Sort = "AR_RMId";
                            int i = dtRMList.DefaultView.Find(rmId);

                            if (i == (0 - 1))
                            {
                                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", "alert('Some of the selected customer need to change RM also, please select the RM');", true);
                                trReassignRM.Visible = true;
                            }
                            else
                            {
                                trReassignRM.Visible = false;
                            }
                        }
                    }
                }
            }
        }
示例#23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //advisorVo = (AdvisorVo)Session["advisorVo"];
            RMVo                   rmVo                   = new RMVo();
            AdvisorBranchBo        advisorBranchBo        = new AdvisorBranchBo();
            GeneralConfigurationVo generalconfigurationvo = new GeneralConfigurationVo();
            string                 url = HttpContext.Current.Request.Url.AbsoluteUri;

            //tdTermsCondition.Visible = false;
            try
            {
                lblDate.Text = DateTime.Now.ToLongDateString();
                //imgLeftPlaceHolder.Style.Add("display", "none");
                imgCenterPlaceholder.Style.Add("display", "none");
                imgRightPlaceholder.Style.Add("display", "none");
                imgIFABanner.Style.Add("display", "none");
                if (Session[SessionContents.SAC_HostGeneralDetails] != null)
                {
                    generalconfigurationvo = (GeneralConfigurationVo)Session[SessionContents.SAC_HostGeneralDetails];


                    if (!IsPostBack)
                    {
                        if (!string.IsNullOrEmpty(generalconfigurationvo.HostLogoPlacement))
                        {
                            if (generalconfigurationvo.HostLogoPlacement == "TopLeftCorner")
                            {
                                imgLeftPlaceHolder.Style.Add("display", "block");
                            }
                            else if (generalconfigurationvo.HostLogoPlacement == "TopRightCorner")
                            {
                                imgRightPlaceholder.Style.Add("display", "block");
                            }
                            else if (generalconfigurationvo.HostLogoPlacement == "TopCenter")
                            {
                                imgCenterPlaceholder.Style.Add("display", "block");
                            }
                            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["Website_Logo"].ToString()))
                            {
                                imgLeftPlaceHolder.Src = ConfigurationManager.AppSettings["Website_Logo"].ToString();
                            }
                        }
                    }
                    if (Session["userVo"] != null)
                    {
                        userVo = (UserVo)(Session["userVo"]);
                        rmVo   = (RMVo)(Session[SessionContents.RmVo]);
                        //tdTermsCondition.Visible = true;
                        if (userVo.UserType == "Advisor")
                        {
                            //tdGodaddySeal.Visible = true;
                        }
                        else
                        {
                            //tdTermsCondition.Visible = false;
                        }

                        if ((!IsPostBack) && (userVo.UserType == "Customer"))
                        {
                            //tdTermsCondition.Visible = false;
                            tdDemo.Visible  = false;
                            tdHelp.Visible  = false;
                            lnkDemo.Visible = false;
                            lnkHelp.Visible = false;
                        }

                        lblUserName.Text = "Welcome " + " " + userVo.FirstName + " " + userVo.LastName;

                        if (userVo.PermisionList != null && userVo.RoleList.Contains("Ops") && userVo.PermisionList.Count() > 0)
                        {
                            lblPermissionList.Visible = true;
                            foreach (string PName in userVo.PermisionList)
                            {
                                lblPermissionList.Text += PName + ",";
                            }

                            lblPermissionList.Text = lblPermissionList.Text.TrimEnd(',');
                        }

                        lblSignOut.Text       = "SignOut";
                        LinkButtonSignIn.Text = "";
                        imgSessionOut.Visible = false;
                        if (Session[SessionContents.LogoPath] != null)
                        {
                            logoPath = (Session[SessionContents.LogoPath].ToString());
                        }
                        else
                        {
                            if (Session["advisorVo"] != null)
                            {
                                logoPath = "Images/" + ((AdvisorVo)Session["advisorVo"]).LogoPath;
                            }
                        }
                        if (Session[SessionContents.BranchLogoPath] != null)
                        {
                            branchLogoPath = (Session[SessionContents.BranchLogoPath].ToString());
                        }
                        else
                        {
                            if (rmVo != null)
                            {
                                branchLogoPath = "Images/" + (advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId))).LogoPath;
                            }
                        }

                        if (!IsPostBack)
                        {
                            if (!string.IsNullOrEmpty(generalconfigurationvo.AdviserLogoPlacement))
                            {
                                if (logoPath != "Images/" && logoPath != "")
                                {
                                    if (generalconfigurationvo.AdviserLogoPlacement == "TopLeftCorner")
                                    {
                                        imgLeftPlaceHolder.Style.Add("display", "block");
                                        imgLeftPlaceHolder.Src = logoPath;
                                    }
                                    else if (generalconfigurationvo.AdviserLogoPlacement == "TopRightCorner")
                                    {
                                        imgRightPlaceholder.Style.Add("display", "block");
                                        imgRightPlaceholder.Src = logoPath;
                                    }
                                    else if (generalconfigurationvo.AdviserLogoPlacement == "TopCenter")
                                    {
                                        imgCenterPlaceholder.Style.Add("display", "block");
                                        imgCenterPlaceholder.Src = logoPath;
                                    }
                                }
                            }



                            if (imgLeftPlaceHolder.Src != "" && imgRightPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgCenterPlaceholder.Style.Add("display", "block");
                                    imgCenterPlaceholder.Src = branchLogoPath;
                                }
                            }
                            else if (imgCenterPlaceholder.Src != "" && imgRightPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgLeftPlaceHolder.Style.Add("display", "block");
                                    imgLeftPlaceHolder.Src = branchLogoPath;
                                }
                            }
                            else if (imgLeftPlaceHolder.Src != "" && imgCenterPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgRightPlaceholder.Style.Add("display", "block");
                                    imgRightPlaceholder.Src = branchLogoPath;
                                }
                            }
                        }
                        if (advisorPreferenceVo.IsBannerEnabled)
                        {
                            imgPlaceholders.Visible  = false;
                            tblIFALongBanner.Visible = true;
                            if (!string.IsNullOrEmpty(advisorPreferenceVo.BannerImageName))
                            {
                                imgIFABanner.Style.Add("display", "block");
                                imgIFABanner.Src = "Images/" + advisorPreferenceVo.BannerImageName;
                            }
                            else
                            {
                                imgIFABanner.Style.Add("display", "none");
                            }
                        }
                        else
                        {
                            tblIFALongBanner.Visible = false;
                        }
                        //if (logoPath != "Images/")
                        //{
                        //    AdvisorLogo.Src = logoPath;
                        //}
                        //if (branchLogoPath != "Images/")
                        //{
                        //    BranchLogo.Src = branchLogoPath;
                        //}

                        CustomerVo customerVo = new CustomerVo();
                        customerVo = (CustomerVo)(Session["CustomerVo"]);
                    }
                    else
                    {
                        if (!IsPostBack)
                        {
                            if (Request.QueryString["UserId"] != null)
                            {
                                string userId = Request.QueryString["UserId"].ToString();
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','" + userId + "','');", true);
                            }
                            else
                            {
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','','');", true);
                            }
                        }
                    }
                }

                //if (AdvisorLogo.Src == "")
                //{
                //    AdvisorLogo.Style.Add("display", "none");
                //}

                //if (BranchLogo.Src == "")
                //{
                //    BranchLogo.Style.Add("display", "none");
                //}

                if (userVo.UserType != "Advisor")
                {
                    MenuItemCollection items = AdvisorMenu.Items;
                    foreach (MenuItem item in items)
                    {
                        if (item.Value == @"Transact/Business online")
                        {
                            item.Text = ""; item.SeparatorImageUrl = null;
                        }
                        if (item.Value == @"Repository")
                        {
                            item.Text = ""; item.SeparatorImageUrl = null;
                        }
                        if (item.Value == @"Info links")
                        {
                            item.Text = ""; item.SeparatorImageUrl = null;
                        }
                        if (item.Value == @"Price List")
                        {
                            item.Text = ""; item.SeparatorImageUrl = null;
                        }
                        if (item.Value == @"Calculators")
                        {
                            item.Text = ""; item.SeparatorImageUrl = null;
                        }
                    }
                    tdDemo.Visible = false;
                    tdHelp.Visible = false;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "Default.aspx:PageLoad()");

                object[] objects = new object[1];
                objects[0] = userVo;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UserBo          userBo         = new UserBo();
            UserVo          userVo         = new UserVo();
            UserVo          userVo2        = new UserVo();
            bool            branchDeletion = true;
            Random          id             = new Random();
            AdvisorBo       advisorBo      = new AdvisorBo();
            AdvisorBranchBo advisorBrBo    = new AdvisorBranchBo();

            bool   blUpdate    = true;
            string association = "";

            try
            {
                if (Validation())
                {
                    userId            = int.Parse(Session["userId"].ToString());
                    userVo            = userBo.GetUserDetails(rmVo.UserId);
                    userVo.Email      = txtEmail.Text.ToString();
                    userVo.FirstName  = txtFirstName.Text.ToString();
                    userVo.LastName   = txtLastName.Text.ToString();
                    userVo.MiddleName = txtMiddleName.Text.ToString();



                    rmVo.RMId  = int.Parse(Session["rmId"].ToString());
                    rmVo.Email = txtEmail.Text.ToString();
                    if (txtFaxNumber.Text == string.Empty || txtFaxNumber.Text == "")
                    {
                        rmVo.Fax = 0;
                    }
                    else
                    {
                        rmVo.Fax = int.Parse(txtFaxNumber.Text.ToString());
                    }
                    if (txtFaxISD.Text == string.Empty || txtFaxISD.Text == "")
                    {
                        rmVo.FaxIsd = 0;
                    }
                    else
                    {
                        rmVo.FaxIsd = int.Parse(txtFaxISD.Text.ToString());
                    }
                    if (txtExtSTD.Text == string.Empty || txtExtSTD.Text == "")
                    {
                        rmVo.FaxStd = 0;
                    }
                    else
                    {
                        rmVo.FaxStd = int.Parse(txtExtSTD.Text.ToString());
                    }
                    rmVo.FirstName  = txtFirstName.Text.ToString();
                    rmVo.LastName   = txtLastName.Text.ToString();
                    rmVo.MiddleName = txtMiddleName.Text.ToString();
                    if (txtMobileNumber.Text == string.Empty || txtMobileNumber.Text == "")
                    {
                        rmVo.Mobile = 0;
                    }
                    else
                    {
                        rmVo.Mobile = Convert.ToInt64(txtMobileNumber.Text.ToString());
                    }
                    if (txtPhDirectISD.Text == string.Empty || txtPhDirectISD.Text == "")
                    {
                        rmVo.OfficePhoneDirectIsd = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneDirectIsd = int.Parse(txtPhDirectISD.Text.ToString());
                    }
                    if (txtPhDirectPhoneNumber.Text == string.Empty || txtPhDirectPhoneNumber.Text == "")
                    {
                        rmVo.OfficePhoneDirectNumber = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneDirectNumber = int.Parse(txtPhDirectPhoneNumber.Text.ToString());
                    }
                    if (txtPhDirectSTD.Text == string.Empty || txtPhDirectSTD.Text == "")
                    {
                        rmVo.OfficePhoneDirectStd = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneDirectStd = int.Parse(txtPhDirectSTD.Text.ToString());
                    }
                    if (txtPhExtISD.Text == string.Empty || txtPhExtISD.Text == "")
                    {
                        rmVo.OfficePhoneExtIsd = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneExtIsd = int.Parse(txtPhExtISD.Text.ToString());
                    }
                    if (txtPhExtPhoneNumber.Text == string.Empty || txtPhExtPhoneNumber.Text == "")
                    {
                        rmVo.OfficePhoneExtNumber = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneExtNumber = int.Parse(txtPhExtPhoneNumber.Text.ToString());
                    }
                    if (txtExtSTD.Text == string.Empty || txtExtSTD.Text == "")
                    {
                        rmVo.OfficePhoneExtStd = 0;
                    }
                    else
                    {
                        rmVo.OfficePhoneExtStd = int.Parse(txtExtSTD.Text.ToString());
                    }
                    if (txtPhResiISD.Text == string.Empty || txtPhResiISD.Text == "")
                    {
                        rmVo.ResPhoneIsd = 0;
                    }
                    else
                    {
                        rmVo.ResPhoneIsd = int.Parse(txtPhResiISD.Text.ToString());
                    }
                    if (txtPhResiPhoneNumber.Text == string.Empty || txtPhResiPhoneNumber.Text == "")
                    {
                        rmVo.ResPhoneNumber = 0;
                    }
                    else
                    {
                        rmVo.ResPhoneNumber = int.Parse(txtPhResiPhoneNumber.Text.ToString());
                    }
                    if (txtResiSTD.Text == string.Empty || txtResiSTD.Text == "")
                    {
                        rmVo.ResPhoneStd = 0;
                    }
                    else
                    {
                        rmVo.ResPhoneStd = int.Parse(txtResiSTD.Text.ToString());
                    }
                    if (txtCTC.Text == string.Empty || txtCTC.Text == "")
                    {
                        rmVo.CTC = 0;
                    }
                    else
                    {
                        rmVo.CTC = Convert.ToDouble(txtCTC.Text.Trim());
                    }

                    if (ChklistRMBM.Items[0].Selected == true)
                    {
                        rmVo.RMRole = "RM";
                    }
                    else
                    {
                        rmVo.RMRole = "BM";
                    }

                    if (chkExternalStaff.Checked)
                    {
                        // Check for Internal Associations, if they exist do not update.
                        if (advisorBrBo.CheckInternalBranchAssociations(rmVo.RMId))
                        {
                            association = "internal";
                            blUpdate    = false;
                        }
                        else
                        {
                            rmVo.IsExternal = 1;
                        }
                    }
                    else
                    {
                        // Check for External Associations, if they exist do not update.
                        if (advisorBrBo.CheckExternalBranchAssociations(rmVo.RMId))
                        {
                            association = "external";
                            blUpdate    = false;
                        }
                        else
                        {
                            rmVo.IsExternal = 0;
                        }
                    }



                    //*************Role Association Creation and deletion************************

                    bool     RMBMRole      = false;
                    string[] RoleListArray = rmVo.RMRoleList.Split(new char[] { ',' });
                    foreach (ListItem Items in ChklistRMBM.Items)
                    {
                        if (Items.Text == "RM")
                        {
                            foreach (string Role in RoleListArray)
                            {
                                if (Role == "RM")
                                {
                                    RMBMRole = true;
                                }
                            }
                            // Create Role Association for RM
                            if (RMBMRole == true && Items.Selected == false)
                            {
                                userBo.DeleteRoleAssociation(rmVo.UserId, Int16.Parse(Items.Value.ToString()));
                            }
                            else if (RMBMRole == false && Items.Selected == true)
                            {
                                userBo.CreateRoleAssociation(rmVo.UserId, Int16.Parse(Items.Value.ToString()));
                            }
                            RMBMRole = false;
                        }
                        else if (Items.Text == "BM")
                        {
                            foreach (string Role in RoleListArray)
                            {
                                if (Role == "BM")
                                {
                                    RMBMRole = true;
                                }
                            }
                            // Create Role Association for BM
                            if (RMBMRole == false && Items.Selected == true)
                            {
                                userBo.CreateRoleAssociation(rmVo.UserId, Int16.Parse(Items.Value.ToString()));
                            }
                            else if (RMBMRole == true && Items.Selected == false)
                            {
                                branchHead = advisorBranchBo.CheckBranchHead(rmVo.RMId, 0);
                                if (branchHead == 0)
                                {
                                    userBo.DeleteRoleAssociation(rmVo.UserId, Int16.Parse(Items.Value.ToString()));
                                }
                                else
                                {
                                    ChklistRMBM.Items[1].Selected = true;
                                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('BM Role can not be removed as this staff is a Branch Head');", true);
                                }
                            }

                            RMBMRole = false;
                        }
                    }

                    //*************Role Association Creation and deletion************************

                    //Update the User details in the User Table
                    userBo.UpdateUser(userVo);
                    //Update the RM details in the AdvisorRM Table
                    advisorStaffBo.UpdateStaff(rmVo);



                    //**************Branch Association Creation and deletion*********************


                    //string hdnExistingString = hdnExistingBranches.Value.ToString();
                    string hdnSelectedString = hdnSelectedBranches.Value.ToString();
                    //string[] existingBranchesList = hdnExistingString.Split(',');
                    string[]  selectedBranchesList = hdnSelectedString.Split(',');
                    DataTable dtSelectedBranch     = new DataTable();
                    dtSelectedBranch.Columns.Add("Branch");
                    dtSelectedBranch.Columns.Add("BranchId");
                    DataTable  dtAssociated  = new DataTable();
                    List <int> deletedBRList = new List <int>();
                    List <int> addedBRList   = new List <int>();
                    dtAssociated = (DataTable)Session["AssociatedBranch"];
                    if (dtAssociated != null)
                    {
                        foreach (string str in selectedBranchesList)
                        {
                            if (str != "")
                            {
                                dtAssociated.DefaultView.Sort = "BranchId";
                                int i = dtAssociated.DefaultView.Find(str);
                                if (i == (0 - 1))
                                {
                                    addedBRList.Add(int.Parse(str));
                                }
                            }
                            DataRow dr = dtSelectedBranch.NewRow();
                            dr["Branch"]   = str;
                            dr["BranchId"] = str;
                            dtSelectedBranch.Rows.Add(dr);
                        }



                        foreach (DataRow dr in dtAssociated.Rows)
                        {
                            dtSelectedBranch.DefaultView.Sort = "BranchId";
                            int j = dtSelectedBranch.DefaultView.Find(dr["BranchId"].ToString());
                            if (j == (0 - 1))
                            {
                                if (dr["BranchId"].ToString() != "")
                                {
                                    deletedBRList.Add(int.Parse(dr["BranchId"].ToString()));
                                }
                            }
                        }

                        for (int i = 0; i < addedBRList.Count; i++)
                        {
                            advisorBranchBo.CreateRMBranchAssociation(rmVo.RMId, addedBRList[i], advisorVo.advisorId, advisorVo.advisorId);
                        }
                        for (int i = 0; i < deletedBRList.Count; i++)
                        {
                            bool IsBranchDependency = false;
                            IsBranchDependency = advisorBranchBo.CheckRMBranchDependency(rmVo.RMId, deletedBRList[i]);
                            if (IsBranchDependency == true)
                            {
                                branchDeletion = false;
                                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry... You need to delete your internal associations first');", true);
                            }
                            else
                            {
                                advisorBranchBo.DeleteBranchAssociation(rmVo.RMId, deletedBRList[i]);
                            }
                        }

                        if (branchDeletion == false)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRMDetails','none');", true);
                        }
                    }
                    else
                    {
                        foreach (string str in selectedBranchesList)
                        {
                            if (str != "")
                            {
                                advisorBranchBo.CreateRMBranchAssociation(rmVo.RMId, int.Parse(str), advisorVo.advisorId, advisorVo.advisorId);
                            }
                        }
                    }
                    //advisorBranchBo.DeleteRMBranchAssociation1(rmIDRef);

                    //**************Branch Association Creation and deletion*********************



                    if (blUpdate)
                    {
                        btnSave.Enabled = false;
                        if (Session["FromAdvisorView"] != null)
                        {
                            if (Session["FromAdvisorView"].ToString() == "FromAdvView")
                            {
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRM','none');", true);
                            }
                            else
                            {
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRMDetails','none');", true);
                            }
                            Session.Remove("FromAdvisorView");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRM','none');", true);
                        }
                    }
                    else
                    {
                        if (association == "internal")
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry... You need to delete your internal associations first');", true);
                        }
                        else if (association == "external")
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry... You need to delete your external associations first');", true);
                        }
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "EditRMDetails.ascx:btnSave_Click()");

                object[] objects = new object[6];

                objects[0] = advisorVo;
                objects[1] = userVo;
                objects[2] = userBo;
                objects[3] = userId;
                objects[4] = rmId;
                objects[5] = userVo2;


                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RMVo                   rmVo                   = new RMVo();
            AdvisorBranchBo        advisorBranchBo        = new AdvisorBranchBo();
            GeneralConfigurationVo generalconfigurationvo = new GeneralConfigurationVo();

            try
            {
                lblDate.Text = DateTime.Now.ToLongDateString();



                imgLeftPlaceHolder.Style.Add("display", "none");
                imgCenterPlaceholder.Style.Add("display", "none");
                imgRightPlaceholder.Style.Add("display", "none");
                if (Session[SessionContents.SAC_HostGeneralDetails] != null)
                {
                    generalconfigurationvo = (GeneralConfigurationVo)Session[SessionContents.SAC_HostGeneralDetails];


                    if (!IsPostBack)
                    {
                        if (!string.IsNullOrEmpty(generalconfigurationvo.HostLogoPlacement))
                        {
                            if (generalconfigurationvo.HostLogoPlacement == "TopLeftCorner")
                            {
                                imgLeftPlaceHolder.Style.Add("display", "block");
                                imgLeftPlaceHolder.Src = "Images/" + generalconfigurationvo.HostLogo;
                            }
                            else if (generalconfigurationvo.HostLogoPlacement == "TopRightCorner")
                            {
                                imgRightPlaceholder.Style.Add("display", "block");
                                imgRightPlaceholder.Src = "Images/" + generalconfigurationvo.HostLogo;
                            }
                            else if (generalconfigurationvo.HostLogoPlacement == "TopCenter")
                            {
                                imgCenterPlaceholder.Style.Add("display", "block");
                                imgCenterPlaceholder.Src = "Images/" + generalconfigurationvo.HostLogo;
                            }
                        }
                    }
                    if (Session["userVo"] != null)
                    {
                        userVo = (UserVo)(Session["userVo"]);
                        rmVo   = (RMVo)(Session[SessionContents.RmVo]);



                        lblUserName.Text      = "Welcome " + " " + userVo.FirstName + " " + userVo.LastName;
                        lblSignOut.Text       = "SignOut";
                        LinkButtonSignIn.Text = "";
                        if (Session[SessionContents.LogoPath] != null)
                        {
                            logoPath = (Session[SessionContents.LogoPath].ToString());
                        }
                        else
                        {
                            if (Session["advisorVo"] != null)
                            {
                                logoPath = "Images/" + ((AdvisorVo)Session["advisorVo"]).LogoPath;
                            }
                        }
                        if (Session[SessionContents.BranchLogoPath] != null)
                        {
                            branchLogoPath = (Session[SessionContents.BranchLogoPath].ToString());
                        }
                        else
                        {
                            if (rmVo != null)
                            {
                                branchLogoPath = "Images/" + (advisorBranchBo.GetBranch(advisorBranchBo.GetBranchId(rmVo.RMId))).LogoPath;
                            }
                        }

                        if (!IsPostBack)
                        {
                            if (!string.IsNullOrEmpty(generalconfigurationvo.AdviserLogoPlacement))
                            {
                                if (logoPath != "Images/" && logoPath != "")
                                {
                                    if (generalconfigurationvo.AdviserLogoPlacement == "TopLeftCorner")
                                    {
                                        imgLeftPlaceHolder.Style.Add("display", "block");
                                        imgLeftPlaceHolder.Src = logoPath;
                                    }
                                    else if (generalconfigurationvo.AdviserLogoPlacement == "TopRightCorner")
                                    {
                                        imgRightPlaceholder.Style.Add("display", "block");
                                        imgRightPlaceholder.Src = logoPath;
                                    }
                                    else if (generalconfigurationvo.AdviserLogoPlacement == "TopCenter")
                                    {
                                        imgCenterPlaceholder.Style.Add("display", "block");
                                        imgCenterPlaceholder.Src = logoPath;
                                    }
                                }
                            }



                            if (imgLeftPlaceHolder.Src != "" && imgRightPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgCenterPlaceholder.Style.Add("display", "block");
                                    imgCenterPlaceholder.Src = branchLogoPath;
                                }
                            }
                            else if (imgCenterPlaceholder.Src != "" && imgRightPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgLeftPlaceHolder.Style.Add("display", "block");
                                    imgLeftPlaceHolder.Src = branchLogoPath;
                                }
                            }
                            else if (imgLeftPlaceHolder.Src != "" && imgCenterPlaceholder.Src != "")
                            {
                                if (branchLogoPath != "Images/" && branchLogoPath != "")
                                {
                                    imgRightPlaceholder.Style.Add("display", "block");
                                    imgRightPlaceholder.Src = branchLogoPath;
                                }
                            }
                        }
                        //if (logoPath != "Images/")
                        //{
                        //    AdvisorLogo.Src = logoPath;
                        //}
                        //if (branchLogoPath != "Images/")
                        //{
                        //    BranchLogo.Src = branchLogoPath;



                        //}

                        CustomerVo customerVo = new CustomerVo();
                        customerVo = (CustomerVo)(Session["CustomerVo"]);
                    }
                    else
                    {
                        if (!IsPostBack)
                        {
                            if (Request.QueryString["UserId"] != null)
                            {
                                string userId = Request.QueryString["UserId"].ToString();
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','" + userId + "','');", true);
                            }
                            else
                            {
                                Page.ClientScript.RegisterStartupScript(this.GetType(), "pageloadscript", "loginloadcontrolfromDefault('Userlogin','','');", true);
                            }
                        }
                    }
                }

                //if (AdvisorLogo.Src == "")
                //{
                //    AdvisorLogo.Style.Add("display", "none");
                //}

                //if (BranchLogo.Src == "")
                //{
                //    BranchLogo.Style.Add("display", "none");
                //}
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "Default.aspx:PageLoad()");

                object[] objects = new object[1];
                objects[0] = userVo;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void DeleteBranchAssociation()
        {
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            bool            result          = false;
            int             rmId            = 0;
            int             branchId        = 0;
            int             count           = 0;
            string          asscNotDeleted  = string.Empty;

            try
            {
                foreach (GridViewRow dr in gvBranchList.Rows)
                {
                    CheckBox checkBox = (CheckBox)dr.FindControl("chkBx");
                    rmId     = Convert.ToInt32(gvBranchList.DataKeys[dr.RowIndex].Values["RMId"].ToString());
                    branchId = Convert.ToInt32(gvBranchList.DataKeys[dr.RowIndex].Values["BranchId"].ToString());
                    Label lblRMName     = (Label)dr.FindControl("lblRMName");
                    Label lblBranchName = (Label)dr.FindControl("lblBranchName");


                    if (checkBox.Checked)
                    {
                        count = advisorBranchBo.CheckBranchHead(rmId, branchId);
                        if (count > 0)
                        {
                            asscNotDeleted = asscNotDeleted + lblBranchName.Text + " - " + lblRMName.Text + "\\n";
                        }
                        else
                        {
                            rmId     = Convert.ToInt32(gvBranchList.DataKeys[dr.RowIndex].Values["RMId"].ToString());
                            branchId = Convert.ToInt32(gvBranchList.DataKeys[dr.RowIndex].Values["BranchId"].ToString());
                            result   = advisorBranchBo.DeleteBranchAssociation(rmId, branchId);
                        }
                    }
                }
                if (asscNotDeleted.Length == 0)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Removed Successfully..');", true);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('" + asscNotDeleted + "\\n \\n Above associations cannot be deleted as the RM is the Branch head of that Branch');", true);
                }


                mypager.CurrentPage = int.Parse(hdnCurrentPage.Value.ToString());

                LoadBranchAssociation(mypager.CurrentPage);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewBranchAssociation.ascx.cs:btnDeleteSelected_Click()");
                object[] objects = new object[3];
                objects[0]   = rmId;
                objects[1]   = branchId;
                objects[2]   = result;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void bindChart(int advisorBranchId, int branchHeadId, int all)
        {
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            CustomerVo      customerVo      = new CustomerVo();
            CustomerBo      customerBo      = new CustomerBo();
            Legend          Branchlegend    = null;

            Branchlegend         = new Legend("BranchAssetsLegends");
            Branchlegend.Enabled = true;
            string[]  XValues = null;
            decimal[] YValues = null;
            DataRow   drChAssets;
            DataRow   drChvalues;
            Series    seriesBranchAssets = null;

            seriesBranchAssets = new Series("seriesBranchAssets");
            double DAssetvalue = 0;
            int    j           = 0;

            if (branchAumDT.Rows.Count > 0)
            {
                lblChartBranchAUM.Visible = true;
                ErrorMessage.Visible      = false;
                drChvalues = branchAumDT.Rows[0];
                for (int i = 0; i < branchAumDT.Columns.Count - 1; i++)
                {
                    drChAssets = branchAumDT.NewRow();

                    branchAumDT.Rows.Add(drChAssets);
                    if (DAssetvalue == 0)
                    {
                        j = j + 1;
                    }
                }
                if (j != branchAumDT.Columns.Count)
                {
                    seriesBranchAssets.ChartType = SeriesChartType.Pie;
                    //seriesBranchAssets1.Palette = ChartColorPalette.Chocolate;
                    //seriesBranchAssets.Palette = ChartColorPalette.Chocolate;

                    XValues = new string[10];
                    YValues = new decimal[10];
                    ChartBranchAssets.Series.Clear();
                    ChartBranchAssets.DataSource = branchAumDT;
                    //branchAumDT.DefaultView.Sort = "CurrentValue";
                    ChartBranchAssets.Series.Clear();
                    ChartBranchAssets.Series.Add(seriesBranchAssets);
                    ChartBranchAssets.Series[0].XValueMember  = "Asset";
                    ChartBranchAssets.Series[0].XValueType    = ChartValueType.String;
                    ChartBranchAssets.Series[0].YValueMembers = "CurrentValue";
                    ChartBranchAssets.Series["seriesBranchAssets"].IsValueShownAsLabel = true;
                    ChartBranchAssets.ChartAreas[0].AxisX.Title = "Assets";
                    ChartBranchAssets.Series[0].XValueMember    = "Asset";
                    ChartBranchAssets.DataManipulator.Sort(PointSortOrder.Descending, "Y", seriesBranchAssets);
                    ChartBranchAssets.Legends.Add(Branchlegend);
                    ChartBranchAssets.Legends["BranchAssetsLegends"].Title               = "Assets";
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleAlignment      = StringAlignment.Center;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparator      = LegendSeparatorStyle.None;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].Alignment           = StringAlignment.Center;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparator      = LegendSeparatorStyle.GradientLine;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparatorColor = Color.Black;


                    ChartBranchAssets.Series[0]["PieLabelStyle"] = "Outside";
                    ChartBranchAssets.Series[0]["PieStartAngle"] = "10";
                    ChartArea chartArea1 = ChartBranchAssets.ChartAreas[0];
                    chartArea1.Area3DStyle.IsClustered      = true;
                    chartArea1.Area3DStyle.Enable3D         = true;
                    chartArea1.Area3DStyle.Perspective      = 10;
                    chartArea1.Area3DStyle.PointGapDepth    = 900;
                    chartArea1.Area3DStyle.IsRightAngleAxes = false;
                    chartArea1.Area3DStyle.WallWidth        = 25;
                    chartArea1.Area3DStyle.Rotation         = 65;
                    chartArea1.Area3DStyle.Inclination      = 35;
                    chartArea1.BackColor          = System.Drawing.Color.Transparent;
                    chartArea1.BackSecondaryColor = System.Drawing.Color.Transparent;
                    chartArea1.Position.Auto      = true;
                    LegendCellColumn colorColumn = new LegendCellColumn();
                    colorColumn.ColumnType      = LegendCellColumnType.SeriesSymbol;
                    colorColumn.HeaderBackColor = Color.WhiteSmoke;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].CellColumns.Add(colorColumn);
                    ChartBranchAssets.Legends["BranchAssetsLegends"].BackColor = Color.FloralWhite;
                    LegendCellColumn totalColumn = new LegendCellColumn();
                    totalColumn.Alignment = ContentAlignment.MiddleLeft;

                    totalColumn.Text            = "#VALX: #PERCENT";
                    totalColumn.Name            = "AssetsColumn";
                    totalColumn.HeaderBackColor = Color.WhiteSmoke;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].CellColumns.Add(totalColumn);
                    ChartBranchAssets.Series[0]["PieLabelStyle"]         = "Disabled";
                    ChartBranchAssets.Series[0].ToolTip                  = "#VALX: #PERCENT";
                    ChartBranchAssets.ChartAreas[0].AxisX.Interval       = 1;
                    ChartBranchAssets.ChartAreas[0].AxisY.Title          = "Total Assets";
                    ChartBranchAssets.ChartAreas[0].Area3DStyle.Enable3D = true;
                    ChartBranchAssets.DataBind();
                }
            }
            else
            {
                lblChartBranchAUM.Visible    = false;
                ErrorMessage.Visible         = true;
                ChartBranchAssets.DataSource = null;
                ChartBranchAssets.Visible    = false;
            }


            /* For Chart 2 */

            if (topFiveRMDT.Rows.Count > 0)
            {
                lblTop5Rms.Visible = true;
                DataRow drRMCustomersNet;
                DataRow drRMCustomersNetResults;


                Series seriesRMCustNetworth = null;
                seriesRMCustNetworth = new Series("seriesRMCustNetworth");

                Series seriesRMCustNetworth1 = null;
                seriesRMCustNetworth1 = new Series("seriesRMCustNetworth");

                Legend RMCustNetLegend = null;
                Branchlegend = new Legend("legendsTopfiveRM");

                seriesRMCustNetworth    = new Series("CustomerNetworth");
                RMCustNetLegend         = new Legend("CustomerNetworthLegends");
                RMCustNetLegend.Enabled = true;
                XValues          = new string[10];
                YValues          = new decimal[10];
                drRMCustomersNet = topFiveRMDT.Rows[0];
                CharttopfiveRMCustNetworth.Series.Clear();
                CharttopfiveRMCustNetworth.Series.Add(seriesRMCustNetworth);
                CharttopfiveRMCustNetworth.DataSource = topFiveRMDT.DefaultView;
                topFiveRMDT.Columns.Add("RM Name");
                for (int i = 0; i < topFiveRMDT.Rows.Count; i++)
                {
                    drRMCustomersNet        = topFiveRMDT.NewRow();
                    drRMCustomersNetResults = topFiveRMDT.Rows[i];

                    j = j + 1;
                }
                if (j != topFiveRMDT.Rows.Count)
                {
                    seriesRMCustNetworth.ChartType = SeriesChartType.Bar;
                    //CharttopfiveRMCustNetworth.Titles.Add("Top 5 RMs (Customer Base)");


                    CharttopfiveRMCustNetworth.Series.Clear();
                    CharttopfiveRMCustNetworth.Series.Add(seriesRMCustNetworth);
                    CharttopfiveRMCustNetworth.Series[0].XValueMember = "RmName";
                    CharttopfiveRMCustNetworth.Series[0].XValueType   = ChartValueType.String;

                    CharttopfiveRMCustNetworth.Series[0].YValueMembers = "Customer_networth";


                    CharttopfiveRMCustNetworth.Series["CustomerNetworth"].IsValueShownAsLabel = true;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.Title             = "RM Name";
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;

                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.Interval       = 1;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisY.Title          = "Customer NetWorth";
                    CharttopfiveRMCustNetworth.ChartAreas[0].Area3DStyle.Enable3D = true;

                    //CharttopfiveRMCustNetworth.Legends.Add(Branchlegend);
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].Title = "Assets";
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleAlignment = StringAlignment.Center;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleSeparator = LegendSeparatorStyle.None;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].Alignment = StringAlignment.Center;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleSeparatorColor = Color.Black;

                    ChartArea custArea = ChartBranchAssets.ChartAreas[0];
                    custArea.Area3DStyle.Perspective      = 10;
                    custArea.Area3DStyle.PointGapDepth    = 900;
                    custArea.Area3DStyle.IsRightAngleAxes = false;
                    custArea.Area3DStyle.WallWidth        = 25;
                    custArea.Area3DStyle.Rotation         = 85;
                    custArea.Area3DStyle.Inclination      = 35;

                    seriesRMCustNetworth.Palette = ChartColorPalette.Chocolate;
                    //seriesRMCustNetworth1.Palette = ChartColorPalette.Fire;


                    //seriesRMCustNetworth.Palette = ChartColorPalette.Pastel;
                    //seriesRMCustNetworth1.Palette = ChartColorPalette.Fire;
                    CharttopfiveRMCustNetworth.DataBind();
                }
            }
            else
            {
                lblTop5Rms.Visible = false;
                CharttopfiveRMCustNetworth.DataSource = null;
                CharttopfiveRMCustNetworth.Visible    = false;
            }
            /* *********** */


            /* For Chart 3 */

            if (topFiveCustomerDT.Rows.Count > 0)
            {
                chartCustNetworth.Visible = true;
                DataRow drNetworth;
                DataRow drNetworthResult;

                Series seriesCustNetworth = null;
                seriesCustNetworth = new Series("seriesCustNetworth");

                Series seriesCustNetworth1 = null;
                seriesCustNetworth1 = new Series("seriesCustNetworth");

                Legend CustNetLegend = null;
                Branchlegend = new Legend("legendCustomeAsset");

                seriesCustNetworth    = new Series("CustomerNetworth");
                CustNetLegend         = new Legend("CustomerNetworthLegends");
                CustNetLegend.Enabled = true;
                XValues    = new string[10];
                YValues    = new decimal[10];
                drNetworth = topFiveCustomerDT.Rows[0];
                ChartCustomerNetworth.Series.Clear();
                ChartCustomerNetworth.Series.Add(seriesCustNetworth);
                ChartCustomerNetworth.DataSource = topFiveCustomerDT.DefaultView;
                topFiveCustomerDT.Columns.Add("Customer Name");
                for (int i = 0; i < topFiveCustomerDT.Rows.Count; i++)
                {
                    drNetworth       = topFiveCustomerDT.NewRow();
                    drNetworthResult = topFiveCustomerDT.Rows[i];

                    j = j + 1;
                }
                if (j != topFiveCustomerDT.Rows.Count)
                {
                    seriesCustNetworth.ChartType = SeriesChartType.Bar;

                    ChartCustomerNetworth.Series.Clear();
                    ChartCustomerNetworth.Series.Add(seriesCustNetworth);
                    ChartCustomerNetworth.Series[0].XValueMember  = "Customer";
                    ChartCustomerNetworth.Series[0].XValueType    = ChartValueType.String;
                    ChartCustomerNetworth.Series[0].YValueMembers = "Networth";



                    ChartCustomerNetworth.Series["CustomerNetworth"].IsValueShownAsLabel = true;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.Title = "Customer Name";

                    ChartCustomerNetworth.ChartAreas[0].AxisY.LabelAutoFitStyle       = LabelAutoFitStyles.LabelsAngleStep90;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.Interval                = 1;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.LabelAutoFitStyle       = LabelAutoFitStyles.WordWrap;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.LabelAutoFitMaxFontSize = 5;
                    ChartCustomerNetworth.ChartAreas[0].AxisY.Title          = "Customer NetWorth";
                    ChartCustomerNetworth.ChartAreas[0].Area3DStyle.Enable3D = true;

                    ChartArea custArea = ChartBranchAssets.ChartAreas[0];
                    custArea.Area3DStyle.Perspective      = 10;
                    custArea.Area3DStyle.PointGapDepth    = 900;
                    custArea.Area3DStyle.IsRightAngleAxes = false;
                    custArea.Area3DStyle.WallWidth        = 25;
                    custArea.Area3DStyle.Rotation         = 65;
                    custArea.Area3DStyle.Inclination      = 35;
                    //seriesCustNetworth.Palette = ChartColorPalette.Pastel;
                    seriesCustNetworth.Palette = ChartColorPalette.Chocolate;
                    ChartCustomerNetworth.DataBind();
                }
            }
            else
            {
                chartCustNetworth.Visible        = false;
                ChartCustomerNetworth.DataSource = null;
                ChartCustomerNetworth.Visible    = false;
            }
            /* *********** */
        }
示例#28
0
        private void CreateMainBranch()
        {
            AdvisorBranchVo branchVo        = new AdvisorBranchVo();
            AdvisorBranchBo adviserBranchBo = new AdvisorBranchBo();
            List <int>      adviserIds      = new List <int>();

            adviserIds              = (List <int>)Session["IDs"];
            branchVo.AddressLine1   = txtAddressLine1.Text;
            branchVo.BranchHeadId   = adviserIds[2];
            branchVo.BranchName     = txtOrganizationName.Text;
            branchVo.City           = txtCity.Text;
            branchVo.Country        = ddlCountry.SelectedItem.Value.ToString();
            branchVo.Email          = txtEmail.Text;
            branchVo.BranchTypeCode = 1;
            if (txtPinCode.Text == "")
            {
                branchVo.PinCode = 0;
            }
            else
            {
                branchVo.PinCode = int.Parse(txtPinCode.Text.ToString());
            }
            if (ddlState.SelectedIndex != 0)
            {
                branchVo.State = ddlState.SelectedItem.Value.ToString();
            }
            else
            {
                branchVo.State = null;
            }
            if (txtFaxNumber.Text == "")
            {
                branchVo.Fax = 0;
            }
            else
            {
                branchVo.Fax = int.Parse(txtFaxNumber.Text.ToString());
            }
            if (txtFaxISD.Text == "")
            {
                branchVo.FaxIsd = 0;
            }
            else
            {
                branchVo.FaxIsd = int.Parse(txtFaxISD.Text.ToString());
            }
            if (txtFaxSTD.Text == "")
            {
                branchVo.FaxStd = 0;
            }
            else
            {
                branchVo.FaxStd = int.Parse(txtFaxSTD.Text.ToString());
            }
            if (txtMobileNumber.Text == "")
            {
                branchVo.MobileNumber = 0;
            }
            else
            {
                branchVo.MobileNumber = Convert.ToInt64(txtMobileNumber.Text.ToString());
            }
            if (txtISD1.Text == "")
            {
                branchVo.Phone1Isd = 0;
            }
            else
            {
                branchVo.Phone1Isd = int.Parse(txtISD1.Text.ToString());
            }
            if (txtISD2.Text == "")
            {
                branchVo.Phone2Isd = 0;
            }
            else
            {
                branchVo.Phone2Isd = int.Parse(txtISD2.Text.ToString());
            }
            if (txtPhoneNumber1.Text == "")
            {
                branchVo.Phone1Number = 0;
            }
            else
            {
                branchVo.Phone1Number = int.Parse(txtPhoneNumber1.Text.ToString());
            }
            if (txtPhoneNumber2.Text == "")
            {
                branchVo.Phone2Number = 0;
            }
            else
            {
                branchVo.Phone2Number = int.Parse(txtPhoneNumber2.Text.ToString());
            }
            if (txtSTD1.Text == "")
            {
                branchVo.Phone1Std = 0;
            }
            else
            {
                branchVo.Phone1Std = int.Parse(txtSTD1.Text);
            }
            if (txtSTD2.Text == "")
            {
                branchVo.Phone2Std = 0;
            }
            else
            {
                branchVo.Phone2Std = int.Parse(txtSTD2.Text);
            }
            branchVo.IsHeadBranch = 1;
            branchVo.BranchId     = adviserBranchBo.CreateAdvisorBranch(branchVo, adviserIds[1], adviserIds[0]);
            adviserBranchBo.AssociateBranch(adviserIds[2], branchVo.BranchId, 1, adviserIds[0]);
        }