Exemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            //shows the data for the staff table which matches the searched for staff name
            if (comboBox1.Text == "Staff Name")
            {
                StaffDBAccess sdba         = new StaffDBAccess(db);
                string        selectedName = searchBox.Text;
                createTable(sdba.GetStaffByName(selectedName));
            }
            //Shows all the data for the staff table when the 'View' button is clicked
            if (comboBox1.Text == "Show All")
            {
                StaffDBAccess sdba = new StaffDBAccess(db);
                createTable(sdba.getAllStaff());
            }
            //Shows the data for the staff table which mathes whether the the user is searching for voluntary or non-voluntary staff
            if (comboBox1.Text == "Voluntary")
            {
                bool          decider = false;
                StaffDBAccess sdba    = new StaffDBAccess(db);
                switch (searchBox.Text)
                {
                case "False": decider = false; break;

                case "True": decider = true; break;
                }
                createTable(sdba.getStaffByVoluntary(decider));
            }
        }
Exemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                //If the user selects show all, display all the entries for the Bus Booking
                if (comboBox1.Text == "Show All")
                {
                    BusBookingDBAccess bdba = new BusBookingDBAccess(db);
                    createTableToShowAllBusBooking(bdba.getAllBusBooking());
                    SelectedTable = "";
                }

                //If the user searchs for a Booking ID, Show all the entries where their entered ID matches ones in the database
                else if (comboBox1.Text == "Booking ID")
                {
                    BusBookingDBAccess bdba = new BusBookingDBAccess(db);
                    createTableToShowAllBusBooking(bdba.SelectWhereBookingID(Convert.ToInt32(textBox1.Text)));
                    SelectedTable = "BusBooking";
                }
                //If the user searchs for a Driver Name, Show all the entries where their entered name matches the one stored in the database
                else if (comboBox1.Text == "Driver Name")
                {
                    BusDBAccess bdba       = new BusDBAccess(db);
                    string      driverName = textBox1.Text;
                    createTableToShowBus(bdba.getWhereDriverIs(driverName));
                    SelectedTable = "Bus";
                }
                //If the user searchs for a Staff Name, Show all the entries where their entered name matches the one stored in the database
                else if (comboBox1.Text == "Staff Name")
                {
                    StaffDBAccess sdba      = new StaffDBAccess(db);
                    string        staffName = textBox1.Text;
                    createTableToShowStaff(sdba.GetStaffByName(staffName));
                    SelectedTable = "Staff";
                }
            }

            catch { }
        }