Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ProudSourceUser"] != null)
            {
                UserSessionAccessor Token = new UserSessionAccessor((object[])Session["ProudSourceUser"]);
                {
                    if (Token.UserAuthenticated)
                    {
                        UserName = Token.UserName;
                        UserID   = Token.UserID;
                        Token.Dispose();

                        // fill our datasets with data from our queries
                        load_entrepreneurs();
                        load_investors();

                        // build string literals to render onto page
                        build_string_literal_results();

                        // greet our user that has just logged into their account
                        lbl_UserName.Text = UserName;
                    }
                    else
                    {
                        Response.Redirect("UserLogin.aspx");
                    }
                }
            }
            else
            {
                if (Page.IsCallback)
                {
                    Server.Transfer("UserLogin.aspx");
                }
                else
                {
                    Response.Redirect("UserLogin.aspx");
                }
            }

            // Add scripts to page that will handle calls to go to Entrepreneur and Investor profiles but do so only after we see that the client is logged in.

            // Get the page's client script and assign it to a ClientScriptManager
            ClientScriptManager cm = Page.ClientScript;

            // Generate a callback reference
            string cbReference  = cm.GetCallbackEventReference(this, "arg", "ToInvestor", null);
            string cbReference2 = cm.GetCallbackEventReference(this, "arg", "ToEntrepreneur", null);

            // Build the callback script block
            string cbscript  = "function GoInvestor(arg, context) {" + cbReference + "};";
            string cbscript2 = "function GoEntrepreneur(arg, context) {" + cbReference2 + "};";

            // Register the block
            cm.RegisterClientScriptBlock(Page.GetType(), "GoInvestor", cbscript, true);
            cm.RegisterClientScriptBlock(Page.GetType(), "GoEntrepreneur", cbscript2, true);
        }
        // private Image AccountImage;
        /// <TODO>
        /// Private PDF_document AccountPDF
        /// Figure out some way of storing and displaying a PDF onto the client side.
        /// </TODO>

        protected void Page_Load(object sender, EventArgs e)
        {
            // This a page where the user using it must be identifed and logged in so that we know what master user ID investor accounts created are associated with.
            // This if ... else statement will check to make sure that a session object exists with the information that we are looking for.
            if (Session["ProudSourceUser"] != null)
            {
                UserSessionAccessor Token = new UserSessionAccessor((object[])Session["ProudSourceUser"]);
                {
                    if (Token.UserAuthenticated)
                    {
                        UserName = Token.UserName;
                        UserID   = Token.UserID;
                        Token.Dispose();

                        // greet our Entrepreneur
                        lbl_UserName.Text = UserName;
                    }
                    else
                    {
                        Response.Redirect("UserLogin.aspx");
                    }
                }

                // This page also requires that the user is logged in as an entrepreneur account, check to make sure that they are if not take them back to the user dashboard.
                if (Session["EntrepreneurAccountID"] != null)
                {
                    EntrepreneurID = (int)Session["EntrepreneurAccountID"];

                    // load projects that are owned by the Entrepreneur
                    load_Projects();

                    // load entrepreneur data to display on the page
                    load_EntrepreneurData();

                    // greet account user
                    lbl_Name.Text = AccountName;
                }
                else
                {
                    Response.Redirect("UserDashboard.aspx");
                }
            }
            else
            {
                if (!Page.IsCallback)
                {
                    Server.Transfer("UserLogin.aspx");
                }
                else
                {
                    Response.Redirect("UserLogin.aspx");
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // This a page where the user using it must be identifed and logged in so that we know what master user ID investor accounts created are associated with.
            // This if ... else statement will check to make sure that a session object exists with the information that we are looking for.
            if (Session["ProudSourceUser"] != null)
            {
                UserSessionAccessor Token = new UserSessionAccessor((object[])Session["ProudSourceUser"]);
                {
                    if (Token.UserAuthenticated)
                    {
                        UserName = Token.UserName;
                        UserID   = Token.UserID;
                        Token.Dispose();
                    }
                    else
                    {
                        Response.Redirect("UserLogin.aspx");
                    }
                }
            }
            else
            {
                if (!Page.IsCallback)
                {
                    Server.Transfer("UserLogin.aspx");
                }
                else
                {
                    Response.Redirect("UserLogin.aspx");
                }
            }

            // Add the scripts that allow accessing resources from our server only after the user can be authenticated

            // Get the page's client script and assign it to a ClientScriptManager
            ClientScriptManager cm = Page.ClientScript;

            // Generate a callback reference
            string cbRefernce = cm.GetCallbackEventReference(this, "arg", "EntrepreneurCreated", null);

            // Build the callback script block
            string cbscript = "function CreateEntrepreneur(arg, context) {" + cbRefernce + "};";

            // Register the block
            cm.RegisterClientScriptBlock(Page.GetType(), "CreateEntrepreneur", cbscript, true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ProudSourceUser"] != null)
            {
                UserSessionAccessor Token = new UserSessionAccessor((object[])Session["ProudSourceUser"]);
                {
                    if (Token.UserAuthenticated)
                    {
                        UserID = Token.UserID;
                        Token.Dispose();
                    }
                    else
                    {
                        if (!Page.IsCallback)
                        {
                            Server.Transfer("UserLogin.aspx");
                        }
                        else
                        {
                            Response.Redirect("UserLogin.aspx");
                        }
                    }
                }
            }

            // This page also requires that the user is logged in as an investor account, check to make sure that they are if not take them back to the user dashboard.
            if (Session["InvestorAccountID"] != null)
            {
                InvestorID = (int)Session["InvestorAccountID"];
            }
            else
            {
                Response.Redirect("UserDashboard.aspx");
            }

            // This page requires that the user is logged in as an investor, check to make sure that they are or send them back to the dashboard.
            if (Session["ProjectID"] != null)
            {
                ProjectID = (int)Session["ProjectID"];
            }
            else
            {
                Response.Redirect("UserDashboard.aspx");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // check to see if a client is logged in, try to get thier ID if they are, if not take not of that.
            if (Session["ProudSourceUser"] != null)
            {
                UserSessionAccessor Token = new UserSessionAccessor((object[])Session["ProudSourceUser"]);
                {
                    if (Token.UserAuthenticated)
                    {
                        UserID = Token.UserID;
                        Token.Dispose();
                        UserLoggedIn = true;
                    }
                    else
                    {
                        UserID       = -1;
                        UserLoggedIn = false;
                    }
                }
            }
            else
            {
                UserID       = -1;
                UserLoggedIn = false;
            }

            // check to see if client is logged in as an Investor.
            if (Session["InvestorAccountID"] != null)
            {
                InvestorID       = (int)Session["InvestorAccountID"];
                InvestorLoggedIn = true;
            }
            else
            {
                InvestorID       = -1;
                InvestorLoggedIn = false;
            }

            // check to see if client is logged in as an Entrepreneur.
            if (Session["EntrepreneurAccountID"] != null)
            {
                EntrepreneurID       = (int)Session["EntrepreneurAccountID"];
                EntrepreneurLoggedIn = true;
            }
            else
            {
                EntrepreneurID       = -1;
                EntrepreneurLoggedIn = false;
            }

            // load ProjectID in from data stored in context data.
            ProjectDS = (DataSet)HttpContext.Current.Items["Project"];
            try
            {
                ProjectID = (int)ProjectDS.Tables[0].Rows[0]["project_master_id"];
            }
            catch (Exception k)
            {
                throw new HttpException(404, "Not found");
            }

            // check to see if client is Entrepreneur owner.
            if (EntrepreneurID == (int)ProjectDS.Tables[0].Rows[0]["entrepreneur_master_id"])
            {
                EntrepreneurOwner = true;
                Session.Add("ProjectID", ProjectID);
            }
            else
            {
                EntrepreneurOwner = false;
            }

            // Now handle what controls will be shown on the page and what will not
            load_investor_page_elements();
            load_entrepreneur_page_elements();

            // load contents of controls that display information about this project
            load_ProjectDetails();
        }