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);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SessionBo.CheckSession();
            userVo = (UserVo)Session["UserVo"];
            path   = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
            txtLivingSince_CompareValidator.ValueToCompare  = DateTime.Now.ToShortDateString();
            txtMarriageDate_CompareValidator.ValueToCompare = DateTime.Now.ToShortDateString();
            cvJobStartDate.ValueToCompare = DateTime.Now.ToShortDateString();

            try
            {
                this.Page.Culture = "en-GB";
                rmVo = (RMVo)Session["rmVo"];

                customerVo = (CustomerVo)Session["CustomerVo"];
                if (Request.QueryString["RmId"] != null)
                {
                    rmId = int.Parse(Request.QueryString["RmId"].ToString());

                    rmVo = advisorStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                }
                else
                {
                    rmId = rmVo.RMId;
                }
                if (!IsPostBack)
                {
                    if (customerVo.SubType != "NRI")
                    {
                        txtRBIApprovalDate.Visible = false;
                        txtRBIRefNo.Visible        = false;
                        lblRBIApprovalDate.Visible = false;
                        lblRBIRefNum.Visible       = false;
                        trGuardianName.Visible     = true;
                    }
                    if (customerVo.SubType == "MNR")
                    {
                        trGuardianName.Visible = true;
                    }
                    else
                    {
                        trGuardianName.Visible = false;
                    }
                    if ((customerVo.SubType == "RES") && (customerVo.Type == "IND"))
                    {
                        btnGetSlab.Visible = true;
                    }
                    else
                    {
                        btnGetSlab.Visible = false;
                    }

                    // txtRmName.Text = rmVo.FirstName.ToString() + " " + rmVo.MiddleName.ToString() + " " + rmVo.LastName.ToString();
                    if (!string.IsNullOrEmpty(customerVo.Salutation))
                    {
                        ddlSalutation.SelectedValue = customerVo.Salutation;
                    }
                    txtFirstName.Text  = customerVo.FirstName.ToString();
                    txtMiddleName.Text = customerVo.MiddleName.ToString();
                    txtLastName.Text   = customerVo.LastName.ToString();
                    txtEmail.Text      = customerVo.Email.ToString();
                    txtPanNumber.Text  = customerVo.PANNum;
                    if (customerVo.DummyPAN == 1)
                    {
                        chkdummypan.Checked = true;
                    }
                    else
                    {
                        chkdummypan.Checked = false;
                    }

                    txtProfilingDate.Text = DateTime.Today.Date.ToShortDateString().ToString();
                    txtRMName.Text        = rmVo.FirstName + " " + rmVo.MiddleName + " " + rmVo.LastName;
                    BindDropDowns(path);
                    //BindTaxSlabDropDown();
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "CustomerIndividualAdd.ascx:Page_Load()");
                object[] objects = new object[3];
                objects[0]   = rmVo;
                objects[1]   = customerVo;
                objects[2]   = path;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private void ProcessAllCustomerRequest(string customerIds)
        {
            string[]          customerids     = customerIds.Split('~');
            List <MFReportVo> mfReportVoList  = null;
            MFReportEmailVo   mfReportEmailVo = new MFReportEmailVo();
            int customerId = 0;
            WERPTaskRequestManagementBo taskRequestManagementBo = new WERPTaskRequestManagementBo();
            int parentrequestId = 0;

            string[] reportTRange = reportTypeRange.Split('~');
            string[] reportTAsON  = reportTypeAsOn.Split('~');

            try
            {
                foreach (string arrStr in customerids)
                {
                    mfReportVoList  = new List <MFReportVo>();
                    mfReportEmailVo = new MFReportEmailVo();
                    customerId      = int.Parse(arrStr);
                    int groupCustomerId = 0;
                    if (isGroupHead)
                    {
                        groupCustomerId = customerId;
                    }
                    taskRequestManagementBo.CreateTaskRequest(1, userId, out parentrequestId);
                    custVo       = customerBo.GetCustomer(customerId);
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(custVo.RmId);
                    foreach (string str in reportTAsON)
                    {
                        mfReportVoList.Add(GetReportInputData(str, customerId, groupCustomerId, ref dtFrom, ref dtTo, ref dtAsOn, "ASON"));
                    }

                    foreach (string str in reportTRange)
                    {
                        mfReportVoList.Add(GetReportInputData(str, customerId, groupCustomerId, ref dtFrom, ref dtTo, ref dtAsOn, "RANGE"));
                    }

                    mfReportEmailVo.AdviserId      = adviserId;
                    mfReportEmailVo.CustomerId     = custVo.CustomerId;
                    mfReportEmailVo.CustomerEmail  = custVo.Email;
                    mfReportEmailVo.RMEmail        = customerRMVo.Email;
                    mfReportEmailVo.ReportTypeName = "Mutual Fund Portfolio Statement";

                    taskRequestManagementBo.CreateBulkReportRequest(mfReportVoList, mfReportEmailVo, parentrequestId, 1, userId);
                }

                UpdateTaskRequestRecorder(requestRecorderId, "SUCCESS");
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                UpdateTaskRequestRecorder(requestRecorderId, Ex.Message);
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "RequestCreatorBo:ProcessAllCustomerRequest(string customerIds)");
                object[] objects = new object[2];
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
Exemplo n.º 4
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            UserBo userBo = new UserBo();

            AdvisorStaffBo adviserStaffBo = new AdvisorStaffBo();
            RMVo           rmVo           = new RMVo();
            CustomerVo     customerVo     = new CustomerVo();
            CustomerBo     customerBo     = new CustomerBo();


            if (userBo.ValidateUser(txtUserName.Text.ToString(), txtPassword.Text.ToString()))
            {
                userVo = userBo.GetUser(txtUserName.Text.ToString());
                if (userVo.UserType == "Advisor")
                {
                    rmVo = adviserStaffBo.GetAdvisorStaff(userVo.UserId);
                    if (rmVo.AdviserId == adviserId || isMainDomain == true)
                    {
                        lblLoginMessage.Visible  = true;
                        lblLoginMessage.Text     = "Logged In to " + appName.ToString() + " as " + userVo.FirstName + ' ' + userVo.MiddleName + ' ' + userVo.LastName;
                        lblLoginMessage.CssClass = "FieldName";
                        tblLoginBlock.Visible    = false;

                        Session["CurrentUserVo"] = userVo;
                        lnklogout.Visible        = true;
                        Response.Write("<script>window.open('" + refLink + "?UserId=" + Encryption.Encrypt(userVo.UserId.ToString()) + "','_blank');</script>");
                    }
                    else
                    {
                        lblLoginMessage.Visible  = true;
                        tblLoginBlock.Visible    = true;
                        lblLoginMessage.Text     = "Authentication Failed";
                        lblLoginMessage.CssClass = "FieldError";
                    }
                }
                else if (userVo.UserType == "Customer")
                {
                    customerVo = customerBo.GetCustomerInfo(userVo.UserId);
                    rmVo       = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                    if (rmVo.AdviserId == adviserId || isMainDomain == true)
                    {
                        lblLoginMessage.Visible  = true;
                        lblLoginMessage.Text     = "Logged In to " + appName.ToString() + " as " + userVo.FirstName + ' ' + userVo.MiddleName + ' ' + userVo.LastName;
                        lblLoginMessage.CssClass = "FieldName";
                        Session["CurrentUserVo"] = userVo;
                        tblLoginBlock.Visible    = false;
                        lnklogout.Visible        = true;
                        Response.Write("<script>window.open('" + refLink + "?UserId=" + Encryption.Encrypt(userVo.UserId.ToString()) + "','_blank');</script>");
                    }
                    else
                    {
                        lblLoginMessage.Visible  = true;
                        tblLoginBlock.Visible    = false;
                        lblLoginMessage.Text     = "Authentication Failed";
                        lblLoginMessage.CssClass = "FieldError";
                    }
                }
            }
            else
            {
                lblLoginMessage.Text     = "Invalid LoginId or Password";
                lblLoginMessage.Visible  = true;
                lblLoginMessage.CssClass = "FieldError";
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try

            {
                SessionBo.CheckSession();
                this.Page.Culture = "en-GB";
                path       = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                rmVo       = (RMVo)Session["rmVo"];
                customerVo = (CustomerVo)Session["CustomerVo"];

                if (Request.QueryString["RmId"] != null)
                {
                    rmId = int.Parse(Request.QueryString["RmId"].ToString());
                    rmVo = advisorStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                }
                else
                {
                    rmId = rmVo.RMId;
                }
                txtDateofProfiling.Text = DateTime.Today.ToShortDateString();
                if (Session["Current_Link"].ToString() == "AdvisorLeftPane")
                {
                    // customerVo = (CustomerVo)Session["CustomerVo"];
                    txtRmName.Text      = rmVo.FirstName.ToString() + " " + rmVo.MiddleName.ToString() + " " + rmVo.LastName.ToString();
                    txtEmail.Text       = customerVo.Email.ToString();
                    txtPanNumber.Text   = customerVo.PANNum.ToString();
                    txtCompanyName.Text = customerVo.CompanyName;
                    if (customerVo.DummyPAN == 1)
                    {
                        chkdummypan.Checked = true;
                    }
                    else
                    {
                        chkdummypan.Checked = false;
                    }
                }
                else if (Session["Current_Link"].ToString() == "RMCustomerNonIndividualLeftPane")
                {
                    //customerVo = (CustomerVo)Session["CustomerVo"];
                    txtRmName.Text             = rmVo.FirstName.ToString() + " " + rmVo.MiddleName.ToString() + " " + rmVo.LastName.ToString();
                    txtEmail.Text              = "";
                    txtCompanyName.Text        = "";
                    txtDateofProfiling.Enabled = true;
                    txtDateofProfiling.Text    = DateTime.Today.ToShortDateString();
                    if (customerVo.DummyPAN == 1)
                    {
                        chkdummypan.Checked = true;
                    }
                    else
                    {
                        chkdummypan.Checked = false;
                    }
                }


                if (!IsPostBack)
                {
                    BindDropDowns(path);
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "CustomerNonIndividualAdd.ascx:Page_Load()");
                object[] objects = new object[3];
                objects[0]   = rmVo;
                objects[1]   = customerVo;
                objects[2]   = path;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
Exemplo n.º 6
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);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SessionBo.CheckSession();
                path       = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                userVo     = (UserVo)Session["userVo"];
                customerVo = (CustomerVo)Session["CustomerVo"];



                if (userVo.UserType.Trim() == "Adviser" || userVo.UserType.Trim() == "RM" || userVo.UserType.Trim() == "Branch Man" || userVo.UserType.Trim() == "Advisor")
                {
                    trDelete.Visible = true;
                }
                else
                {
                    trDelete.Visible = false;
                }
                if (customerVo.ProfilingDate == DateTime.MinValue)
                {
                    lblProfilingDate.Text = "";
                }
                else
                {
                    lblProfilingDate.Text = customerVo.ProfilingDate.ToShortDateString();
                }

                lblType.Text         = XMLBo.GetCustomerTypeName(path, customerVo.Type);
                lblSubType.Text      = XMLBo.GetCustomerSubTypeName(path, customerVo.SubType);
                lblName.Text         = customerVo.ContactFirstName + " " + customerVo.ContactMiddleName + " " + customerVo.ContactLastName;
                lblCustomerCode.Text = customerVo.CustCode.ToString();
                lblPanNum.Text       = customerVo.PANNum.ToString();
                lblCompanyName.Text  = customerVo.CompanyName;
                if (customerVo.BranchName != null)
                {
                    lblBranch.Text = customerVo.BranchName.ToString();
                }
                if (customerVo.RegistrationDate == DateTime.MinValue)
                {
                    lblRegistrationDate.Text = "";
                }
                else
                {
                    lblRegistrationDate.Text = customerVo.RegistrationDate.ToShortDateString();
                }
                if (customerVo.CommencementDate == DateTime.MinValue)
                {
                    lblCommencementDate.Text = "";
                }
                else
                {
                    lblCommencementDate.Text = customerVo.CommencementDate.ToShortDateString();
                }
                lblRegistrationNum.Text   = customerVo.RegistrationNum.ToString();
                lblRegistrationPlace.Text = customerVo.RegistrationPlace.ToString();
                lblCompanyWebsite.Text    = customerVo.CompanyWebsite.ToString();
                if (customerVo.DummyPAN == 1)
                {
                    chkdummypan.Checked = true;
                }
                else
                {
                    chkdummypan.Checked = false;
                }
                //if (customerVo.IsProspect == 1)
                //{
                //    chkprospectn.Checked = true;
                //}
                //else
                //{
                //    chkprospectn.Checked = false;
                //}
                if (customerVo.ViaSMS == 1)
                {
                    chksmsn.Checked = true;
                }
                else
                {
                    chksmsn.Checked = false;
                }
                if (customerVo.AlertViaEmail == 1)
                {
                    chkmailn.Checked = true;
                }
                else
                {
                    chkmailn.Checked = false;
                }

                lblCustomerCode.Text = customerVo.CustCode.ToString();
                customerRMVo         = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                if (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName != null && (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName).ToString() != "")
                {
                    lblRM.Text = customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName;
                }
                else
                {
                    lblRM.Text = "";
                }
                lblPanNum.Text      = customerVo.PANNum.ToString();
                lblCorrLine1.Text   = customerVo.Adr1Line1.ToString();
                lblCorrLine2.Text   = customerVo.Adr1Line2.ToString();
                lblCorrLine3.Text   = customerVo.Adr1Line3.ToString();
                lblCorrPinCode.Text = customerVo.Adr1PinCode.ToString();
                lblCorrCity.Text    = customerVo.Adr1City.ToString();
                if (customerVo.Adr1State != "")
                {
                    lblCorrState.Text = XMLBo.GetStateName(path, customerVo.Adr1State);
                }
                else
                {
                    lblCorrState.Text = "";
                }
                lblCorrCountry.Text = customerVo.Adr1Country.ToString();
                lblPermLine1.Text   = customerVo.Adr2Line1.ToString();
                lblPermLine2.Text   = customerVo.Adr2Line2.ToString();
                lblPermLine3.Text   = customerVo.Adr2Line3.ToString();
                lblPermPinCode.Text = customerVo.Adr2PinCode.ToString();
                lblPermCity.Text    = customerVo.Adr2City.ToString();
                if (customerVo.Adr2State.ToString() != string.Empty)

                {
                    lblPermState.Text = XMLBo.GetStateName(path, customerVo.Adr2State);
                }
                else
                {
                    lblPermState.Text = "";
                }
                lblPermCountry.Text = customerVo.Adr2Country.ToString();
                lblResPhone.Text    = customerVo.ResISDCode.ToString() + "-" + customerVo.ResSTDCode.ToString() + "-" + customerVo.ResPhoneNum.ToString();
                lblOfcPhone.Text    = customerVo.OfcISDCode.ToString() + "-" + customerVo.OfcSTDCode.ToString() + "-" + customerVo.OfcPhoneNum.ToString();
                lblResFax.Text      = customerVo.Fax.ToString() + "-" + customerVo.ISDFax.ToString() + "-" + customerVo.STDFax.ToString();
                lblEmail.Text       = customerVo.Email.ToString();
                lblAltEmail.Text    = customerVo.AltEmail.ToString();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewNonIndividualProfile.ascx:Page_Load()");
                object[] objects = new object[2];
                objects[0]   = customerVo;
                objects[2]   = userVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        private bool ExportToPDF(MFReportVo reportVo)
        {
            MFReportsBo mfReports  = new MFReportsBo();
            CustomerBo  customerBo = new CustomerBo();
            AdvisorBo   advisorBo  = new AdvisorBo();
            ////////////////////////////report = (MFReportVo)Session["reportParams"];
            //customerVo = (CustomerVo)Session["CusVo"];
            //if (Session["CusVo"] != null)
            //    customerVo = (CustomerVo)Session["CusVo"];
            string fileExtension        = ".pdf";
            string finalReportPath      = string.Empty;
            string exportReportFullPath = string.Empty;

            crmain = new ReportDocument();
            try
            {
                if (string.IsNullOrEmpty(tempAdviserId))
                {
                    tempAdviserId = reportVo.AdviserId.ToString();
                    advisorVo     = advisorBo.GetAdvisor(reportVo.AdviserId);
                }

                if (string.IsNullOrEmpty(tempCustomerId))
                {
                    tempCustomerId = reportVo.CustomerIds.ToString();
                    customerVo     = customerBo.GetCustomer(Convert.ToInt32(reportVo.CustomerIds));
                }

                if (tempAdviserId != reportVo.AdviserId.ToString())
                {
                    advisorVo = advisorBo.GetAdvisor(reportVo.AdviserId);
                }
                if (tempRMId != reportVo.RMId.ToString())
                {
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(reportVo.RMId);
                }
                if (tempCustomerId != reportVo.CustomerIds.ToString())
                {
                    customerVo = customerBo.GetCustomer(Convert.ToInt32(reportVo.CustomerIds));
                }
                if (string.IsNullOrEmpty(tempRMId))
                {
                    tempRMId     = reportVo.RMId.ToString();
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                }



                switch (reportVo.SubType)
                {
                case "CAPITAL_GAIN_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\CapitalGainSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtCapitalGainSummary = mfReports.GetCapitalGainSummaryReport(reportVo);
                    if (dtCapitalGainSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtCapitalGainSummary);
                        setLogo(adviserLogoPath);

                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("FromDate", report.FromDate.ToShortDateString());
                        //crmain.SetParameterValue("ToDate", report.ToDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "CAPITAL_GAIN_DETAILS":
                {
                    finalReportPath = reportFilePath + @"\CapitalGainDetails.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtCapitalGainDetails = mfReports.GetCapitalGainDetailsReport(reportVo);
                    if (dtCapitalGainDetails.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtCapitalGainDetails);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("FromDate", report.FromDate.ToShortDateString());
                        //crmain.SetParameterValue("ToDate", report.ToDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }


                case "CATEGORY_WISE":
                {
                    finalReportPath = reportFilePath + @"\MFFundSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataSet dsMFFundSummary = mfReports.GetMFFundSummaryReport(reportVo, advisorVo.advisorId);
                    if (dsMFFundSummary.Tables[0].Rows.Count > 0 || dsMFFundSummary.Tables[1].Rows.Count > 0)
                    {
                        crmain.Subreports["OpenPositionReport"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[0]);
                        crmain.Subreports["AllPositionReport1"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[1]);
                        crmain.Subreports["AllPositionReport2"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[1]);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("PreviousMonthDate", DateBo.GetPreviousMonthLastDate(reportVo.FromDate).ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "TRANSACTION_REPORT":
                {
                    finalReportPath = reportFilePath + @"\MFTransactions.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtTransactions = mfReports.GetTransactionReport(reportVo);
                    if (dtTransactions.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtTransactions);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtTransactions.Rows[0]["CustomerName"].ToString()))
                        // crmain.SetParameterValue("CustomerName", "Cust");
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));

                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "DIVIDEND_STATEMENT":
                {
                    finalReportPath = reportFilePath + @"\MFDividend.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtDividend = mfReports.GetDivdendReport(reportVo);
                    if (dtDividend.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtDividend);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        //crmain.SetParameterValue("CustomerName", "--");
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "RETURNS_PORTFOLIO":
                {
                    finalReportPath = reportFilePath + @"\MFReturns.rpt";
                    crmain.Load(finalReportPath);
                    //DataTable dtDividendReturnHolding = mfReports.GetDivdendReport(reportVo);
                    CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();
                    //DataTable dtReturnsPortfolio = mfReports.GetReturnSummaryReport(reportVo, advisorVo.advisorId);

                    //DataTable dtPortfolioXIRR = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);
                    //dtPortfolioXIRR = GetAbsolutereturnToXIRRDt(dtPortfolioXIRR, dtReturnsPortfolio);

                    DataSet   dsReturnsPortfolioHoldings = mfReports.GetReturnSummaryReport(reportVo, advisorVo.advisorId);
                    DataTable dtReturnsPortfolio         = dsReturnsPortfolioHoldings.Tables[0];
                    DataTable dtPortfolioXIRR            = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);
                    dtReturnsPortfolio = dsReturnsPortfolioHoldings.Tables[1];
                    dtPortfolioXIRR    = GetAbsolutereturnToXIRRDt(dtPortfolioXIRR, dtReturnsPortfolio);

                    if (dtReturnsPortfolio.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dsReturnsPortfolioHoldings.Tables[0]);
                        setLogo(adviserLogoPath);
                        crmain.Subreports["PortfolioXIRR"].Database.Tables["PortfolioXIRR"].SetDataSource(dtPortfolioXIRR);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        //crmain.SetParameterValue("CustomerName", "--");
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "COMPREHENSIVE":
                {
                    finalReportPath = reportFilePath + @"\ComprehensiveMFReport.rpt";
                    crmain.Load(finalReportPath);
                    CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();
                    DataSet             dsReturnsPortfolio  = mfReports.GetPortfolioAnalyticsReport(reportVo, advisorVo.advisorId);
                    DataTable           dtReturnsPortfolio  = dsReturnsPortfolio.Tables[0];

                    DataTable dtPortfolioXIRRComp = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);

                    dtReturnsPortfolio = dsReturnsPortfolio.Tables[1];
                    DataTable dtPortfolioXIRR = GetAbsolutereturnToXIRRDt(dtPortfolioXIRRComp, dtReturnsPortfolio);
                    if (dsReturnsPortfolio.Tables[0].Rows.Count > 0)
                    {
                        crmain.SetDataSource(dsReturnsPortfolio.Tables[0]);
                        crmain.Subreports["Portfolio_XIRR"].Database.Tables["PortfolioXIRR"].SetDataSource(dtPortfolioXIRRComp);
                        //crmain.Subreports["MFSchemePerformance"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[1]);
                        //crmain.Subreports["MFTopTenHoldings"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[2]);
                        //crmain.Subreports["MFTopTenSectors"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[5]);

                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);

                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "DIVIDEND_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\MFDividendSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtDividendSummary = mfReports.GetDivdendReport(reportVo);
                    //customerVo = (CustomerVo)Session["CusVo"];
                    if (dtDividendSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtDividendSummary);
                        setLogo(adviserLogoPath);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));

                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }
                //Added Three more cases for Display three new report : Author-Pramod
                //case "RETURNS_PORTFOLIO_REALIZED":
                //    {
                //        finalReportPath = reportFilePath + @"\MFReturnsRealized.rpt";
                //        crmain.Load(finalReportPath);
                //        DataTable dtReturnsREPortfolio = mfReports.GetMFReturnRESummaryReport(reportVo, advisorVo.advisorId);
                //        if (dtReturnsREPortfolio.Rows.Count > 0)
                //        {
                //            crmain.SetDataSource(dtReturnsREPortfolio);
                //            setLogo(adviserLogoPath);
                //            crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                //            crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToShortDateString());
                //            crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToShortDateString());
                //            AssignReportViewerProperties();
                //            reportFileName = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                //            exportReportFullPath = savedLocation + @"/" + reportFileName;
                //            crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                //        }

                //        break;
                //    }

                case "ELIGIBLE_CAPITAL_GAIN_DETAILS":
                {
                    finalReportPath = reportFilePath + @"\EligibleCapitalGainsSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtEligibleCapitalGainsDetails = mfReports.GetEligibleCapitalGainDetailsReport(reportVo);
                    if (dtEligibleCapitalGainsDetails.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtEligibleCapitalGainsDetails);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("AsOnDate", report.FromDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "ELIGIBLE_CAPITAL_GAIN_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\EligibleCapitalGainsSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtEligibleCapitalGainsSummary = mfReports.GetEligibleCapitalGainDetailsReport(reportVo);
                    if (dtEligibleCapitalGainsSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtEligibleCapitalGainsSummary);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //crmain.SetParameterValue("DateRange", "As on: " + report.ToDate.ToShortDateString());
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                }
                break;

                case "TRANSACTION_REPORT_OPEN_CLOSE_BALANCE":
                    finalReportPath = reportFilePath + @"\MFOpenCloseTransactionReport.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtOpeningClosingTransactions = mfReports.GetOpeningClosingTransactionReport(reportVo);
                    if (dtOpeningClosingTransactions.Rows.Count > 0)
                    {
                        setLogo(adviserLogoPath);
                        //crmain.SetDataSource(dtOpeningClosingTransactions);
                        crmain.Database.Tables["MFOpenCloseTransactionReport"].SetDataSource((DataTable)dtOpeningClosingTransactions);

                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;

                case "REALIZED_REPORT":
                    finalReportPath = reportFilePath + @"\MFRealized.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtMFRealized = mfReports.GetMFRealizedReport(reportVo, advisorVo.advisorId);
                    if (dtMFRealized.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtMFRealized);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;

                case "COMPOSITION_REPORT":
                    finalReportPath = reportFilePath + @"\SchemePerformance.rpt";
                    crmain.Load(finalReportPath);
                    DataSet dsCustomerPortfolioComposition = mfReports.GetPortfolioCompositionReport(reportVo, advisorVo.advisorId);

                    if (dsCustomerPortfolioComposition.Tables[0].Rows.Count > 0)
                    {
                        //crmain.SetDataSource(dsCustomerPortfolioComposition.Tables[0]);
                        crmain.Database.Tables["PortfolioComposition"].SetDataSource(dsCustomerPortfolioComposition.Tables[0]);
                        crmain.Subreports["MFTopTenHoldings"].Database.Tables["ToptenHoldings"].SetDataSource(dsCustomerPortfolioComposition.Tables[1]);
                        crmain.Subreports["MFTopTenSectors"].Database.Tables["TopTenSectors"].SetDataSource(dsCustomerPortfolioComposition.Tables[4]);

                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }
                //Filling Emails
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            if (!string.IsNullOrEmpty(reportFileName))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            cvDepositDate1.ValueToCompare = DateTime.Now.ToShortDateString();
            txtLivingSince_CompareValidator.ValueToCompare = DateTime.Now.ToShortDateString();
            cvJobStartDate.ValueToCompare = DateTime.Now.ToShortDateString();
            txtMarriageDate_CompareValidator.ValueToCompare = DateTime.Now.ToShortDateString();

            try
            {
                SessionBo.CheckSession();
                path       = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                userVo     = (UserVo)Session["userVo"];
                customerVo = (CustomerVo)Session["CustomerVo"];
                RMVo customerRMVo = new RMVo();
                if (!IsPostBack)
                {
                    lblPanDuplicate.Visible = false;

                    if (customerVo.SubType != "NRI")
                    {
                        txtRBIRefDate.Visible = false;
                        txtRBIRefNo.Visible   = false;
                        lblRBIRefDate.Visible = false;
                        lblRBIRefNo.Visible   = false;
                    }
                    if (customerVo.SubType == "MNR")
                    {
                        trGuardianName.Visible = true;
                    }
                    else
                    {
                        trGuardianName.Visible = false;
                    }
                    BindDropDowns();

                    //Bind Adviser Branch List

                    BindListBranch(customerVo.RmId, "rm");


                    if (customerVo.Type.ToUpper().ToString() == "IND")
                    {
                        rbtnIndividual.Checked = true;
                    }
                    else
                    {
                        rbtnNonIndividual.Checked = true;
                    }
                    ddlAdviserBranchList.SelectedValue = customerVo.BranchId.ToString();
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                    if (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName != null && (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName).ToString() != "")
                    {
                        lblRM.Text = customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName;
                    }
                    else
                    {
                        lblRM.Text = "";
                    }
                    if (customerVo.MaritalStatus != null)
                    {
                        ddlMaritalStatus.SelectedValue = customerVo.MaritalStatus.ToString();
                    }
                    if (ddlMaritalStatus.SelectedValue == "MA")
                    {
                        txtMarriageDate.Enabled = true;
                    }
                    else
                    {
                        txtMarriageDate.Enabled = false;
                    }

                    if (customerVo.MarriageDate == DateTime.MinValue)
                    {
                        txtMarriageDate.Text = "";
                    }
                    else
                    {
                        txtMarriageDate.Text = customerVo.MarriageDate.ToShortDateString();
                    }
                    if (customerVo.Nationality != null)
                    {
                        ddlNationality.SelectedValue = customerVo.Nationality.ToString();
                    }
                    if (customerVo.Occupation != null)
                    {
                        ddlOccupation.SelectedValue = customerVo.Occupation.ToString();
                    }
                    if (customerVo.Qualification != null)
                    {
                        ddlQualification.SelectedValue = customerVo.Qualification.ToString();
                    }

                    if (customerVo.ProfilingDate == DateTime.MinValue)
                    {
                        txtProfilingDate.Text = "";
                    }
                    else
                    {
                        txtProfilingDate.Text = customerVo.ProfilingDate.ToShortDateString();
                    }

                    if (customerVo.Dob == DateTime.MinValue)
                    {
                        txtDob.Text = "";
                    }
                    else
                    {
                        txtDob.Text = customerVo.Dob.ToShortDateString();
                    }
                    if (!string.IsNullOrEmpty(customerVo.Salutation))
                    {
                        ddlSalutation.SelectedValue = customerVo.Salutation;
                    }
                    else
                    {
                        ddlSalutation.SelectedIndex = 0;
                    }
                    if (customerVo.DummyPAN == 1)
                    {
                        chkdummypan.Checked = true;
                    }
                    else
                    {
                        chkdummypan.Checked = false;
                    }
                    //if (customerVo.IsProspect == 1)
                    //{
                    //    chkprospect.Checked = true;
                    //}
                    //else
                    //{
                    //    chkprospect.Checked = false;
                    //}
                    if (customerVo.ViaSMS == 1)
                    {
                        chksms.Checked = true;
                    }
                    else
                    {
                        chksms.Checked = false;
                    }
                    if (customerVo.AlertViaEmail == 1)
                    {
                        chkmail.Checked = true;
                    }
                    else
                    {
                        chkmail.Checked = false;
                    }

                    txtGuardianFirstName.Text  = customerVo.ContactFirstName;
                    txtGuardianLastName.Text   = customerVo.ContactLastName;
                    txtGuardianMiddleName.Text = customerVo.ContactMiddleName;
                    txtFirstName.Text          = customerVo.FirstName;
                    txtMiddleName.Text         = customerVo.MiddleName;
                    txtLastName.Text           = customerVo.LastName;
                    txtCustomerCode.Text       = customerVo.CustCode;
                    txtPanNumber.Text          = customerVo.PANNum;

                    txtCorrAdrLine1.Text          = customerVo.Adr1Line1;
                    txtCorrAdrLine2.Text          = customerVo.Adr1Line2;
                    txtCorrAdrLine3.Text          = customerVo.Adr1Line3;
                    txtCorrAdrPinCode.Text        = customerVo.Adr1PinCode.ToString();
                    txtCorrAdrCity.Text           = customerVo.Adr1City;
                    ddlCorrAdrState.SelectedValue = customerVo.Adr1State;
                    txtCorrAdrCountry.Text        = customerVo.Adr1Country;
                    txtPermAdrLine1.Text          = customerVo.Adr2Line1;
                    txtPermAdrLine2.Text          = customerVo.Adr2Line2;

                    txtPermAdrLine3.Text          = customerVo.Adr2Line3;
                    txtPermAdrPinCode.Text        = customerVo.Adr2PinCode.ToString();
                    txtPermAdrCity.Text           = customerVo.Adr2City;
                    ddlPermAdrState.SelectedValue = customerVo.Adr2State;
                    txtPermAdrCountry.Text        = customerVo.Adr2Country;
                    txtOfcCompanyName.Text        = customerVo.CompanyName;
                    txtOfcAdrLine1.Text           = customerVo.OfcAdrLine1;
                    txtOfcAdrLine2.Text           = customerVo.OfcAdrLine2;
                    txtOfcAdrLine3.Text           = customerVo.OfcAdrLine3;
                    txtOfcAdrPinCode.Text         = customerVo.OfcAdrPinCode.ToString();
                    txtOfcAdrCity.Text            = customerVo.OfcAdrCity;
                    ddlOfcAdrState.SelectedValue  = customerVo.OfcAdrState;
                    txtOfcAdrCountry.Text         = customerVo.OfcAdrCountry;
                    txtResPhoneNoIsd.Text         = customerVo.ResISDCode.ToString();
                    txtResPhoneNoStd.Text         = customerVo.ResSTDCode.ToString();
                    txtResPhoneNo.Text            = customerVo.ResPhoneNum.ToString();
                    txtOfcPhoneNoIsd.Text         = customerVo.OfcISDCode.ToString();
                    txtOfcPhoneNoStd.Text         = customerVo.OfcSTDCode.ToString();
                    txtOfcPhoneNo.Text            = customerVo.OfcPhoneNum.ToString();
                    txtOfcFaxIsd.Text             = customerVo.OfcISDFax.ToString();
                    txtOfcFaxStd.Text             = customerVo.OfcSTDFax.ToString();
                    txtOfcFax.Text    = customerVo.OfcFax.ToString();
                    txtResFax.Text    = customerVo.Fax.ToString();
                    txtResFaxIsd.Text = customerVo.ISDFax.ToString();
                    txtResFaxStd.Text = customerVo.STDFax.ToString();
                    txtMobile1.Text   = customerVo.Mobile1.ToString();
                    txtMobile2.Text   = customerVo.Mobile2.ToString();
                    txtEmail.Text     = customerVo.Email;
                    txtAltEmail.Text  = customerVo.AltEmail;
                    txtRBIRefNo.Text  = customerVo.RBIRefNum;
                    if (customerVo.RBIApprovalDate == DateTime.MinValue)
                    {
                        txtRBIRefDate.Text = "";
                    }
                    else
                    {
                        txtRBIRefDate.Text = customerVo.RBIApprovalDate.ToShortDateString();
                    }

                    if (customerVo.ResidenceLivingDate == DateTime.MinValue)
                    {
                        txtLivingSince.Text = "";
                    }
                    else
                    {
                        txtLivingSince.Text = customerVo.ResidenceLivingDate.ToShortDateString();
                    }

                    if (customerVo.JobStartDate == DateTime.MinValue)
                    {
                        txtJobStartDate.Text = "";
                    }
                    else
                    {
                        txtJobStartDate.Text = customerVo.JobStartDate.ToShortDateString();
                    }

                    txtMotherMaidenName.Text = customerVo.MothersMaidenName;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "EditCustomerIndividualProfile.ascx:btnSubmit_Click()");
                object[] objects = new object[3];
                objects[0]   = customerVo;
                objects[1]   = path;
                objects[2]   = userVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SessionBo.CheckSession();
                path       = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                userVo     = (UserVo)Session["userVo"];
                customerVo = (CustomerVo)Session["CustomerVo"];
                RMVo customerRMVo = new RMVo();
                if (customerVo.SubType == "MNR")
                {
                    trGuardianName.Visible = true;
                }
                else
                {
                    trGuardianName.Visible = false;
                }
                if (userVo.UserType.Trim() == "Adviser" || userVo.UserType.Trim() == "RM" || userVo.UserType.Trim() == "Branch Man" || userVo.UserType.Trim() == "Advisor")
                {
                    trDelete.Visible = true;
                }
                else
                {
                    trDelete.Visible = false;
                }

                if (customerVo.ProfilingDate.Year == 1800 || customerVo.ProfilingDate == DateTime.MinValue)
                {
                    lblProfilingDate.Text = "";
                }
                else
                {
                    lblProfilingDate.Text = customerVo.ProfilingDate.ToShortDateString().ToString();
                }
                if (customerVo.Dob.Year == 1800 || customerVo.Dob == DateTime.MinValue)
                {
                    lblDob.Text = "";
                }
                else
                {
                    lblDob.Text = customerVo.Dob.ToShortDateString().ToString();
                }

                //hdnassociationcount.Value = customerBo.GetAssociationCount("C", customerVo.CustomerId).ToString();
                lblGuardianName.Text = customerVo.ContactFirstName + " " + customerVo.ContactMiddleName + " " + customerVo.ContactLastName;
                lblName.Text         = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString();
                lblCustCode.Text     = customerVo.CustCode.ToString();
                lblPanNum.Text       = customerVo.PANNum.ToString();
                lblCorrLine1.Text    = customerVo.Adr1Line1.ToString();
                lblCorrLine2.Text    = customerVo.Adr1Line2.ToString();
                lblCorrLine3.Text    = customerVo.Adr1Line3.ToString();
                lblCorrPinCode.Text  = customerVo.Adr1PinCode.ToString();
                lblCorrCity.Text     = customerVo.Adr1City.ToString();
                if (customerVo.BranchName != null && customerVo.BranchName.ToString() != "")
                {
                    lblBranch.Text = customerVo.BranchName.ToString();
                }
                else
                {
                    lblBranch.Text = "";
                }
                customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                if (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName != null && (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName).ToString() != "")
                {
                    lblRM.Text = customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName;
                }
                else
                {
                    lblRM.Text = "";
                }

                if (customerVo.JobStartDate.Year == 1800 || customerVo.JobStartDate == DateTime.MinValue)
                {
                    lblJobStart.Text = "";
                }
                else
                {
                    lblJobStart.Text = customerVo.JobStartDate.ToShortDateString().ToString();
                }

                if (customerVo.ResidenceLivingDate.Year == 1800 || customerVo.ResidenceLivingDate == DateTime.MinValue)
                {
                    lblLiving.Text = "";
                }
                else
                {
                    lblLiving.Text = customerVo.ResidenceLivingDate.ToShortDateString().ToString();
                }

                if (customerVo.Adr1State == "")
                {
                    lblCorrState.Text = "";
                }
                else
                {
                    lblCorrState.Text = XMLBo.GetStateName(path, customerVo.Adr1State.ToString());
                }

                lblMotherMaiden.Text = customerVo.MothersMaidenName.ToString();
                lblCorrCountry.Text  = customerVo.Adr1Country.ToString();
                lblPermLine1.Text    = customerVo.Adr2Line1.ToString();
                lblPermLine2.Text    = customerVo.Adr2Line2.ToString();
                lblPermLine3.Text    = customerVo.Adr2Line3.ToString();
                lblPermPinCode.Text  = customerVo.Adr2PinCode.ToString();
                lblPermCity.Text     = customerVo.Adr2City.ToString();
                if (customerVo.Adr2State == "")
                {
                    lblPermState.Text = "";
                }
                else
                {
                    lblPermState.Text = XMLBo.GetStateName(path, customerVo.Adr2State.ToString());
                }

                lblPermCountry.Text = customerVo.Adr2Country.ToString();
                lblCompanyName.Text = customerVo.CompanyName.ToString();
                lblOfcLine1.Text    = customerVo.OfcAdrLine1.ToString();
                lblOfcLine2.Text    = customerVo.OfcAdrLine2.ToString();
                lblOfcLine3.Text    = customerVo.OfcAdrLine3.ToString();
                lblOfcPinCode.Text  = customerVo.OfcAdrPinCode.ToString();
                lblOfcCity.Text     = customerVo.OfcAdrCity.ToString();

                if (customerVo.OfcAdrState == "")
                {
                    lblOfcState.Text = "";
                }
                else
                {
                    lblOfcState.Text = XMLBo.GetStateName(path, customerVo.OfcAdrState.ToString());
                }
                lblOfcCountry.Text = customerVo.OfcAdrCountry.ToString();
                lblResPhone.Text   = customerVo.ResISDCode.ToString() + "-" + customerVo.ResSTDCode.ToString() + "-" + customerVo.ResPhoneNum.ToString();
                lblOfcPhone.Text   = customerVo.OfcISDCode.ToString() + "-" + customerVo.OfcSTDCode.ToString() + "-" + customerVo.OfcPhoneNum.ToString();
                lblOfcFax.Text     = customerVo.OfcISDFax.ToString() + "-" + customerVo.OfcSTDFax.ToString() + "-" + customerVo.OfcFax.ToString();
                lblResFax.Text     = customerVo.ISDFax.ToString() + "-" + customerVo.STDFax.ToString() + "-" + customerVo.Fax.ToString();
                lblMobile1.Text    = customerVo.Mobile1.ToString();
                lblMobile2.Text    = customerVo.Mobile2.ToString();
                lblEmail.Text      = customerVo.Email.ToString();
                lblAltEmail.Text   = customerVo.AltEmail.ToString();
                if (customerVo.DummyPAN == 1)
                {
                    chkdummypan.Checked = true;
                }
                else
                {
                    chkdummypan.Checked = false;
                }
                if (customerVo.IsProspect == 1)
                {
                    chkprospect.Checked = true;
                }
                else
                {
                    chkprospect.Checked = false;
                }
                if (customerVo.ViaSMS == 1)
                {
                    chksms.Checked = true;
                }
                else
                {
                    chksms.Checked = false;
                }
                if (customerVo.AlertViaEmail == 1)
                {
                    chkmail.Checked = true;
                }
                else
                {
                    chkmail.Checked = false;
                }

                if (customerVo.Occupation != null)
                {
                    lblOccupation.Text = XMLBo.GetOccupationName(path, customerVo.Occupation.ToString());
                }
                else
                {
                    lblOccupation.Text = "";
                }
                if (customerVo.MaritalStatus != null)
                {
                    lblMaritalStatus.Text = XMLBo.GetMaritalStatusName(path, customerVo.MaritalStatus.ToString());
                }
                else
                {
                    lblMaritalStatus.Text = "";
                }
                if (customerVo.MarriageDate.Year == 1800 || customerVo.MarriageDate == DateTime.MinValue)
                {
                    lblMarriageDate.Text = "";
                }
                else
                {
                    lblMarriageDate.Text = customerVo.MarriageDate.ToShortDateString();
                }
                if (customerVo.Qualification != null)
                {
                    lblQualification.Text = XMLBo.GetQualificationName(path, customerVo.Qualification.ToString());
                }
                else
                {
                    lblQualification.Text = "";
                }
                if (customerVo.Nationality != null)
                {
                    lblNationality.Text = XMLBo.GetNationalityName(path, customerVo.Nationality.ToString());
                }
                else
                {
                    lblNationality.Text = "";
                }
                lblRBIRefNo.Text = customerVo.RBIRefNum.ToString();
                if (customerVo.RBIApprovalDate.Year == 1800 || customerVo.RBIApprovalDate == DateTime.MinValue)

                {
                    lblRBIRefDate.Text = "";
                }
                else
                {
                    lblRBIRefDate.Text = customerVo.RBIApprovalDate.ToShortDateString().ToString();
                }
                if (customerVo.Nationality != null)
                {
                    lblNationality.Text = XMLBo.GetNationalityName(path, customerVo.Nationality.ToString());
                }
                else
                {
                    lblNationality.Text = "";
                }
                lblType.Text    = XMLBo.GetCustomerTypeName(path, customerVo.Type);
                lblSubType.Text = XMLBo.GetCustomerSubTypeName(path, customerVo.SubType);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewCustomerIndividualProfile.ascx:Page_Load()");
                object[] objects = new object[3];
                objects[0]   = customerVo;
                objects[1]   = path;
                objects[2]   = userVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        public static void SendMail(string To, string Cc, string Bcc, string Subject, string Body, ArrayList Attachments, string from, string emailTypeCode, DataTable dtAdviserSMTP, out string fromSMTPEmail, DataSet dsEmailTemplateDetails, out string statusMessage)
        {
            statusMessage = "";
            fromSMTPEmail = "";

            string templateId = string.Empty;
            string reportType = string.Empty;
            AdvisorPreferenceVo advisorPreferenceVo = null;
            AdvisorVo           advisorVo           = null;
            CustomerVo          customerVo          = null;
            RMVo                rmVo                           = null;
            AdvisorBo           advisorBo                      = new AdvisorBo();
            CustomerBo          customerBo                     = new CustomerBo();
            AdvisorStaffBo      advisorStaffBo                 = new AdvisorStaffBo();
            AdviserPreferenceBo adviserPreferenceBo            = new AdviserPreferenceBo();
            DataTable           dtEmailOutgoingParameterValues = dsEmailTemplateDetails.Tables[0];
            DataTable           dtEmailTemplateParameters      = dsEmailTemplateDetails.Tables[1];
            DataTable           dtAdviserEmailTemplate         = dsEmailTemplateDetails.Tables[2];
            DataTable           dtAdviserTemplateParametersPre = dsEmailTemplateDetails.Tables[3];

            _SMTPFrom = from;
            SetAdviserSMTP(dtAdviserSMTP, _SMTPFrom);

            SmtpClient   smtpClient = new SmtpClient();
            EmailMessage email      = new EmailMessage();

            //MailMessage email = new MailMessage(_SMTPFromDisplay, To);
            _SMTPUsername = GetSMTPUserFromPool();
            fromSMTPEmail = _SMTPUsername;

            email.To.Add(To);
            //string name = userVo.FirstName + " " + userVo.MiddleName + " " + userVo.LastName;

            email.ReadSendMailTemplate(emailTypeCode);

            foreach (DataRow dr in dtEmailOutgoingParameterValues.Rows)
            {
                switch (dr["WP_ParameterCode"].ToString())
                {
                case "AID":
                    advisorVo           = advisorBo.GetAdvisor(Convert.ToInt32(dr["WRD_InputParameterValue"].ToString()));
                    advisorPreferenceVo = adviserPreferenceBo.GetAdviserPreference(advisorVo.advisorId);
                    break;

                case "CID":
                    customerVo = customerBo.GetCustomer(Convert.ToInt32(dr["WRD_InputParameterValue"].ToString()));
                    rmVo       = advisorStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                    break;

                case "RT":
                    reportType = Convert.ToString(dr["WRD_InputParameterValue"]);
                    break;
                }
            }

            foreach (DataRow dr in dtAdviserEmailTemplate.Rows)
            {
                if (dr["WERPTTM_TypeCode"].ToString() == emailTypeCode)
                {
                    email.Body = email.Body.Replace("[EMAIL_BODY]", dr["AHTMLT_TemplateBody"].ToString());
                    templateId = dr["AHTMLT_Id"].ToString();
                    break;
                }
            }

            foreach (DataRow dr in dtEmailTemplateParameters.Rows)
            {
                string templateCode = dr["WERPTPM_TemplateParameterCode"].ToString();
                switch (templateCode)
                {
                case "[ADVISER_NAME]":
                    email.Body = email.Body.Replace(templateCode, advisorVo.FirstName + " " + advisorVo.MiddleName + " " + advisorVo.LastName);
                    break;

                case "[ADVISER_PHONE]":
                    email.Body = email.Body.Replace(templateCode, advisorVo.Phone1Std + "-" + advisorVo.Phone1Number);
                    break;

                case "[ADVISER_MOBILE]":
                    email.Body = email.Body.Replace(templateCode, advisorVo.MobileNumber.ToString());
                    break;

                case "[ADVISER_EMAIL]":
                    email.Body = email.Body.Replace(templateCode, advisorVo.Email.ToString());
                    break;

                case "[A_WEB_SITE]":
                    email.Body = email.Body.Replace(templateCode, advisorPreferenceVo.WebSiteDomainName.ToString());
                    break;

                case "[RM_NAME]":
                    email.Body = email.Body.Replace(templateCode, rmVo.FirstName + " " + rmVo.MiddleName + " " + rmVo.LastName);
                    break;

                case "[RM_MOBILE]":
                    email.Body = email.Body.Replace(templateCode, rmVo.Mobile.ToString());
                    break;

                case "[RM_EMAIL]":
                    email.Body = email.Body.Replace(templateCode, rmVo.Email.ToString());
                    break;

                case "[CUSTOMER_FIRST_NAME]":
                    email.Body = email.Body.Replace(templateCode, customerVo.FirstName);
                    break;

                case "[CUSTOMER_MIDDLE_NAME]":
                    email.Body = email.Body.Replace(templateCode, customerVo.MiddleName);
                    break;

                case "[CUSTOMER_LAST_NAME]":
                    email.Body = email.Body.Replace(templateCode, customerVo.LastName);
                    break;

                case "[START_LINE]":
                    email.Body = email.Body.Replace(templateCode, "<font face=" + "\"" + "[TEXT_FONT_NAME]" + "\"" + " size=" + "\"" + "[TEXT_FONT_SIZE]" + "\"" + " color=" + "\"" + "[TEXT_COLOR]" + "\"" + ">");
                    break;

                case "[END_LINE]":
                    email.Body = email.Body.Replace(templateCode, "</font>");
                    break;

                case "[LINE_BREAK]":
                    email.Body = email.Body.Replace(templateCode, "<br />");
                    break;

                case "[ONE_EMPTY_SPACE]":
                    email.Body = email.Body.Replace(templateCode, "&nbsp;");
                    break;

                case "[HYPERLINK_START]":
                    email.Body = email.Body.Replace(templateCode, "<a href=" + "\"" + "[A_WEB_SITE]" + "\"" + "target=" + "\"" + "_blank" + "\"" + ">");
                    break;

                case "[HYPERLINK_END]":
                    email.Body = email.Body.Replace(templateCode, "</a>");
                    break;

                case "[FONT_BOLD_START]":
                    email.Body = email.Body.Replace(templateCode, "<b>");
                    break;

                case "[FONT_BOLD_END]":
                    email.Body = email.Body.Replace(templateCode, "</b>");
                    break;

                case "[TEXT_FONT_NAME]":
                    email.Body = email.Body.Replace(templateCode, GetTemplateParamerValue(dtAdviserTemplateParametersPre, templateId, dr["WERPTPM_ParameterCode"].ToString()));
                    break;

                case "[TEXT_FONT_SIZE]":
                    email.Body = email.Body.Replace(templateCode, GetTemplateParamerValue(dtAdviserTemplateParametersPre, templateId, dr["WERPTPM_ParameterCode"].ToString()));
                    break;

                case "[TEXT_COLOR]":
                    email.Body = email.Body.Replace(templateCode, GetTemplateParamerValue(dtAdviserTemplateParametersPre, templateId, dr["WERPTPM_ParameterCode"].ToString()));
                    break;

                case "[REPORT_TYPE]":
                    //string reportType = GetTemplateParamerValue(dtAdviserTemplateParametersPre, reportTypeCode, dr["WERPTPM_ParameterCode"].ToString());
                    email.Body    = email.Body.Replace(templateCode, reportType);
                    email.Subject = email.Subject.Replace(templateCode, reportType);
                    break;
                }


                //email.Subject = email.Subject.Replace("MoneyTouch", advisorVo.OrganizationName);


                //email.Body = email.Body.Replace("[ORGANIZATION]", advisorVo.OrganizationName);
                //email.Body = email.Body.Replace("[CUSTOMER_NAME]", userVo.FirstName);
                //if (ConfigurationSettings.AppSettings["HostName"].ToString() == "Wealtherp")
                //{
                //    email.Body = email.Body.Replace("[WEBSITE]", advisorPreferenceVo.WebSiteDomainName);
                //}
                //else if (ConfigurationSettings.AppSettings["HostName"].ToString() == "Citrus")
                //{
                //    email.Body = email.Body.Replace("[WEBSITE]", advisorPreferenceVo.WebSiteDomainName);
                //}
                //email.Body = email.Body.Replace("[CONTACTPERSON]", advisorVo.ContactPersonFirstName + " " + advisorVo.ContactPersonMiddleName + " " + advisorVo.ContactPersonLastName);
                //if (!string.IsNullOrEmpty(advisorVo.Designation))
                //    email.Body = email.Body.Replace("[DESIGNATION]", advisorVo.Designation);
                //else
                //    email.Body = email.Body.Replace("[DESIGNATION]", string.Empty);
                //if (!string.IsNullOrEmpty(advisorVo.Phone1Number.ToString()))
                //    email.Body = email.Body.Replace("[PHONE]", advisorVo.Phone1Std.ToString() + "-" + advisorVo.Phone1Number.ToString());
                //else
                //    email.Body = email.Body.Replace("[PHONE]", string.Empty);

                //if (!string.IsNullOrEmpty(advisorVo.Email))
                //    email.Body = email.Body.Replace("[EMAIL]", advisorVo.Email);
                //else
                //    email.Body = email.Body.Replace("[EMAIL]", string.Empty);


                //if (_SMTPDefaultCredentials == true)
                //{
                //    NetworkCredential basicCredential = new NetworkCredential(_SMTPUsername, _SMTPPassword);
                //    smtpClient.UseDefaultCredentials = false;
                //    smtpClient.Credentials = basicCredential;
                //}
                //else
                //{
                //    smtpClient.UseDefaultCredentials = true;
                //}

                //smtpClient.Host = _SMTPServer;
                //if (_SMTPPort > 0)
                //    smtpClient.Port = _SMTPPort;

                ////Hardcoding SSL settings for gmail SMTP
                //if (_SMTPServer.Contains("smtp.gmail.com") || _SMTPServer.Contains("smtp.live.com"))
                //{
                //    smtpClient.EnableSsl = true;

                //}

                //if (Cc != null && Cc.Trim().Length > 0)
                //    mail.CC.Add(Cc);
                //if (Bcc != null && Bcc.Trim().Length > 0)
                //    mail.Bcc.Add(Bcc);

                //if (!string.IsNullOrEmpty(_SMTPFromDisplay.Trim()))
                //{
                //    if (_SMTPDefaultCredentials == true)
                //    {
                //        MailAddress md1 = new MailAddress(_SMTPUsername, _SMTPFromDisplay);
                //        mail.From = md1;
                //    }

                //    if (!string.IsNullOrEmpty(from.Trim()))
                //    {
                //        MailAddress md3 = new MailAddress(_SMTPFrom, _SMTPFromDisplay);
                //        mail.ReplyTo = md3;
                //    }
                //}



                //mail.Subject = Subject;
                //mail.IsBodyHtml = true;
                //mail.Body = Body;

                //if (mail.AlternateViews.Count != 0)
                //{
                //    foreach (AlternateView altrView in mail.AlternateViews)
                //    {
                //        mail.AlternateViews.Add(altrView);
                //    }
                //}

                //smtpClient.Send(mail);
            }

            foreach (object obj in Attachments)
            {
                Attachment attachment = attachment = new Attachment(obj.ToString());
                email.Attachments.Add(attachment);
            }

            //SendMail(To, Cc, Bcc, email.Subject.ToString(), email.Body.ToString(), Attachments, from, dtAdviserSMTP,out fromSMTPEmail);

            email.Body = email.Body.Replace("[A_WEB_SITE]", advisorPreferenceVo.WebSiteDomainName.ToString());


            email.Body = email.Body.Replace("[A_LOGO]", "<img src='cid:HDIImage' alt='Logo'>");
            string logoPath = string.Empty;

            System.Net.Mail.AlternateView htmlView;
            System.Net.Mail.AlternateView plainTextView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("Text view", null, "text/plain");
            //System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(hidBody.Value.Trim() + "<image src=cid:HDIImage>", null, "text/html");
            htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(email.Body, null, "text/html");
            //Add image to HTML version
            if (advisorVo != null)
            {
                logoPath = _AdviserLogoDirectory + "\\" + advisorVo.LogoPath;
            }
            if (!File.Exists(logoPath))
            {
                logoPath = _AdviserLogoDirectory + "\\spacer.png";
            }
            //System.Net.Mail.LinkedResource imageResource = new System.Net.Mail.LinkedResource(Server.MapPath("~/Images/") + @"\3DSYRW_4009.JPG", "image/jpeg");
            System.Net.Mail.LinkedResource imageResource = new System.Net.Mail.LinkedResource(logoPath, "image/jpeg");
            imageResource.ContentId = "HDIImage";
            htmlView.LinkedResources.Add(imageResource);
            //Add two views to message.
            email.AlternateViews.Add(plainTextView);
            email.AlternateViews.Add(htmlView);

            //SendMail(To, Cc, Bcc, email.Subject.ToString(), email.Body.ToString(), Attachments, from, dtAdviserSMTP, out fromSMTPEmail);

            SendMail(email, out statusMessage);
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SessionBo.CheckSession();
                path       = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"].ToString());
                userVo     = (UserVo)Session["userVo"];
                customerVo = (CustomerVo)Session["CustomerVo"];

                dtCity = commonLookupBo.GetWERPLookupMasterValueList(8000, 0);

                ddlCorrAdrCity.DataSource     = dtCity;
                ddlCorrAdrCity.DataTextField  = "WCMV_Name";
                ddlCorrAdrCity.DataValueField = "WCMV_LookupId";
                ddlCorrAdrCity.DataBind();
                ddlCorrAdrCity.Items.Insert(0, new ListItem("--SELECT--", "0"));

                ddlPermAdrCity.DataSource     = dtCity;
                ddlPermAdrCity.DataTextField  = "WCMV_Name";
                ddlPermAdrCity.DataValueField = "WCMV_LookupId";
                ddlPermAdrCity.DataBind();
                ddlPermAdrCity.Items.Insert(0, new ListItem("--SELECT--", "0"));
                dtState = commonLookupBo.GetWERPLookupMasterValueList(14000, 0);

                ddlCorrAdrState.DataSource     = dtState;
                ddlCorrAdrState.DataTextField  = "WCMV_Name";
                ddlCorrAdrState.DataValueField = "WCMV_LookupId";
                ddlCorrAdrState.DataBind();
                ddlCorrAdrState.Items.Insert(0, new ListItem("--SELECT--", "0"));

                ddlPermAdrState.DataSource     = dtState;
                ddlPermAdrState.DataTextField  = "WCMV_Name";
                ddlPermAdrState.DataValueField = "WCMV_LookupId";
                ddlPermAdrState.DataBind();
                ddlPermAdrState.Items.Insert(0, new ListItem("--SELECT--", "0"));

                dtOccupation                 = commonLookupBo.GetWERPLookupMasterValueList(3000, 0);;
                ddlOccupation.DataSource     = dtOccupation;
                ddlOccupation.DataTextField  = "WCMV_Name";
                ddlOccupation.DataValueField = "WCMV_LookupId";
                ddlOccupation.DataBind();
                ddlOccupation.Items.Insert(0, new ListItem("--SELECT--", "0"));

                if (userVo.UserType.Trim() == "Adviser" || userVo.UserType.Trim() == "RM" || userVo.UserType.Trim() == "Branch Man" || userVo.UserType.Trim() == "Advisor")
                {
                    trDelete.Visible = true;
                }
                else
                {
                    trDelete.Visible = false;
                }
                if (customerVo.ProfilingDate == DateTime.MinValue)
                {
                    lblProfilingDate.Text = "";
                }
                else
                {
                    lblProfilingDate.Text = customerVo.ProfilingDate.ToShortDateString();
                }

                lblType.Text         = XMLBo.GetCustomerTypeName(path, customerVo.Type);
                lblSubType.Text      = XMLBo.GetCustomerSubTypeName(path, customerVo.SubType);
                lblName.Text         = customerVo.ContactFirstName + " " + customerVo.ContactMiddleName + " " + customerVo.ContactLastName;
                lblCustomerCode.Text = customerVo.CustCode.ToString();
                if (customerVo.PANNum != null)
                {
                    lblPanNum.Text = customerVo.PANNum.ToString();
                }
                else
                {
                    lblPanNum.Text = null;
                }
                if (customerVo.CompanyName != null)
                {
                    lblCompanyName.Text = customerVo.CompanyName;
                }
                else
                {
                    lblCompanyName.Text = null;
                }
                if (customerVo.BranchName != null)
                {
                    lblBranch.Text = customerVo.BranchName.ToString();
                }
                else
                {
                    lblBranch.Text = null;
                }
                if (customerVo.RegistrationDate == DateTime.MinValue)
                {
                    lblRegistrationDate.Text = null;
                }
                else
                {
                    lblRegistrationDate.Text = customerVo.RegistrationDate.ToShortDateString();
                }
                if (customerVo.CommencementDate == DateTime.MinValue)
                {
                    lblCommencementDate.Text = null;
                }
                else
                {
                    lblCommencementDate.Text = customerVo.CommencementDate.ToShortDateString();
                }
                if (customerVo.RegistrationNum != null)
                {
                    lblRegistrationNum.Text = customerVo.RegistrationNum.ToString();
                }
                else
                {
                    lblRegistrationNum.Text = null;
                }
                if (customerVo.RegistrationPlace != null)
                {
                    lblRegistrationPlace.Text = customerVo.RegistrationPlace.ToString();
                }
                else
                {
                    lblRegistrationPlace.Text = null;
                }
                if (customerVo.CompanyWebsite != null)
                {
                    lblCompanyWebsite.Text = customerVo.CompanyWebsite.ToString();
                }
                else
                {
                    lblCompanyWebsite.Text = null;
                }
                if (customerVo.DummyPAN == 1)
                {
                    chkdummypan.Checked = true;
                }
                else
                {
                    chkdummypan.Checked = false;
                }
                //if (customerVo.IsProspect == 1)
                //{
                //    chkprospectn.Checked = true;
                //}
                //else
                //{
                //    chkprospectn.Checked = false;
                //}
                if (customerVo.ViaSMS == 1)
                {
                    chksmsn.Checked = true;
                }
                else
                {
                    chksmsn.Checked = false;
                }
                if (customerVo.AlertViaEmail == 1)
                {
                    chkmailn.Checked = true;
                }
                else
                {
                    chkmailn.Checked = false;
                }

                lblCustomerCode.Text = customerVo.CustCode.ToString();
                customerRMVo         = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                if (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName != null && (customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName).ToString() != "")
                {
                    lblRM.Text = customerRMVo.FirstName + " " + customerRMVo.MiddleName + " " + customerRMVo.LastName;
                }
                else
                {
                    lblRM.Text = "";
                }
                if (customerVo.PANNum != null)
                {
                    lblPanNum.Text = customerVo.PANNum.ToString();
                }
                else
                {
                    lblPanNum.Text = null;
                }
                if (customerVo.Adr1Line1 != null)
                {
                    lblCorrLine1.Text = customerVo.Adr1Line1.ToString();
                }
                else
                {
                    lblCorrLine1.Text = null;
                }
                if (customerVo.Adr1Line2 != null)
                {
                    lblCorrLine2.Text = customerVo.Adr1Line2.ToString();
                }
                else
                {
                    lblCorrLine2.Text = null;
                }
                if (customerVo.Adr1Line3 != null)
                {
                    lblCorrLine3.Text = customerVo.Adr1Line3.ToString();
                }
                else
                {
                    lblCorrLine3.Text = null;
                }
                if (customerVo.Adr1PinCode != null)
                {
                    lblCorrPinCode.Text = customerVo.Adr1PinCode.ToString();
                }
                else
                {
                    lblCorrPinCode.Text = null;
                }
                //if (customerVo.Adr1City != null)
                //{
                //    lblCorrCity.Text = customerVo.customerCity.ToString();
                //}
                //else
                //{
                //    lblCorrCity.Text = null;
                //}
                //if (customerVo.Adr1State != "")
                //{
                //    lblCorrState.Text = customerVo.Adr1State.ToString();

                //}
                //else
                //{
                //    lblCorrState.Text = null;
                //}
                if (customerVo.Adr1Country != "")
                {
                    lblCorrCountry.Text = customerVo.Adr1Country.ToString();
                }
                else
                {
                    lblCorrCountry.Text = null;
                }
                if (customerVo.Adr2Line1 != null)
                {
                    lblPermLine1.Text = customerVo.Adr2Line1.ToString();
                }
                else
                {
                    lblPermLine1.Text = null;
                }
                if (customerVo.Adr2Line2 != null)
                {
                    lblPermLine2.Text = customerVo.Adr2Line2.ToString();
                }
                else
                {
                    lblPermLine2.Text = null;
                }
                if (customerVo.Adr2Line3 != null)
                {
                    lblPermLine3.Text = customerVo.Adr2Line3.ToString();
                }
                else
                {
                    lblPermLine3.Text = null;
                }
                if (customerVo.Adr2PinCode != null)
                {
                    lblPermPinCode.Text = customerVo.Adr2PinCode.ToString();
                }
                else
                {
                    lblPermPinCode.Text = null;
                }
                if (customerVo.Adr1City != null)
                {
                    ddlCorrAdrCity.SelectedValue = customerVo.customerCity.ToString();
                }
                else
                {
                    ddlCorrAdrCity.SelectedValue = "--Select---";
                }
                if (customerVo.Adr1State != "")
                {
                    ddlCorrAdrState.SelectedValue = customerVo.Adr1State;
                }
                ddlPermAdrCity.SelectedValue  = customerVo.PermanentCityId.ToString();
                ddlPermAdrState.SelectedValue = customerVo.Adr2State.ToString();
                if (customerVo.Adr2Country != null)
                {
                    lblPermCountry.Text = customerVo.Adr2Country.ToString();
                }
                else
                {
                    lblPermCountry.Text = null;
                }
                lblResPhone.Text = customerVo.ResISDCode.ToString() + "-" + customerVo.ResSTDCode.ToString() + "-" + customerVo.ResPhoneNum.ToString();
                lblOfcPhone.Text = customerVo.OfcISDCode.ToString() + "-" + customerVo.OfcSTDCode.ToString() + "-" + customerVo.OfcPhoneNum.ToString();
                lblResFax.Text   = customerVo.Fax.ToString() + "-" + customerVo.ISDFax.ToString() + "-" + customerVo.STDFax.ToString();
                if (customerVo.Email != null)
                {
                    lblEmail.Text = customerVo.Email.ToString();
                }
                else
                {
                    lblEmail.Text = null;
                }
                if (customerVo.AltEmail != null)
                {
                    lblAltEmail.Text = customerVo.AltEmail.ToString();
                }
                else
                {
                    lblAltEmail.Text = null;
                }
                lblType.Text    = XMLBo.GetCustomerTypeName(path, customerVo.Type);
                lblSubType.Text = XMLBo.GetCustomerSubTypeName(path, customerVo.SubType);
                if (customerVo.OccupationId != 0)
                {
                    ddlOccupation.SelectedValue = customerVo.OccupationId.ToString();
                }
                else
                {
                    ddlOccupation.SelectedValue = null;
                }
                if (customerVo.AnnualIncome != null)
                {
                    lblAnnualIncome.Text = customerVo.AnnualIncome.ToString();
                }
                else
                {
                    lblAnnualIncome.Text = null;
                }
                if (customerVo.Nationality != null)
                {
                    lblNationality.Text = customerVo.Nationality.ToString();
                }
                else
                {
                    lblNationality.Text = null;
                }
                if (customerVo.MinNo1 != null)
                {
                    lblMinNo1.Text = customerVo.MinNo1.ToString();
                }
                else
                {
                    lblMinNo1.Text = null;
                }
                if (customerVo.MinNo2 != null)
                {
                    lblMinNo2.Text = customerVo.MinNo2.ToString();
                }
                else
                {
                    lblMinNo2.Text = null;
                }
                if (customerVo.MinNo3 != null)
                {
                    lblMinNo3.Text = customerVo.MinNo3.ToString();
                }
                {
                    lblMinNo3.Text = null;
                }
                if (customerVo.ESCNo != null)
                {
                    lblESCNo.Text = customerVo.ESCNo.ToString();
                }
                else
                {
                    lblESCNo.Text = null;
                }
                if (customerVo.UINNo != null)
                {
                    lblUINNo.Text = customerVo.UINNo.ToString();
                }
                else
                {
                    lblUINNo.Text = null;
                }
                if (customerVo.POA != null)
                {
                    lblPOA.Text = customerVo.POA.ToString();
                }
                else
                {
                    lblPOA.Text = null;
                }
                if (customerVo.GuardianName != null)
                {
                    lblGuardianName.Text = customerVo.GuardianName.ToString();
                }
                else
                {
                    lblGuardianName.Text = null;
                }
                if (customerVo.GuardianRelation != null)
                {
                    lblGuardianRelation.Text = customerVo.GuardianRelation.ToString();
                }
                else
                {
                    lblGuardianRelation.Text = null;
                }
                if (customerVo.ContactGuardianPANNum != null)
                {
                    lblGuardianPANNum.Text = customerVo.ContactGuardianPANNum.ToString();
                }
                else
                {
                    lblGuardianPANNum.Text = null;
                }
                if (customerVo.GuardianMinNo != null)
                {
                    lblGuardianMinNo.Text = customerVo.GuardianMinNo.ToString();
                }
                else
                {
                    lblGuardianMinNo.Text = null;
                }
                if (customerVo.GuardianDob == DateTime.MinValue)
                {
                    lblGuardianDateOfBirth.Text = null;
                }
                else
                {
                    lblGuardianDateOfBirth.Text = customerVo.GuardianDob.ToShortDateString();
                }
                if (customerVo.OtherBankName != null)
                {
                    lblOtherBankName.Text = customerVo.OtherBankName.ToString();
                }
                else
                {
                    lblOtherBankName.Text = null;
                }
                if (customerVo.TaxStatus != null)
                {
                    lblTaxStatus.Text = customerVo.TaxStatus.ToString();
                }
                else
                {
                    lblTaxStatus.Text = null;
                }
                if (customerVo.Category != null)
                {
                    lblCategory.Text = customerVo.Category.ToString();
                }
                else
                {
                    lblCategory.Text = null;
                }
                if (customerVo.Adr1City != null)
                {
                    lblOtherCity.Text = customerVo.Adr1City.ToString();
                }
                else
                {
                    lblOtherCity.Text = null;
                }
                if (customerVo.Adr1State != null)
                {
                    lblOtherState.Text = customerVo.Adr1State.ToString();
                }
                else
                {
                    lblOtherState.Text = null;
                }
                if (customerVo.OtherCountry != null)
                {
                    lblOtherCountry.Text = customerVo.OtherCountry.ToString();
                }
                else
                {
                    lblOtherCountry.Text = null;
                }
                if (customerVo.Mobile1 != null)
                {
                    lblMobile1.Text = customerVo.Mobile1.ToString();
                }
                else
                {
                    lblMobile1.Text = null;
                }
                if (customerVo.Mobile2 != null)
                {
                    lblMobile2.Text = customerVo.Mobile2.ToString();
                }
                else
                {
                    lblMobile2.Text = null;
                }
                if (customerVo.SubBroker != null)
                {
                    lblSubbroker.Text = customerVo.SubBroker.ToString();
                }
                else
                {
                    lblSubbroker.Text = null;
                }
                if (customerVo.Dob != DateTime.MinValue)
                {
                    lblDOB.Text = customerVo.Dob.ToString();
                }
                else
                {
                    lblDOB.Text = null;
                }
                if (customerVo.MothersMaidenName != null)
                {
                    lblmothersname.Text = customerVo.MothersMaidenName.ToString();
                }
                else
                {
                    lblmothersname.Text = null;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "ViewNonIndividualProfile.ascx:Page_Load()");
                object[] objects = new object[2];
                objects[0]   = customerVo;
                objects[2]   = userVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }