Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Piggy master = (Piggy)this.Master;

            master.ShowLogout = true;

            if (Session["User"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            user = (User)Session["User"];

            if (!IsPostBack)
            {
                searchStatus.Visible       = false;
                search.Visible             = false;
                searchResultsLabel.Visible = false;
                searchKey.Visible          = false;
                searchKeyLabel.Visible     = false;

                // fetch the cookie and views object

                string userViewCookieJson = Request.Cookies[this.user.userName].Value;
                Views  userViews          = new JavaScriptSerializer().Deserialize <Views>(userViewCookieJson);

                if (userViews.MaxViewedRestaurant == String.Empty)
                {
                    MostViewedPanel.Visible = false;
                }

                else
                {
                    // Get id and name from the retrieved string

                    string restaurantIdParam   = userViews.MaxViewedRestaurant.Split('_')[0];
                    string restaurantNameParam = userViews.MaxViewedRestaurant.Split('_')[1];

                    // hlink to the details page

                    MostViewedHLink.Text        = restaurantNameParam;
                    MostViewedHLink.NavigateUrl = String.Format(MostViewedHLink.NavigateUrl, restaurantIdParam, restaurantNameParam);
                }
            }

            header.Text = "Welcome " + user.userName + "!";
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Piggy master = (Piggy)this.Master;

            master.ShowLogout = false;

            if (Session["User"] != null)
            {
                User user = (User)Session["User"];
                isAdmin = user.isAdmin;
            }

            if (IsPostBack)
            {
                return;
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Piggy master = (Piggy)this.Master;

            master.ShowLogout = false;

            if (IsPostBack)
            {
                return;
            }
            if (Request.UrlReferrer != null)
            {
                string previousPage = Request.UrlReferrer.Segments.Skip(1).Take(1).SingleOrDefault();
                if (previousPage == "Register.aspx")
                {
                    Response.Write("<script>alert('Registered successfully!');</script>");
                }
                else if (previousPage == "AdminHomePage.aspx" || previousPage == "Search.aspx")
                {
                    Response.Write("<script>alert(Session Expired, login again.);</script>");
                }
            }
        }