protected void Page_Load(object sender, EventArgs e)
        {
            advisorVo = (AdvisorVo)Session["advisorVo"];
            userVo    = (UserVo)Session["userVo"];
            associateuserheirarchyVo = (AssociatesUserHeirarchyVo)Session[SessionContents.AssociatesLogin_AssociatesHierarchy];
            associatesVo             = (AssociatesVO)Session["associatesVo"];
            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops")
            {
                userType = "advisor";
            }
            else if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "associates")
            {
                userType = "associates";
            }
            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops")
            {
                if (Request.QueryString["AgentCode"] != null)
                {
                    Agentcode = Request.QueryString["AgentCode"].ToString();
                }
                else
                {
                    Agentcode = string.Empty;
                }
            }
            else
            {
                Agentcode = associateuserheirarchyVo.AgentCode;
            }

            //  Agentcode = associateuserheirarchyVo.AgentCode;

            BindAgentCodeList();
        }
        public List <int> CreateCompleteAssociates(UserVo userVo, AssociatesVO associatesVo, int userId)
        {
            List <int> associatesIds = new List <int>();

            try
            {
                associatesIds = associatesDao.CreateCompleteAssociates(userVo, associatesVo, userId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "AdvisorStaffBo.cs:CreateAssociates()");


                object[] objects = new object[3];
                objects[0] = associatesVo;
                objects[1] = userVo;
                objects[2] = userId;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(associatesIds);
        }
        public bool EditAddChildAgentCodeList(AssociatesVO associatesVo, string ChildCode, int PagentId, char flag, string childName, string childEmailId, int userId, string roleIds)
        {
            bool result = false;;

            result = associatesDao.EditAddChildAgentCodeList(associatesVo, ChildCode, PagentId, flag, childName, childEmailId, userId, roleIds);
            return(result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            advisorVo = (AdvisorVo)Session["advisorVo"];
            userVo    = (UserVo)Session["UserVo"];
            rmVo      = (RMVo)Session["RMVo"];
            string userType = string.Empty;

            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops")
            {
                userType = "admin";
            }
            else
            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "associates")
            {
                userType = "associates";
            }
            //int rmId=0;
            associatesVo       = (AssociatesVO)Session["associatesVo"];
            HdnAdviserId.Value = advisorVo.advisorId.ToString();
            string action = string.Empty;

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["RmId"] != null)
                {
                    hidRMid.Value = Request.QueryString["RmId"];
                    action        = Request.QueryString["action"].ToString();
                }
                BindTeamDropList();
                BinddepartDropList(advisorVo.advisorId);
                BindBranchDropList(userType);
                BindStaffBranchDrop(userType);
                if (!string.IsNullOrEmpty(hidRMid.Value.ToString()) && !string.IsNullOrEmpty(action))
                {
                    ShowRMDetails(Convert.ToInt32(hidRMid.Value));
                    PnlDepartRole.Visible = true;
                    if (action == "View")
                    {
                        ControlViewEditMode(true);
                    }
                    else if (action == "Edit")
                    {
                        ControlViewEditMode(false);
                    }
                }
                else
                {
                    ControlInitialState();
                }
            }

            if (userVo.UserType != "Advisor")
            {
                lnkEditStaff.Visible = false;
            }
        }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     {
         SessionBo.CheckSession();
         advisorPrefernceVo = (AdvisorPreferenceVo)Session["AdvisorPreferenceVo"];
         rmVo         = (RMVo)Session["rmVo"];
         adviserVo    = (AdvisorVo)Session["advisorVo"];
         associatesVo = (AssociatesVO)Session["associatesVo"];
     }
 }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            userVo             = (UserVo)Session["userVo"];
            advisorPrefernceVo = (AdvisorPreferenceVo)Session["AdvisorPreferenceVo"];
            //CreationSuccessMessage.Visible = false;
            rmVo         = (RMVo)Session["rmVo"];
            adviserVo    = (AdvisorVo)Session["advisorVo"];
            associatesVo = (AssociatesVO)Session["associatesVo"];

            string userType     = userVo.UserType.ToLower();
            string currUserRole = Session[SessionContents.CurrentUserRole].ToString().ToLower();

            if (userType == "SuperAdmin")
            {
                this.UserRole = "advisor";
                adviserId     = 1000;
            }
            else
            {
                switch (currUserRole)
                {
                case "admin":
                case "ops":
                case "research":
                    this.UserRole = "advisor";
                    break;

                case "associates":
                    this.UserRole = currUserRole;
                    break;
                }
                rmId         = rmVo.RMId;
                branchHeadId = rmVo.RMId;
                adviserId    = adviserVo.advisorId;
            }
            if (currUserRole == "associates")
            {
                assocUsrHeirVo = (AssociatesUserHeirarchyVo)Session[SessionContents.AssociatesLogin_AssociatesHierarchy];
                agentCode      = assocUsrHeirVo.AgentCode;
            }
            if (!IsPostBack)
            {
                BindCustomerGrid();
                gvAssocCustList.Visible = true;
                if (userType == "SuperAdmin")
                {
                    gvAssocCustList.Visible = false;
                }
            }
        }
        public bool AddAgentChildCode(AssociatesVO associatesVo, string code)
        {
            bool bResult = false;

            try
            {
                bResult = associatesDao.AddAgentChildCode(associatesVo, code);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(bResult);
        }
        public bool CreateAdviserAgentCode(AssociatesVO associatesVo, int agentId, int adviserId)
        {
            bool result = false;

            try
            {
                result = associatesDao.CreateAdviserAgentCode(associatesVo, agentId, adviserId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(result);
        }
        public bool UpdateAssociateDetails(AssociatesVO associatesVo, int userId, int associateid, int agentcode)
        {
            bool bResult = false;

            try
            {
                bResult = associatesDao.UpdateAssociateDetails(associatesVo, userId, associateid, agentcode);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(bResult);
        }
        public AssociatesVO GetAssociateVoList(int assiciateId)
        {
            AssociatesVO associatesVo = new AssociatesVO();

            try
            {
                associatesVo = associatesDao.GetAssociateVoList(assiciateId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(associatesVo);
        }
        public AssociatesVO GetAssociateUser(int UserId)
        {
            AssociatesVO associatesVo = new AssociatesVO();

            try
            {
                associatesVo = associatesDao.GetAssociateUser(UserId);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(associatesVo);
        }
        public bool UpdateAdviserAssociates(AssociatesVO associatesVo, int associateId, int userId, string command)
        {
            bool bResult = false;

            try
            {
                bResult = associatesDao.UpdateAdviserAssociates(associatesVo, associateId, userId, command);
            }
            catch (BaseApplicationException Ex)
            {
                throw (Ex);
            }
            return(bResult);
        }
示例#13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionBo.CheckSession();
     userVo             = (UserVo)Session["userVo"];
     advisorPrefernceVo = (AdvisorPreferenceVo)Session["AdvisorPreferenceVo"];
     rmVo               = (RMVo)Session["rmVo"];
     advisorVo          = (AdvisorVo)Session["advisorVo"];
     associatesVo       = (AssociatesVO)Session["associatesVo"];
     assocUsrHeirVo     = (AssociatesUserHeirarchyVo)Session["associatesUserHeirarchyVo"];
     trNewOrder.Visible = false;
     BindBank();
     if (!Page.IsPostBack)
     {
         if (Request.QueryString["IsAdd"] != null)
         {
             if (Request.QueryString["IsAdd"].ToString() == "1")
             {
                 dvAddMandate.Visible = true;
                 if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops" || userVo.AdviserRole.ContainsValue("CNT"))
                 {
                     txtClientCode_autoCompleteExtender.ContextKey    = advisorVo.advisorId.ToString();
                     txtClientCode_autoCompleteExtender.ServiceMethod = "GetCustCode";
                 }
                 else if (Session[SessionContents.CurrentUserRole].ToString() == "BM")
                 {
                     txtClientCode_autoCompleteExtender.ContextKey    = advisorVo.advisorId.ToString();
                     txtClientCode_autoCompleteExtender.ServiceMethod = "GetCustCode";
                 }
                 else if (Session[SessionContents.CurrentUserRole].ToString() == "RM")
                 {
                     txtClientCode_autoCompleteExtender.ContextKey    = advisorVo.advisorId.ToString();
                     txtClientCode_autoCompleteExtender.ServiceMethod = "GetCustCode";
                 }
                 else if (Session[SessionContents.CurrentUserRole].ToString() == "Associates")
                 {
                     txtClientCode_autoCompleteExtender.ContextKey    = advisorVo.advisorId.ToString();
                     txtClientCode_autoCompleteExtender.ServiceMethod = "GetCustCode";
                 }
             }
             else
             {
                 dvViewMandateMis.Visible = true;
                 BindMandateddetailsDetailsGrid(advisorVo.advisorId);
             }
         }
     }
 }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            advisorVo    = (AdvisorVo)Session["advisorVo"];
            userType     = Session[SessionContents.CurrentUserRole].ToString();
            associatesVo = (AssociatesVO)Session["associatesVo"];
            userVo       = (UserVo)Session["userVo"];

            if (!IsPostBack)
            {
                if (Request.QueryString["IsRecevableReport"] != null)
                {
                    dvReceivable.Visible       = false;
                    dvAssocicateReport.Visible = false;

                    if (Request.QueryString["IsRecevableReport"].ToString() == "1")
                    {
                        dvReceivable.Visible = true;
                        BindMutualFundDropDowns();

                        LoadAllSchemeList(0);
                        BindProductDropdown();
                        BindMonthsAndYear();
                    }
                    else
                    {
                        dvAssocicateReport.Visible = true;
                        if (Session["UserType"] == "Associates")
                        {
                            associateuserheirarchyVo = (AssociatesUserHeirarchyVo)Session[SessionContents.AssociatesLogin_AssociatesHierarchy];
                            if (associateuserheirarchyVo != null && associateuserheirarchyVo.AgentCode != null)
                            {
                                AgentCode         = associateuserheirarchyVo.AgentCode.ToString();
                                txtAgentCode.Text = AgentCode;
                            }
                            HideFieldsBasedOnUser();
                        }
                    }
                }
            }
        }
示例#15
0
        protected void gvChildCode_ItemCommand(object source, GridCommandEventArgs e)
        {
            int          PagentId     = 0;
            int          childAgentId = 0;
            string       ChildCode    = string.Empty;
            string       childName    = string.Empty;
            string       childEmailId = string.Empty;
            string       roleIds      = string.Empty;
            AssociatesVO associatesVo = new AssociatesVO();

            if (Session["PagentId"] != null)
            {
                PagentId = (int)Session["PagentId"];
            }

            associatesVo.AAC_UserType   = "Associates";
            associatesVo.AAC_CreatedBy  = userVo.UserId;
            associatesVo.AAC_ModifiedBy = userVo.UserId;
            BindAdviserrole();
            if (e.CommandName == RadGrid.UpdateCommandName)
            {
                //strExternalCodeToBeEdited = Session["extCodeTobeEdited"].ToString();
                associatesVo.AAC_AdviserAgentId = int.Parse(gvChildCode.MasterTableView.DataKeyValues[e.Item.ItemIndex]["AAC_AdviserAgentId"].ToString());
                int              userId           = int.Parse(gvChildCode.MasterTableView.DataKeyValues[e.Item.ItemIndex]["U_UserId"].ToString());
                AdvisorBo        advisorBo        = new AdvisorBo();
                bool             isUpdated        = false;
                GridEditableItem gridEditableItem = (GridEditableItem)e.Item;
                TextBox          txtChildCode     = (TextBox)e.Item.FindControl("txtChildCode");
                TextBox          txtChildName     = (TextBox)e.Item.FindControl("txtChildName");
                TextBox          txtChildEmailId  = (TextBox)e.Item.FindControl("txtChildEmailId");
                RadListBox       chkbldepart      = (RadListBox)e.Item.FindControl("chkbldepart");
                ChildCode    = txtChildCode.Text;
                childName    = txtChildName.Text;
                childEmailId = txtChildEmailId.Text;

                foreach (RadListBoxItem items in chkbldepart.Items)
                {
                    if (items.Checked == true)
                    {
                        roleIds = roleIds + items.Value.ToString() + ",";
                    }
                }
                if (!string.IsNullOrEmpty(roleIds))
                {
                    roleIds = roleIds.Remove(roleIds.Length - 1);
                }
                isUpdated = associatesBo.EditAddChildAgentCodeList(associatesVo, ChildCode, PagentId, 'U', childName, childEmailId, userId, roleIds);
            }
            if (e.CommandName == RadGrid.DeleteCommandName)
            {
                bool         isDeleted = false;
                GridDataItem dataItem  = (GridDataItem)e.Item;
                //TableCell strChildCodeForDelete = dataItem["AAC_AdviserAgentId"];
                childAgentId = int.Parse(gvChildCode.MasterTableView.DataKeyValues[e.Item.ItemIndex]["AAC_AdviserAgentId"].ToString());
                isDeleted    = associatesBo.DeleteChildAgentCode(childAgentId);
                if (isDeleted)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pageloadscript", "alert('Record has been deleted successfully !!');", true);
                }
            }
            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                bool             isInserted       = false;
                GridEditableItem gridEditableItem = (GridEditableItem)e.Item;
                TextBox          txtChildCode     = (TextBox)e.Item.FindControl("txtChildCode");
                TextBox          txtChildName     = (TextBox)e.Item.FindControl("txtChildName");
                TextBox          txtChildEmailId  = (TextBox)e.Item.FindControl("txtChildEmailId");
                RadListBox       chkbldepart      = (RadListBox)e.Item.FindControl("chkbldepart");
                ChildCode    = txtChildCode.Text;
                childName    = txtChildName.Text;
                childEmailId = txtChildEmailId.Text;

                foreach (RadListBoxItem items in chkbldepart.Items)
                {
                    if (items.Checked == true)
                    {
                        roleIds = roleIds + items.Value.ToString() + ",";
                    }
                }
                if (!string.IsNullOrEmpty(roleIds))
                {
                    roleIds = roleIds.Remove(roleIds.Length - 1);
                }
                if (Validation(ChildCode))
                {
                    isInserted = associatesBo.EditAddChildAgentCodeList(associatesVo, ChildCode, PagentId, 'I', childName, childEmailId, 0, roleIds);
                }
            }
            BindChildCodeGrid(PagentId);
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            advisorVo = (AdvisorVo)Session["advisorVo"];
            rmVo      = (RMVo)Session[SessionContents.RmVo];
            userVo    = (UserVo)Session["userVo"];
            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin")
            {
                userType = "advisor";
            }
            associatesVo = (AssociatesVO)Session["associatesVo"];
            if (!IsPostBack)
            {
                lblPanDuplicate.Visible = false;
                BindAgentList();
                if (Request.QueryString["rmId"] != null)
                {
                    ddlUserType.SelectedValue = "RM";
                    BindRMDropDown();
                    ddlSelectType.SelectedValue = Request.QueryString["rmId"];
                    ddlUserType.Enabled         = false;
                    ddlSelectType.Enabled       = false;
                }
                if (Request.QueryString["AssociationId"] != null)
                {
                    associationId               = int.Parse(Request.QueryString["AssociationId"]);
                    ddlUserType.Enabled         = false;
                    ddlSelectType.Enabled       = false;
                    ddlUserType.SelectedValue   = "Associates";
                    ddlSelectType.SelectedValue = associationId.ToString();
                }

                if (Request.QueryString["StaffRole"] != null)
                {
                    ddlUserType.Text = Request.QueryString["StaffRole"].ToString();
                    ddlUserType_SelectedIndexChanged(this, null);
                }
                if (Request.QueryString["StaffName"] != null)
                {
                    if (ddlSelectType.Items.FindByText(Request.QueryString["StaffName"].ToString()) != null)
                    {
                        ddlSelectType.Items.FindByText(Request.QueryString["StaffName"].ToString()).Selected = true;
                    }
                    else
                    {
                        ddlSelectType.Text = "Select";
                    }
                }
                if (Request.QueryString["BranchRole"] != null)
                {
                    ddlUserType.Text = Request.QueryString["BranchRole"].ToString();
                    ddlUserType_SelectedIndexChanged(this, null);
                }
                if (Request.QueryString["BranchName"] != null)
                {
                    if (ddlSelectType.Items.FindByText(Request.QueryString["BranchName"].ToString()) != null)
                    {
                        ddlSelectType.Items.FindByText(Request.QueryString["BranchName"].ToString()).Selected = true;
                    }
                    else
                    {
                        ddlSelectType.Text = "Select";
                    }
                }
                if (Request.QueryString["AgentCode"] != null)
                {
                    txtAgentCode.Text = Request.QueryString["AgentCode"].ToString();
                    if (Request.QueryString["Flag"] != null)
                    {
                        checkUser();
                        RadTabStrip1.Visible = true;
                        getChildCodes();
                    }
                }
            }
        }
示例#17
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            AssociatesVO associatesVo = new AssociatesVO();

            lblPanDuplicate.Visible = false;
            bool result = false;

            if (Request.QueryString["AgentId"] != null)
            {
                agentId = int.Parse(Request.QueryString["AgentId"]);
                associatesVo.AAC_AdviserAgentId = agentId;
            }
            if (ddlUserType.SelectedIndex != 0)
            {
                if (ddlUserType.SelectedValue == "BM")
                {
                    if (ddlSelectType.SelectedIndex != 0)
                    {
                        associatesVo.BranchId     = int.Parse(ddlSelectType.SelectedValue);
                        associatesVo.AAC_UserType = ddlUserType.SelectedValue;
                    }
                }
                else if (ddlUserType.SelectedValue == "RM")
                {
                    if (ddlSelectType.SelectedIndex != 0)
                    {
                        associatesVo.RMId         = int.Parse(ddlSelectType.SelectedValue);
                        associatesVo.AAC_UserType = ddlUserType.SelectedValue;
                    }
                }
                else if (ddlUserType.SelectedValue == "Associates")
                {
                    if (ddlSelectType.SelectedIndex != 0)
                    {
                        associatesVo.AdviserAssociateId = int.Parse(ddlSelectType.SelectedValue);
                        associatesVo.ContactPersonName  = ddlSelectType.SelectedItem.Text;
                        associatesVo.AAC_UserType       = ddlUserType.SelectedValue;
                    }
                }
            }
            if (!string.IsNullOrEmpty(txtAgentCode.Text))
            {
                associatesVo.AAC_AgentCode = txtAgentCode.Text;
            }
            else
            {
                associatesVo.AAC_AgentCode = null;
            }
            associatesVo.AAC_CreatedBy  = userVo.UserId;
            associatesVo.AAC_ModifiedBy = userVo.UserId;


            if (Session["agentCodelist"] != null)
            {
                List <string> agentcodelist = (List <string>)Session["agentCodelist"];
                for (int i = 0; i < agentcodelist.Count; i++)
                {
                    associatesBo.AddAgentChildCode(associatesVo, agentcodelist[i]);
                }
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ViewAgentCode", "loadcontrol('ViewAgentCode','login');", true);
            }
            else
            {
                if (Validation(txtAgentCode.Text))
                {
                    result = associatesBo.CreateAdviserAgentCode(associatesVo, agentId, advisorVo.advisorId);
                    if (Request.QueryString["AssociationId"] != null)
                    {
                        int associationId = int.Parse(Request.QueryString["AssociationId"]);
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('SubBroker code Added Successfully');", true);
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "AddAssociates", "loadcontrol('AddAssociatesDetails','?AssociationId=" + associationId + "&fromPage=" + "AddCode" + "');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('SubBroker code Added Successfully');", true);
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ViewAgentCode", "loadcontrol('ViewAgentCode','login');", true);
                    }
                }
            }

            if (Request.QueryString["prevPage"] != null && Request.QueryString["prevPage"] == "AddRM")
            {
                string queryString = "?prevPage=AddRM";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('ViewRM','" + queryString + "');", true);
            }
            else if (Request.QueryString["prevPage"] != null && Request.QueryString["prevPage"] == "AddBranch")
            {
                //string queryString = "?prevPage=AddBranch";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('ViewBranches','none');", true);
                //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('AddBranch','" + queryString + "');", true);
            }
            else if (Request.QueryString["prevPage"] != null && Request.QueryString["prevPage"] == "EditRMDetails")
            {
                string queryString = "?prevPage=EditRMDetails&AgentCode=" + txtAgentCode.Text + "&Action=Edit";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('EditRMDetails','" + queryString + "');", true);
                //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('AddBranch','" + queryString + "');", true);
            }
            else if (Request.QueryString["prevPage"] != null && Request.QueryString["prevPage"] == "EditBranchDetails")
            {
                string queryString = "?prevPage=EditBranchDetails&AgentCode=" + txtAgentCode.Text + "";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadcontrol('EditBranchDetails','" + queryString + "');", true);
                //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('AddBranch','" + queryString + "');", true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            userVo       = (UserVo)Session["userVo"];
            associatesVo = (AssociatesVO)Session["associatesVo"];
            rmVo         = (RMVo)Session[SessionContents.RmVo];
            int       rmId            = 0;
            double    total           = 0;
            DataSet   dsCurrentValues = null;
            DataTable dt;

            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "rm")
            {
                userType           = "rm";
                rmId               = rmVo.RMId;
                trAUM.Visible      = true;
                trcustomer.Visible = true;
                tdloan.Visible     = true;
            }
            else if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "associates")
            {
                userType           = "associates";
                agentId            = associatesVo.AAC_AdviserAgentId;
                trAUM.Visible      = false;
                trcustomer.Visible = true;
                tdloan.Visible     = false;
            }
            try
            {
                if (Session["BMDashBoardRMId"] != null)
                {
                    rmId = int.Parse(Session["BMDashBoardRMId"].ToString());
                }
                else
                {
                    rmId = rmVo.RMId;
                }

                dsCurrentValues = getCurrentValuesforRM(rmId);
                getCustomerListforRM(rmId, agentId, userType);
                dt = dsCurrentValues.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["AssetType"].ToString() == "Equity")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblEquityValue.Text = "0";
                        }
                        else
                        {
                            lblEquityValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "IN")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblInsuranceValue.Text = "0";
                        }
                        else
                        {
                            lblInsuranceValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "MF-DT")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblMFDebtValue.Text = "0";
                        }
                        else
                        {
                            lblMFDebtValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "MF-HY")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblMFHybridValue.Text = "0";
                        }
                        else
                        {
                            lblMFHybridValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "MF-OT")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblMFOthersValue.Text = "0";
                        }
                        else
                        {
                            lblMFOthersValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "MF-EQ")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblEquityMFValue.Text = "0";
                        }
                        else
                        {
                            lblEquityMFValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));

                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                    if (dr["AssetType"].ToString() == "MF-CO")
                    {
                        if (dr["AggrGSCurrentValue"].ToString() == "")
                        {
                            lblMFCommodityValue.Text = "0";
                        }
                        else
                        {
                            lblMFCommodityValue.Text = String.Format("{0:N}", decimal.Parse(dr["AggrGSCurrentValue"].ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));

                            total += double.Parse(dr["AggrGSCurrentValue"].ToString());
                        }
                    }
                }
                BindCustomerAlerts();
                dtLoanProposal = liabilitiesBo.GetRMLoanProposalPendingCount(rmVo.RMId);

                if (dtLoanProposal != null)
                {
                    tblLoanCount.Visible = true;
                    lblPendingBank.Text  = dtLoanProposal.Rows[0]["N_Count"].ToString();
                    lblPendingUs.Text    = dtLoanProposal.Rows[1]["N_Count"].ToString();
                }
                else
                {
                    tblLoanCount.Visible = false;
                }
                lblTotalValue.Text = String.Format("{0:N}", decimal.Parse(total.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                //total.ToString("n2");
                ShowUnreadMessageAlert();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "RMDashBoard.ascx.cs:Page_Load()");

                object[] objects = new object[3];
                objects[0] = rmId;
                objects[1] = total;
                objects[2] = dsCurrentValues;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void BindAssociatesGrid(int id, bool isAdviser, bool isBranchHead, bool isBranchId)
        {
            associateVoList = new List <AssociatesVO>();
            AssociatesVO associateVo = new AssociatesVO();
            DataSet      dsViewAssociates;
            DataTable    dtViewAssociates = new DataTable();
            DataRow      dr;

            //dsViewAssociates = associatesBo.GetViewAssociates(advisorVo.advisorId);
            associateVoList = associatesBo.GetViewAssociates(id, isAdviser, isBranchHead, isBranchId, currentUserRole);
            string format = "dd/MM/yyyy hh:mm tt";

            if (associateVoList != null)
            {
                dtViewAssociates.Columns.Add("AA_AdviserAssociateId");
                dtViewAssociates.Columns.Add("AA_RequestDate");
                dtViewAssociates.Columns.Add("AA_ContactPersonName");
                dtViewAssociates.Columns.Add("AAC_AgentCode");
                dtViewAssociates.Columns.Add("XS_Status");
                dtViewAssociates.Columns.Add("AA_StepStatus");
                dtViewAssociates.Columns.Add("WWFSM_StepCode");
                dtViewAssociates.Columns.Add("WWFSM_StepName");
                dtViewAssociates.Columns.Add("AB_BranchName");
                dtViewAssociates.Columns.Add("RM");
                dtViewAssociates.Columns.Add("AA_Email");
                dtViewAssociates.Columns.Add("AA_Mobile");
                for (int i = 0; i < associateVoList.Count; i++)
                {
                    dr          = dtViewAssociates.NewRow();
                    associateVo = associateVoList[i];
                    dr["AA_AdviserAssociateId"] = associateVo.AdviserAssociateId;
                    if (associateVo.RequestDate != DateTime.MinValue)
                    {
                        dr["AA_RequestDate"] = associateVo.RequestDate.ToString(format);
                    }
                    if (associateVo.ContactPersonName != null)
                    {
                        dr["AA_ContactPersonName"] = associateVo.ContactPersonName;
                    }
                    if (associateVo.AAC_AgentCode != null)
                    {
                        dr["AAC_AgentCode"] = associateVo.AAC_AgentCode;
                    }
                    if (associateVo.CurrentStatus != null)
                    {
                        dr["AA_StepStatus"] = associateVo.CurrentStatus;
                    }
                    if (associateVo.StepName != null)
                    {
                        dr["WWFSM_StepCode"] = associateVo.StepCode;
                    }
                    if (associateVo.StepName != null)
                    {
                        dr["WWFSM_StepName"] = associateVo.StepName;
                    }
                    if (associateVo.Status != null)
                    {
                        dr["XS_Status"] = associateVo.Status;
                    }
                    if (associateVo.BranchName != null)
                    {
                        dr["AB_BranchName"] = associateVo.BranchName;
                    }
                    if (associateVo.RMNAme != null)
                    {
                        dr["RM"] = associateVo.RMNAme;
                    }
                    if (associateVo.Email != null)
                    {
                        dr["AA_Email"] = associateVo.Email;
                    }
                    if (associateVo.Mobile != 0)
                    {
                        dr["AA_Mobile"] = associateVo.Mobile;
                    }
                    dtViewAssociates.Rows.Add(dr);
                }
                pnlAssociatesView.Visible   = true;
                gvViewAssociates.DataSource = dtViewAssociates;
                gvViewAssociates.DataBind();
                gvViewAssociates.Visible    = true;
                imgExportAssociates.Visible = true;
                trErrorMessage.Visible      = false;
                if (Cache["gvViewAssociates + '" + advisorVo.advisorId + "'"] == null)
                {
                    Cache.Insert("gvViewAssociates + '" + advisorVo.advisorId + "'", dtViewAssociates);
                }
                else
                {
                    Cache.Remove("gvViewAssociates + '" + advisorVo.advisorId + "'");
                    Cache.Insert("gvViewAssociates + '" + advisorVo.advisorId + "'", dtViewAssociates);
                }
            }

            else
            {
                trErrorMessage.Visible      = true;
                gvViewAssociates.Visible    = false;
                imgExportAssociates.Visible = false;
                pnlAssociatesView.Visible   = false;
            }
            //if (dtViewAssociates == null)
            //{
            //    gvViewAssociates.DataSource = null;
            //    gvViewAssociates.DataBind();
            //}
            //else
            //{
            //    gvViewAssociates.DataSource = dtViewAssociates;
            //    gvViewAssociates.DataBind();
            //    imgViewAssociates.Visible = true;
            //    if (Cache["gvViewAssociates" + userVo.UserId + userType] == null)
            //    {
            //        Cache.Insert("gvViewAssociates" + userVo.UserId + userType, dtViewAssociates);
            //    }
            //    else
            //    {
            //        Cache.Remove("gvViewAssociates" + userVo.UserId + userType);
            //        Cache.Insert("gvViewAssociates" + userVo.UserId + userType, dtViewAssociates);
            //    }
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            associateuserheirarchyVo = (AssociatesUserHeirarchyVo)Session[SessionContents.AssociatesLogin_AssociatesHierarchy];
            advisorVo    = (AdvisorVo)Session["advisorVo"];
            rmVo         = (RMVo)Session[SessionContents.RmVo];
            userVo       = (UserVo)Session["userVo"];
            associatesVo = (AssociatesVO)Session["associatesVo"];
            AdvisorMISBo adviserMISBo = new AdvisorMISBo();

            path = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());

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

            else
            {
                userType = Session[SessionContents.CurrentUserRole].ToString().ToLower();
            }

            advisorId = advisorVo.advisorId;
            int RMId = rmVo.RMId;

            rmId = rmVo.RMId;
            bmID = rmVo.RMId;

            //if (userType == "associates")
            //{
            //    SetParameters();
            //    BindMfDashBoard();
            //}

            if (!IsPostBack)
            {
                if (userType == "advisor" || userType == "rm")
                {
                    BindBranchDropDown();
                    BindRMDropDown();
                    if (userType == "rm")
                    {
                        ddlType.Visible     = false;
                        lblType.Visible     = false;
                        ddlBranch.Enabled   = false;
                        ddlRM.SelectedValue = rmVo.RMId.ToString();
                        ddlRM.Enabled       = false;
                    }
                    if (Session["NodeType"] != null)
                    {
                        if (Session["NodeType"] == "MFDashBoard")
                        {
                            SetParameters();
                            BindMfDashBoard();
                            UpnlMFDashBoard.Visible = true;
                        }
                    }
                }
                else if (userType == "rm")
                {
                    //BindBranchDropDown();
                    //BindRMDropDown();
                    //if (userType == "rm")
                    //{
                    //    ddlBranch.Enabled = false;
                    //    ddlRM.SelectedValue = rmVo.RMId.ToString();
                    //    ddlRM.Enabled = false;
                    //}
                }
                if (userType == "bm")
                {
                    //trBranchRM.Visible = true;
                    BindBranchForBMDropDown();
                    BindRMforBranchDropdown(0, bmID);
                    //BindMfDashBoard();
                }
                else if (userType == "associates")
                {
                    SetParameters();
                    BindMfDashBoard();
                    BindBranchDropDown();
                    BindRMDropDown();
                    gvBranch.Visible        = true;
                    Label1.Visible          = true;
                    lnkBranchNavi.Visible   = true;
                    UpnlMFDashBoard.Visible = true;
                    trBranchRM.Visible      = false;
                    btnGo.Visible           = false;
                    ddlType.Visible         = false;
                    lblType.Visible         = false;
                }
            }

            // BindMfDashBoard();
        }
 private void GetAssociateVoList(int assiciateId)
 {
     associatesVo            = associatesBo.GetAssociateVoList(assiciateId);
     Session["associatesVo"] = associatesVo;
 }
        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);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            userVo             = (UserVo)Session["userVo"];
            advisorPrefernceVo = (AdvisorPreferenceVo)Session["AdvisorPreferenceVo"];
            rmVo           = (RMVo)Session["rmVo"];
            adviserVo      = (AdvisorVo)Session["advisorVo"];
            associatesVo   = (AssociatesVO)Session["associatesVo"];
            assocUsrHeirVo = (AssociatesUserHeirarchyVo)Session["associatesUserHeirarchyVo"];


            if (Session[SessionContents.CurrentUserRole].ToString().ToLower() == "admin" || Session[SessionContents.CurrentUserRole].ToString().ToLower() == "ops" || userVo.AdviserRole.ContainsValue("CNT"))
            {
                txtCustomerName_autoCompleteExtender.ContextKey    = adviserVo.advisorId.ToString();
                txtCustomerName_autoCompleteExtender.ServiceMethod = "GetAdviserCustomerName";
                txtPansearch_autoCompleteExtender.ContextKey       = adviserVo.advisorId.ToString();
                txtPansearch_autoCompleteExtender.ServiceMethod    = "GetAdviserCustomerPan";
                txtClientCode_autoCompleteExtender.ContextKey      = adviserVo.advisorId.ToString();
                txtClientCode_autoCompleteExtender.ServiceMethod   = "GetCustCode";
            }

            if (Request.QueryString["reqId"] != null)
            {
                OnlineUserSessionBo.CheckSession();
                adviserVo  = (AdvisorVo)Session["advisorVo"];
                customerVo = (CustomerVo)Session["customerVo"];
                userVo     = (UserVo)Session["userVo"];
                BindTransactionGrid();
            }
            else
            {
                OnlineUserSessionBo.CheckSession();
                adviserVo  = (AdvisorVo)Session["advisorVo"];
                customerVo = (CustomerVo)Session["customerVo"];
                userVo     = (UserVo)Session["userVo"];


                fromDate             = DateTime.Now.AddMonths(-1);
                txtFrom.SelectedDate = fromDate.Date;
                txtTo.SelectedDate   = DateTime.Now;
            }
            if (!Page.IsPostBack)
            {
                BindAMC();
                Bindscheme();
                if (Request.QueryString["systematicId"] != null && Request.QueryString["AccountId"] != null && Request.QueryString["schemeplanCode"] != null && Request.QueryString["IsSourceAA"] != null && Request.QueryString["customerId"] != null)
                {
                    systematicId   = int.Parse(Request.QueryString["systematicId"].ToString());
                    AccountId      = int.Parse(Request.QueryString["AccountId"].ToString());
                    schemeplanCode = int.Parse(Request.QueryString["schemeplanCode"].ToString());
                    IsSourceAA     = int.Parse(Request.QueryString["IsSourceAA"].ToString());
                    customerid     = int.Parse(Request.QueryString["customerId"].ToString());
                    BindTransactionGrid();
                }
            }
            else
            {
                Bindscheme();
                fromDate             = DateTime.Now.AddMonths(-1);
                txtFrom.SelectedDate = fromDate.Date;
                txtTo.SelectedDate   = DateTime.Now;
            }
        }