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

            int intSwitchID = propSwitchID;

            List <clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listSwitchDetailsPortfolio    = (List <clsSwitchScheme_Client.clsSwitchSchemeDetails_Client>)Session["SwitchSchemeDetailsPortfolio_Client"];
            List <clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listSwitchDetailsContribution = (List <clsSwitchScheme_Client.clsSwitchSchemeDetails_Client>)Session["SwitchSchemeDetailsContribution_Client"];

            if (!txtSecurityCode.Text.Equals(string.Empty))
            {
                if (listSwitchDetailsPortfolio == null)
                {
                    clsSwitchScheme_Client SwitchScheme_Client = new clsSwitchScheme_Client(intSwitchID);

                    listSwitchDetailsPortfolio    = SwitchScheme_Client.propSwitchDetailsPortfolio;
                    listSwitchDetailsContribution = SwitchScheme_Client.propSwitchDetailsContribution;
                }

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

                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."))
                {
                    if (listSwitchDetailsPortfolio != null)
                    {
                        clsSwitchScheme.clsSwitchSchemeDetails.transferClientSwitchToIFA(listSwitchDetailsPortfolio, strUserID, false, true);
                        clsSwitchScheme.clsSwitchSchemeDetails.transferClientSwitchToIFA(listSwitchDetailsContribution, strUserID, true, false);
                    }

                    NotifyApprovedSwtich();

                    int intHistoryID = clsHistory.clsHistoryScheme.insertHeader(strSchemeID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Approved);
                    clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, listSwitchDetailsPortfolio, false);
                    clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, listSwitchDetailsContribution, true);
                    clsHistory.clsHistoryScheme.insertMessage(intHistoryID, new clsSwitch_Client(intSwitchID).propDescription);

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alertCancelledSwitch", "alert('This Switch has been approved!'); window.location='" + this.propBackPageURL + "';", true);
                }
                else if (strSecurityCodeMessage.Contains("Sorry, you have entered the security code incorrectly three times"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alertMessage", string.Format("alert('{0}'); window.location='" + this.propBackPageURL + "'; ", strSecurityCodeMessage), true);
                }

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

            populate(listSwitchDetailsPortfolio, false);
            populate(listSwitchDetailsContribution, true);
        }
        protected void btnCheckSecurityCode_Click(object sender, EventArgs e)
        {
            String strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();
            String strSchemeID = Session[clsSystem_Session.strSession.tempschemeid.ToString()].ToString();
            String strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString();

            int intSwitchID = propSwitchID;

            List<clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listSwitchDetailsPortfolio = (List<clsSwitchScheme_Client.clsSwitchSchemeDetails_Client>)Session["SwitchSchemeDetailsPortfolio_Client"];
            List<clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listSwitchDetailsContribution = (List<clsSwitchScheme_Client.clsSwitchSchemeDetails_Client>)Session["SwitchSchemeDetailsContribution_Client"];

            if (!txtSecurityCode.Text.Equals(string.Empty))
            {                

                if (listSwitchDetailsPortfolio == null) 
                { 
                    clsSwitchScheme_Client SwitchScheme_Client = new clsSwitchScheme_Client(intSwitchID);

                    listSwitchDetailsPortfolio = SwitchScheme_Client.propSwitchDetailsPortfolio;
                    listSwitchDetailsContribution = SwitchScheme_Client.propSwitchDetailsContribution;
                }

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

                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."))
                {
                    if (listSwitchDetailsPortfolio != null)
                    {
                        clsSwitchScheme.clsSwitchSchemeDetails.transferClientSwitchToIFA(listSwitchDetailsPortfolio, strUserID, false, true);
                        clsSwitchScheme.clsSwitchSchemeDetails.transferClientSwitchToIFA(listSwitchDetailsContribution, strUserID, true, false);
                    }

                    NotifyApprovedSwtich();

                    int intHistoryID = clsHistory.clsHistoryScheme.insertHeader(strSchemeID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Approved);
                    clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, listSwitchDetailsPortfolio, false);
                    clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, listSwitchDetailsContribution, true);
                    clsHistory.clsHistoryScheme.insertMessage(intHistoryID, new clsSwitch_Client(intSwitchID).propDescription);

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alertCancelledSwitch", "alert('This Switch has been approved!'); window.location='" + this.propBackPageURL + "';", true);

                }
                else if (strSecurityCodeMessage.Contains("Sorry, you have entered the security code incorrectly three times"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alertMessage", string.Format("alert('{0}'); window.location='" + this.propBackPageURL + "'; ", strSecurityCodeMessage), true);
                }

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

            populate(listSwitchDetailsPortfolio, false);
            populate(listSwitchDetailsContribution, true);

        }