//button1Click is for starting search
        private void button1_Click(object sender, EventArgs e)
        {
            //clearing text field on another search
            errorMessage.Text      = "";
            cancel_message.Visible = false;
            resFoundPanel.Visible  = false;
            //testing for ints
            int i;

            if (!int.TryParse(confirmationNumTextbox.Text, out i))
            {
                errorMessage.Text = "Please enter a number";
            }
            else
            {
                int result = Int32.Parse(confirmationNumTextbox.Text);
                cancelRes.setConfirmNum(result);
                //makes call and returns boolean if res exists
                if (cancelRes.checkRes(cancelRes.getConfirmNum()))
                {
                    //checking to make sure they give at least 2 days notice
                    TimeSpan ts         = DateTime.Parse(cancelRes.getDate()).Subtract(DateTime.Now);
                    int      daysBefore = ts.Days + 1;
                    if (daysBefore < 2)
                    {
                        errorMessage.Text = "Cannot cancel, you must \n give at least 2 days notice \n before canceling reservation";
                        return;
                    }
                    resFoundPanel.Visible = true;
                    dateTextBox.Text      = cancelRes.getDate();
                    eventTextbox.Text     = cancelRes.getEvent();
                }
                else
                {
                    resFoundPanel.Visible = false;
                    errorMessage.Text     = "Reservation not found";
                }
            }
        }
Пример #2
0
        //member payment
        private void button2_Click(object sender, EventArgs e)
        {
            memberConfirmNumber.Text = "";
            int i;

            if (!int.TryParse(memIdTextbox.Text, out i) || memIdTextbox.Text.Length == 0)
            {
                memberConfirmNumber.Visible = true;
                memberConfirmNumber.Text    = "Please enter a number";
            }
            else
            {
                int result = Int32.Parse(memIdTextbox.Text);
                memberConfirmNumber.Visible = true;
                if (makePayment.checkMembership(result))
                {
                    memberConfirmNumber.Text = "Found";
                    makePayment.setMemberID(result);
                    makePayment.confirmOrderMember(makePayment.getPlay());
                    memberConfirm.Visible    = true;
                    memberConfirmNumber.Text = "Your Confirmation Number Is: " + makePayment.getConfirmNum();

                    nonMemPanel.Visible    = false;
                    usedSavePayBtn.Visible = false;
                    memSeats.Visible       = true;
                    memPrice.Visible       = true;
                    label7.Visible         = true;
                    label8.Visible         = true;
                    memPrice.Text          = "Total: $" + (makePayment.gettPrice() - (makePayment.gettPrice() * .10));
                    memSeats.Text          = ("Your Seats Are: " + makePayment.getSeat());
                    label8.Text            = (makePayment.gettPrice() * .10).ToString();
                }
                else
                {
                    memberConfirmNumber.Text = "Account not found";
                }
            }
        }