Esempio n. 1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Close();
            ViewAll openViewAll = new ViewAll();

            openViewAll.Show();
        }
Esempio n. 2
0
        private void btnLogout_Click(object sender, EventArgs e)
        {
            ViewAll.LoginInfo.UserID   = "";
            ViewAll.LoginInfo.TourID   = "";
            ViewAll.LoginInfo.UserRole = "";
            ViewAll.LoginInfo.FullName = "";
            this.Close();
            ViewAll openViewAll = new ViewAll();

            openViewAll.Show();
        }
Esempio n. 3
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (ViewAll.LoginInfo.UserRole == "T")
     {
         this.Close();
         ViewAll openViewAll = new ViewAll();
         openViewAll.Show();
     }
     else if (ViewAll.LoginInfo.UserRole == "TG")
     {
         this.Close();
         TourGuide_ManageCreateTour openManageTour = new TourGuide_ManageCreateTour();
         openManageTour.Show();
     }
 }
Esempio n. 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            this.Hide();
            Login openLoginForm = new Login();

            openLoginForm.ShowDialog();
            if (LoginInfo.UserRole == "TG")
            {
                this.Hide();
                TourGuide_ManageCreateTour openTourGuide = new TourGuide_ManageCreateTour();
                openTourGuide.Show();
            }
            else if (LoginInfo.UserRole == "S")
            {
                this.Hide();
                SysAdmin_ManageUserTour openSystemAdmin = new SysAdmin_ManageUserTour();
                openSystemAdmin.Show();
            }
            else if (LoginInfo.UserRole == "T")
            {
                ViewAll openViewAllForm = new ViewAll();
                openViewAllForm.Show();
            }
        }
Esempio n. 5
0
        private void btnPayment_Click(object sender, EventArgs e)
        {
            string   cardName = txtCardName.Text;
            string   cardNum  = txtCardNum.ToString();
            string   month    = txtMonth.Text;
            string   year     = txtYear.Text;
            string   cvv      = txtCvv.Text;
            int      monthInt;
            int      yearInt;
            int      cvvInt;
            string   cvvLength  = txtCvv.Text;
            DateTime dtNow      = DateTime.Now;
            int      yearNow    = dtNow.Year;
            int      monthNow   = dtNow.Month;
            bool     checkMonth = int.TryParse(month, out monthInt);
            bool     checkYear  = int.TryParse(year, out yearInt);
            bool     checkCvv   = int.TryParse(cvv, out cvvInt);

            if (cardName == "")
            {
                MessageBox.Show("Please enter Card Name");
            }
            else if (cardNum.Length < 17 || cardNum == null)
            {
                MessageBox.Show("Invalid Card Number");
            }
            else if (checkMonth == false || checkYear == false || checkCvv == false)
            {
                MessageBox.Show("Expiry Date and CVV must be in numeric");
            }
            else if (checkMonth == true && checkYear == true && checkCvv == true)
            {
                if (monthInt > 12 || monthInt < 1)
                {
                    MessageBox.Show("Invalid Expiry Month");
                }

                else if (yearInt < yearNow)
                {
                    MessageBox.Show("Invalid Expiry Date");
                }
                else if (yearInt == yearNow)
                {
                    if (monthInt < monthNow)
                    {
                        MessageBox.Show("Invalid Expiry Date");
                    }
                }
                else if (cvvLength.Length < 3 || cvvInt > 1000 || cvvInt < 0)
                {
                    MessageBox.Show("Invalid CVV");
                }
                else
                {
                    string transID = "T";
                    for (int i = 0; i < 7; i++)
                    {
                        transID = transID + Convert.ToString(random.Next(1, 9));
                    }

                    SqlConnection con = new SqlConnection(connectionString);
                    string        sqlRetrieveCountry = "INSERT INTO TOURTRANSACTION (TransID, UserID, TourID, FromDate, Pax, ToDate, TStatus) VALUES (@transid, @userid, @tourid, @fromdate, @pax, @todate, @tstatus)";
                    SqlCommand    cm = new SqlCommand(sqlRetrieveCountry, con);
                    con.Open();
                    cm.Parameters.AddWithValue("@transid", transID.ToString());
                    cm.Parameters.AddWithValue("@userid", ViewAll.LoginInfo.UserID);
                    cm.Parameters.AddWithValue("@tourid", ViewAll.LoginInfo.TourID);
                    cm.Parameters.AddWithValue("@fromdate", Convert.ToDateTime(ViewTour.BookTour.tourStartDate).ToString("MM/dd/yyy"));
                    cm.Parameters.AddWithValue("@todate", Convert.ToDateTime(ViewTour.BookTour.tourEndDate).ToString("MM/dd/yyy"));
                    cm.Parameters.AddWithValue("@pax", ViewTour.BookTour.pax);
                    cm.Parameters.AddWithValue("@tstatus", "Pending");

                    cm.ExecuteNonQuery();
                    con.Close();
                    MessageBox.Show("Tour Booked, Enjoy!");
                    ViewAll openViewAll = new ViewAll();
                    openViewAll.Show();
                    this.Hide();
                }
            }
        }