Example #1
0
        protected void Pay(object sender, EventArgs e)
        {
            if (Valid())
            {
                CreditCardValidator cardValidator = new CreditCardValidator();
                if (cardValidator.ValidMod10(CardNumber.Text))
                {
                    ErrorMsg.Text = "";
                    int        userId      = (int)Session["id"];
                    int        screeningId = (int)Session["screening_id"];
                    List <int> seats       = (List <int>)Session["seats"];

                    foreach (int seat in seats)
                    {
                        Database.InsertTicket(screeningId, seat, userId);
                    }
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    ErrorMsg.Text = "Invalid input";
                }
            }
            else
            {
                ErrorMsg.Text = "Invalid input";
            }
        }