示例#1
0
        protected void btnCheckSecurityCode_Click(object sender, EventArgs e)
        {
            strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();

            //try
            //{
            if (!txtSecurityCode.Text.Equals(string.Empty))
            {
                strClientID    = Session[clsSystem_Session.strSession.clientID.ToString()].ToString();
                strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString();
                int intSwitchID = (int)ViewState["intSwitchID"];

                clsSecurityCode oSecurityCode          = new clsSecurityCode(this.txtSecurityCode.Text.Trim());
                string          strSecurityCodeMessage = oSecurityCode.ValidateSecurityCode(intSwitchID, strClientID, strPortfolioID);

                if (strSecurityCodeMessage.Contains("Sorry, the security code you have entered is incorrect, please re-enter the security code."))
                {
                    this.mpeSecurityCodePanel.Show();
                }
                else if (strSecurityCodeMessage.Contains("Thank you, the proposed changes will be made to your portfolio."))
                {
                    clsSwitchDetails.transferClientSwitchToIFA((List <clsSwitchDetails_Client>)Session["SwitchDetails_Client"], strUserID);

                    int intHistoryID = clsHistory.insertHeader(strPortfolioID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Approved);
                    clsHistory.insertDetailsClient(intHistoryID, (List <clsSwitchDetails_Client>)Session["SwitchDetails_Client"]);
                    clsHistory.insertMessage(intHistoryID, new clsSwitch_Client(intSwitchID).propDescription);

                    NotifyApprovedSwtich(new clsSwitch(new clsPortfolio(strClientID, strPortfolioID, ""), ""));

                    ClientScript.RegisterStartupScript(this.GetType(), "showApproveSwitch", string.Format("showApproveSwitchPanel();"), true);

                    showhideAmendArea(false);
                    showhideButtons(enumPageState.view);
                }
                ClientScript.RegisterStartupScript(this.GetType(), "alertMessage", string.Format("alert('{0}');", strSecurityCodeMessage), true);
            }

            clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);

            populateHeader(oPortfolio);
            populateProposedSwitch(oPortfolio.propSwitch.propSwitchDetails);
            //}
            //catch (Exception ex)
            //{
            //    string backPageURL = "https://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/report/" + "portfoliodetails.asp";
            //    ClientScript.RegisterStartupScript(this.GetType(), "alertApproveError", "alert('Error! " + ex.ToString().Replace("'", "") + "'); window.location='" + backPageURL + "';", true);
            //}
        }
        protected void btnCheckSecurityCode_Click(object sender, EventArgs e)
        {
            strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();

            //try 
            //{
                if (!txtSecurityCode.Text.Equals(string.Empty))
                {
                    strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString();
                    strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString();
                    int intSwitchID = (int)ViewState["intSwitchID"];

                    clsSecurityCode oSecurityCode = new clsSecurityCode(this.txtSecurityCode.Text.Trim());
                    string strSecurityCodeMessage = oSecurityCode.ValidateSecurityCode(intSwitchID, strClientID, strPortfolioID);

                    if (strSecurityCodeMessage.Contains("Sorry, the security code you have entered is incorrect, please re-enter the security code."))
                    {
                        this.mpeSecurityCodePanel.Show();
                    }
                    else if (strSecurityCodeMessage.Contains("Thank you, the proposed changes will be made to your portfolio."))
                    {
                        clsSwitchDetails.transferClientSwitchToIFA((List<clsSwitchDetails_Client>)Session["SwitchDetails_Client"], strUserID);

                        int intHistoryID = clsHistory.insertHeader(strPortfolioID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Approved);
                        clsHistory.insertDetailsClient(intHistoryID, (List<clsSwitchDetails_Client>)Session["SwitchDetails_Client"]);
                        clsHistory.insertMessage(intHistoryID, new clsSwitch_Client(intSwitchID).propDescription);

                        NotifyApprovedSwtich(new clsPortfolio(strClientID, strPortfolioID, strUserID));

                        ClientScript.RegisterStartupScript(this.GetType(), "showApproveSwitch", string.Format("showApproveSwitchPanel();"), true);

                        showhideAmendArea(false);
                        showhideButtons(enumPageState.view);

                    }
                    ClientScript.RegisterStartupScript(this.GetType(), "alertMessage", string.Format("alert('{0}');", strSecurityCodeMessage), true);
                }

                clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);
                populateHeader(oPortfolio);
                populateProposedSwitch(oPortfolio.propSwitch.propSwitchDetails);
            //}
            //catch (Exception ex)
            //{
            //    string backPageURL = "https://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/report/" + "portfoliodetails.asp";
            //    ClientScript.RegisterStartupScript(this.GetType(), "alertApproveError", "alert('Error! " + ex.ToString().Replace("'", "") + "'); window.location='" + backPageURL + "';", true);
            //}
        }