コード例 #1
0
        protected void LinkButtonbuyClick(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            if (!Basket.IsUserExist(Session["iduser"].ToString()))
            {
                Basket.AddUser(Session["iduser"].ToString());
            }

            try
            {
                Basket.AddUserWare(Session["iduser"].ToString(), btn.CommandArgument);
                ShowMessage("Ware added to basket");
            }
            catch (ArgumentOutOfRangeException)
            {
                ShowMessage("you have already bought this product");
                btn.Visible = false;
            }
            btn.Visible = false;
        }