/// <summary>
        /// This method is what accepts an incoming stringified JSON object from the client user.
        /// </summary>
        /// <param name="eventArgument"></param>
        void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
        {
            ClientDataInbound clientevent = JsonConvert.DeserializeObject <ClientDataInbound>(eventArgument);

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

                if (verifyevent.valid)
                {
                    CreateEntreprenuerProfile newprofile = new CreateEntreprenuerProfile(verifyevent);

                    try
                    {
                        EntrepreneurID = newprofile.create_entreprenuer(UserID, verifyevent.EntrepreneurProfile);
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine(string.Format("{0}\r\n{1}\r\n{2}", e.Message, e.InnerException, e.Data));
                        EntrepreneurCreated = false;
                    }
                    finally
                    {
                        EntrepreneurCreated = newprofile.valid;
                    }
                }
            }
        }
Beispiel #2
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;
                        }
                    }
                }
            }
        }
Beispiel #4
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.
                }
            }
        }