Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageVariablesCollection vars = new PageVariablesCollection();

        vars.Add(new RequestVariable("message", typeof(Guid), true, PostMethods.Get));

        try
        {
            this.ValidateVariables(vars);
        }
        catch
        {
            Response.Redirect("~/home.aspx");
        }

        Guid messageId = (Guid)vars["message"].Value;

        switch (messageId.ToInt())
        {
        case 1:
            Page.Title = "Registration Submitted Successfully";
            this.MessageRegSubmitted.Visible = true;
            break;

        case 2:
            Page.Title = "Registration Confirmed";
            this.MessageRegComplete.Visible = true;
            break;
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //do not execute on postback
        if (IsPostBack)
        {
            return;
        }

        //verify page variables
        PageVariablesCollection vars = new PageVariablesCollection();

        vars.Add(new RequestVariable("q", typeof(int), true));

        Page.ValidateVariables(vars);

        //check for request of a single quote
        try
        {
            _quoteId = (int)vars["q"].Value;
            if (_quoteId == 0)
            {
                _qotd = true;
            }

            LoadSingleQuote(_quoteId);

            //show the action bar if the user viewing is a logged in admin
            if (Authenticator.IsUserLoggedIn())
            {
                if (Authenticator.GetUser().Role == ContributorRoles.Admin)
                {
                    PanelQuoteActions.Visible = true;
                }
            }
        }
        catch
        {
            GetRandomQuote();
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageVariablesCollection vars = new PageVariablesCollection();

        vars.Add(new RequestVariable("confirm", typeof(Guid), false, PostMethods.Get));
        vars.Add(new RequestVariable("u", typeof(Guid), false, PostMethods.Get));
        this.ValidateVariables(vars);

        try
        {
            if (vars["confirm"].HasValue)
            {
                //check to make sure this is a legit conf number
                Guid conf = (Guid)vars["confirm"].Value;
                if (17760921 != conf.ToInt())
                {
                    throw new Exception();
                }

                if (!vars["u"].HasValue)
                {
                    throw new Exception();
                }
                else
                {
                    Guid userId = (Guid)vars["u"].Value;
                    CoreDataObjects.ContributorsRow row = contributors.GetById(userId)[0];
                    row.Active = true;
                    contributors.Update(row);
                    Response.Redirect(string.Format("~/thank-you.aspx?message={0}", 2.ToGuid()));
                }
            }
        }
        catch
        {
            lblMessage.Text          = "An error occured because a required value was not passed.";
            RegistrationForm.Visible = false;
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool   saveSearch = false;
        string searchText = string.Empty;

        //get the text in the search box
        searchBox = (TextBox)FindControl("ctl00$txtSearchBox");

        //validate page vars
        PageVariablesCollection vars = new PageVariablesCollection();

        vars.Add(new RequestVariable("p", typeof(int), false));
        vars.Add(new RequestVariable("founderId", typeof(int), false));
        vars.Add(new RequestVariable("searchType", typeof(SearchTypes), true));
        vars.Add(new RequestVariable("sort", typeof(bool), false));

        Page.ValidateVariables(vars);

        //the page variable (browsing pages with a result set)
        //_searchType = (SearchTypes)Enum.Parse(typeof(SearchTypes), vars["type"].Value.ToString());
        _searchType = (SearchTypes)vars["searchType"].Value;
        _sort       = vars["sort"].HasValue ? (bool)vars["sort"].Value : false;

        //check for page variable
        if (vars["p"].HasValue)
        {
            _page = (int)vars["p"].Value;
        }


        switch (_searchType)
        {
        case SearchTypes.Founders:

            //check to see if a founderId is supplied (i.e. the search is for all things related to a founder)
            if (vars["founderId"].HasValue)
            {
                _founderId = (int)vars["founderId"].Value;
            }

            //load founder quotes
            LoadQuotesByFounder(_founderId);

            PanelFounder.Visible = true;
            PanelFounderQuotesSummary.Visible = true;
            PanelSearchSummary.Visible        = false;

            break;

        case SearchTypes.Quotes:
            //upon search postback (the user searched in the search box from this page)
            if (IsPostBack)
            {
                this.SearchQuotes(searchBox.Text, true);
            }
            //the request is an initial one, or from another page
            else
            {
                //a supplied search string was given
                if (Request.QueryString["SearchText"] != null)
                {
                    //find out if this was a custom search
                    if (Request.QueryString["Custom"] != null)
                    {
                        saveSearch = (Request.QueryString["Custom"] == "true") ? true : false;
                    }

                    //search
                    this.SearchQuotes(Request.QueryString["SearchText"], saveSearch);
                }
                //no search string -- redirect back to home
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
            break;

        case SearchTypes.Documents:
            //do nothing
            break;
        }
    }