/// <summary>
        /// Login event handler that allows the username and pass to be checked
        /// </summary>
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string field = Login1.UserName.ToString();
            string pass  = Login1.Password.ToString();

            try
            {
                using (MovieStoreEDM context = new MovieStoreEDM())
                {
                    var user = context.Customers.FirstOrDefault(u => u.Name == field);


                    if (user != null)
                    {
                        if (user.Password == pass)
                        {
                            Session["Username"] = user.Name;
                            Login1.FailureText  = "Pass";
                            Response.Redirect("MovieDirectory.aspx");
                        }
                        else
                        {
                            Login1.FailureText = "Wrong Password";
                        }
                    }
                    else
                    {
                        Login1.FailureText = "Wrong Username";
                    }
                }
            }
            catch
            {
                Login1.FailureText = "Error";
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            string field = TextBox1.Text;

            try
            {
                using (MovieStoreEDM context = new MovieStoreEDM())
                {
                    var user = context.Coupons.FirstOrDefault(u => u.Code == field);


                    if (user != null)
                    {
                        if (user.Code == field)
                        {
                            discount        = Convert.ToInt32(user.PercentValue);
                            sum            -= sum * (discount / 100);
                            TotalLabel.Text = Convert.ToString(sum);
                            Label1.Text     = "Worked";
                        }
                        else
                        {
                            Label1.Text = "Wrong Code";
                        }
                    }
                    else
                    {
                        Label1.Text = "Wrong Code";
                    }
                }
            }
            catch
            {
                //Label1.Text = "Error";
            }
        }