Ejemplo n.º 1
0
        private void addFavourite(int shopID)
        {
            string userName = Request.Cookies["user"].Value;

            db = new DbLayer();
            int nMaxFavourite = db.getMaxFavouriteID();

            db.insertFavourite(nMaxFavourite, userName, shopID);
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            string userName = Request.Cookies["user"].Value;

            db = new DbLayer();
            int nMaxFavourite = db.getMaxFavouriteID() + 1;

            if (!db.insertFavourite(nMaxFavourite, userName, int.Parse(btn.CommandArgument.ToString())))
            {
                string script = "alert(\"Already Add Favourite!\");";
                ScriptManager.RegisterStartupScript(this, GetType(),
                                                    "ServerControlScript", script, true);
                return;
            }

            Response.Redirect("Search.aspx");
        }