protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //populating user object
                currentuser = (KahnoUser)Session["localuser"];
                if (currentuser.userid == 0)
                {
                    Response.Redirect("Login.aspx");
                }
                //populating restaurant object
                KahnLib.getRestaurant(currentuser.restaurantno, ref currentRestaurant);
                Session["currentRestaurant"] = currentRestaurant;
                //passing user to the new restaurant screen if they do not have one
                if (currentRestaurant.restaurantID == 0)
                {
                    Response.Redirect("CreateRestaurantForm.aspx");
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            if (!this.IsPostBack)
            {
                TextBox1.Text = currentRestaurant.restaurantname;
                TextBox2.Text = currentRestaurant.phone;
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ////////checking if user is logged in, copy paste on every page, will redirect to login if not logged in and create the user object
            ///Don't use this one yet, we need a better version
            KahnoUser currentuser = new KahnoUser();

            currentuser = (KahnoUser)Session["localuser"];
            if (currentuser.userid == 0)
            {
                Response.Redirect("Login.aspx");
            }

            if (currentuser.restaurantno == 0)
            {
                Response.Redirect("CreateRestaurantForm.aspx");
            }
            if (currentuser.isowner == "n")
            {
                Response.Redirect("Login.aspx");
            }

            ////////////////////////////////////////////////////////////////

            /////////////creatign restaurant object
            ///
            KahnoRestaurant currentRestaurant = new KahnoRestaurant();

            KahnLib.getRestaurant(currentuser.restaurantno, ref currentRestaurant);
            Session["currentRestaurant"] = currentRestaurant;
            //////////////
            //Label3.Text = "Welcome " + currentuser.fname + " Your restaurant is " + currentRestaurant.restaurantname + currentuser.restaurantno + (Int32)Session["RID"];

            Label3.Text = "Welcome " + currentuser.fname + ", owner of " + currentRestaurant.restaurantname + " with restaurant ID: " + (Int32)Session["RID"];
        }
        protected void lnkSelect_Click(object sender, EventArgs e)
        {
            int             restaurantID      = Convert.ToInt32((sender as Button).CommandArgument);
            KahnoRestaurant currentRestaurant = new KahnoRestaurant();

            KahnLib.getRestaurant(restaurantID, ref currentRestaurant);
            Session["currentRestaurant"] = currentRestaurant;

            Session["restaurantID"] = currentRestaurant.restaurantID;
            Response.Redirect("RestaurantMenuPage.aspx");
        }