コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring          = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        PageTitle.InnerText = String.Format(Constant.TITLEFORMAT, "Confirm Participation to Auction Event");

        if (Session["CurrentTab"] == null)
        {
            Session["CurrentTab"] = "2";
        }

        switch (Session["CurrentTab"].ToString())
        {
        case "1": _backUrl = "~/web/auctions/ongoingauctionevents.aspx"; break;

        case "2": _backUrl = "~/web/auctions/upcomingauctionevents.aspx"; break;

        default: _backUrl = "~/web/auctions/upcomingauctionevents.aspx"; break;
        }

        // check user type, if not vendor, redirect to upcoming events page
        if (Session[Constant.SESSION_USERTYPE].ToString() != ((int)Constant.USERTYPE.VENDOR).ToString())
        {
            Response.Redirect(_backUrl);
        }

        // get userid
        _uid = Convert.ToInt32(Session[Constant.SESSION_USERID].ToString());

        // check if auction ref no is provided
        if (!String.IsNullOrEmpty(Request.QueryString["aid"]))
        {
            // if yes, continue
            string q = string.Empty;
            try
            {
                string aid = HttpUtility.UrlDecode(Request.QueryString["aid"]);
                //q = EncryptionHelper.Decrypt(aid.Replace("%PLUS%", "+"));
                q    = FormattingHelper.DecryptQueryString(aid);
                _aid = Convert.ToInt32(q);
            }
            catch
            {
                // redirect to error page
                Response.Redirect(_backUrl);
            }
            Session[Constant.SESSION_AUCTIONREFNO] = q;
            // check if invitation is already still pending
            // if not, display to user status
            // else, continue
            // check if auction's confirmation deadline is not yet reached
            // if already reached, redirect to error page
            // else, continue

            // check if there was error
            if (Session["ERRORMESSAGE"] != null)
            // if yes, display it
            {
                lblError.Text           = Session["ERRORMESSAGE"].ToString().Trim();
                Session["ERRORMESSAGE"] = null;
            }
        }
        else
        {
            // if not, redirect page
            Response.Redirect(_backUrl);
        }
    }