Exemple #1
0
        /// <Docs>To be added.</Docs>
        /// <summary>
        /// Raises the callback event.
        /// </summary>
        /// <param name="EventArgs">The ${ParameterType} instance containing the event data.</param>
        void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
        {
            ClientDataInbound clientevent = JsonConvert.DeserializeObject <ClientDataInbound>(eventArgument);

            if (clientevent.action == "login" && clientevent.check() == true)
            {
                VerifyClientData verifyevent = JsonConvert.DeserializeObject <VerifyClientData>(eventArgument);
                verifyevent.check();

                if (verifyevent.valid)
                {
                    LoginData clientlogin = new LoginData(verifyevent);
                    try
                    {
                        clientlogin.login_User();
                        userID   = clientlogin.UserID;
                        username = clientlogin.UserName;
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(String.Format("{0} \r\n {1} \r\n {2}", e.Message, e.InnerException, e.Data));
                        authentication_exception = true;
                    }
                    finally
                    {
                        user_authenticated = clientlogin.authenticated;
                    }
                }
            }
        }
        /// <summary>
        /// This method is what gets called when a callback is initated from the clients AJAX call.
        /// </summary>
        /// <param name="eventArgument"></param>
        void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
        {
            ClientDataInbound clientevent = JsonConvert.DeserializeObject <ClientDataInbound>(eventArgument);

            if (clientevent.action == "CreateUser" && clientevent.check() == true)
            {
                VerifyClientData verifyevent = JsonConvert.DeserializeObject <VerifyClientData>(eventArgument);
                verifyevent.check();

                if (verifyevent.valid)
                {
                    CreateClientUser usercreation = new CreateClientUser(verifyevent);

                    if (usercreation.valid)
                    {
                        try
                        {
                            usercreation.create_user();
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine(String.Format("{0}\r\n{1}\r\n{2}", e.Message, e.InnerException, e.Data));
                        }
                        finally
                        {
                            usercreation_success = usercreation.usercreated;
                        }
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// This method allows our page to process client callbacks.
        /// </summary>
        /// <param name="eventArgument"></param>
        void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
        {
            // place the incoming eventArgument into a Json Helper object to get an action accessor
            ClientDataInbound clientevent = JsonConvert.DeserializeObject <ClientDataInbound>(eventArgument);

            if (clientevent.action == "goInvestor" && clientevent.check() == true)
            {
                VerifyClientData verifyevent = JsonConvert.DeserializeObject <VerifyClientData>(eventArgument);
                verifyevent.check();

                if (verifyevent.valid && verifyevent.InvestorID != null)
                {
                    // Check to make sure a previous session state does not exist, user may have hit the back page.
                    if (Session["InvestorAccountID"] == null)
                    {
                        Session.Add("InvestorAccountID", Convert.ToInt32(verifyevent.InvestorID));
                        DestinationInvestor = true;
                    }
                    // If the session state does exist remove it explicitly then apply the new one.
                    else if (Session["InvestorAccountID"] != null)
                    {
                        Session.Remove("InvestorAccountID");
                        Session.Add("InvestorAccountID", Convert.ToInt32(verifyevent.InvestorID));
                        DestinationInvestor = true;
                    }
                }
                else
                {
                    // something went wrong most likley the client is trying to hack us.
                }
            }

            if (clientevent.action == "goEntrepreneur" && clientevent.check() == true)
            {
                VerifyClientData verifyevent = JsonConvert.DeserializeObject <VerifyClientData>(eventArgument);
                verifyevent.check();

                if (verifyevent.valid && verifyevent.EntrepreneurID != null)
                {
                    // Check to make sure a previous session state does not exist, user may have hit the back page.
                    if (Session["EntrepreneurAccountID"] == null)
                    {
                        Session.Add("EntrepreneurAccountID", Convert.ToInt32(verifyevent.EntrepreneurID));
                        DestinationEntrepreneur = true;
                    }
                    // If the session state does exist remove it explicitly then apply the new one.
                    else if (Session["EntrepreneurAccountID"] != null)
                    {
                        Session.Remove("EntrepreneurAccountID");
                        Session.Add("EntrepreneurAccountID", Convert.ToInt32(verifyevent.EntrepreneurID));
                        DestinationEntrepreneur = true;
                    }
                }
                else
                {
                    // something went wrong most likley the client is trying to hack us.
                }
            }
        }
 public CreateInvestorProfile(VerifyClientData profile) : base()
 {
     newprofile = profile;
     valid      = false;
 }
 public LoginData(VerifyClientData loginevent) : base()
 {
     login = loginevent;
 }