Exemplo n.º 1
0
 protected void AddToCart_Click(object sender, EventArgs e)
 {
     if (Session["user"] != null)
     {
         LinkButton b        = sender as LinkButton;
         string     Quantity = Page.Request.Form[b.ToolTip.ToString()].ToString();
         bool       flag     = true;
         if (string.IsNullOrWhiteSpace(Quantity))
         {
             Message.CssClass = "alert alert-danger";
             Message.Text     = "Please enter some quantity!";
         }
         if (flag)
         {
             int   ret;
             myDAL objmyDAl = new myDAL();
             int   done     = 0;
             ret = objmyDAl.AddItemToCart_DAL(Session["user"].ToString(), b.ToolTip.ToString(), Quantity, ref done);
             if (ret == 1)
             {
                 if (done == 1)
                 {
                     Response.Redirect("./Concerts.aspx");
                 }
                 else
                 {
                     Message.Text = "Not enough tickets";
                     //Show message for no enough tickets
                 }
             }
             else
             {
                 Message.CssClass = "alert alert-danger";
                 Message.Text     = "Please enter an appropriate numeric figure in quantity";
                 //execption;
             }
         }
     }
     else
     {
         Response.Redirect("./Sign_In.aspx");
     }
 }