Пример #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //Shows all the data for the parent table which matches the searched for parent name
     if (comboBox1.Text == "Parent Name")
     {
         ParentDBAccess pdba = new ParentDBAccess(db);
         string         name = searchBox.Text;
         createTable(pdba.SelectAllParentsWhereName(name));
     }
     //Shows all the data for the parent table which matches the searched for parent town
     else if (comboBox1.Text == "Town")
     {
         ParentDBAccess pdba     = new ParentDBAccess(db);
         string         townName = searchBox.Text;
         createTable(pdba.SelectAllParentsWhereTown(townName));
     }
     //Shows all the data for the parent table when the 'View' button is clicked
     else if (comboBox1.Text == "Show All")
     {
         ParentDBAccess pdba = new ParentDBAccess(db);
         createTable(pdba.SelectAllParents());
     }
     //If a problem arises, display this error message
     else
     {
         MessageBox.Show("ERROR");
         this.Hide();
         new MainApp(db).Show();
     }
 }
Пример #2
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            //Create an object of type ParentDBAccess, this allows the user to get access to the methods
            ParentDBAccess pdba = new ParentDBAccess(db);

            //Update the table tp show all the parents
            createTableToChooseParents(pdba.SelectAllParents());
        }
Пример #3
0
        public SelectAParentForm(Database db)
        {
            InitializeComponent();
            CenterToScreen();
            this.FormBorderStyle = FormBorderStyle.None;
            Region  = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
            this.db = db;
            ParentDBAccess pdba = new ParentDBAccess(db);

            createTableToChooseParents(pdba.SelectAllParents());
        }
Пример #4
0
        //When the user changes the selected combobox index
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Clear the data in the second combobox
            comboBox2.Items.Clear();
            //Switch the selected table
            switch (comboBox1.Text)
            {
            //If the selected table is this value: populate the second combobox with these values
            case "Bookings": comboBox2.Items.Add("Name"); comboBox2.Items.Add("Paid"); InnerJoinDBAccess booking = new InnerJoinDBAccess(db); createTableToShowBookings(booking.GetAllBooking()); break;

            case "Bus": comboBox2.Items.Add("Driver"); comboBox2.Items.Add("Route"); comboBox2.Items.Add("Time"); BusDBAccess BusdbAcess = new BusDBAccess(db); createTableToShowBus(BusdbAcess.getAllBus()); break;

            case "Cancellation": comboBox2.Items.Add("Reason"); CancellationDBAccess cdba = new CancellationDBAccess(db); CreateTableToShowCancellation(cdba.getAllCancellation()); break;

            case "Children": comboBox2.Items.Add("Child Name"); comboBox2.Items.Add("Age"); comboBox2.Items.Add("Medical Problems"); ChildrenDBAccess chdba = new ChildrenDBAccess(db); CreateTableToShowChildren(chdba.GetAllChildren()); break; break;

            case "Parent": comboBox2.Items.Add("Parent Name"); comboBox2.Items.Add("Parent Phone"); comboBox2.Items.Add("Parent Email"); comboBox2.Items.Add("Parent Address"); comboBox2.Items.Add("Parent Occupation"); ParentDBAccess pdba = new ParentDBAccess(db); CreateTableToShowParent(pdba.SelectAllParents()); break;

            case "Schools": comboBox2.Items.Add("School Name"); comboBox2.Items.Add("School Location"); comboBox2.Items.Add("School Number"); SchoolDBAccess sdba = new SchoolDBAccess(db); CreateTableToShowSchools(sdba.getAllSchools()); break;

            case "Staff": comboBox2.Items.Add("Staff Name"); comboBox2.Items.Add("Staff Voluntary"); StaffDBAccess stdba = new StaffDBAccess(db); CreateTableToShowStaff(stdba.getAllStaff()); break;

            case "Parent & Child": comboBox2.Items.Add("Parent Name"); comboBox2.Items.Add("Child Name"); InnerJoinDBAccess injdba = new InnerJoinDBAccess(db); CreateTableToShowChildAndParent(injdba.GetChildAndParent()); break;
            }
        }
Пример #5
0
        //The constrcutor has the database and selected table passed in
        public SearchForm(Database db, string WhichTable)
        {
            InitializeComponent();
            this.db = db;
            //Assign which table is being selected
            Table = WhichTable;
            //Makes border disappear and the form curved
            this.FormBorderStyle = FormBorderStyle.None;
            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
            CenterToScreen();
            //Fill the combo boxes
            InitComboBox();
            comboBox3.Items.Add("=");
            comboBox3.Items.Add(">");
            comboBox3.Items.Add("<");
            comboBox1.Text = Table;

            //Check the selected table
            switch (Table)
            {
            //If it's this table. Fill the grid with data from the chosen database table
            case "Parent & Child": InnerJoinDBAccess parentChild = new InnerJoinDBAccess(db); CreateTableToShowChildAndParent(parentChild.GetChildAndParent()); break;

            case "Bookings": InnerJoinDBAccess booking = new InnerJoinDBAccess(db); createTableToShowBookings(booking.GetAllBooking()); break;

            case "Bus": BusDBAccess BusdbAcess = new BusDBAccess(db); createTableToShowBus(BusdbAcess.getAllBus()); break;

            case "Cancellation": CancellationDBAccess cdba = new CancellationDBAccess(db); CreateTableToShowCancellation(cdba.getAllCancellation()); break;

            case "Children": ChildrenDBAccess chdba = new ChildrenDBAccess(db); CreateTableToShowChildren(chdba.GetAllChildren()); break;

            case "Parent": ParentDBAccess pdba = new ParentDBAccess(db); CreateTableToShowParent(pdba.SelectAllParents()); break;

            case "Schools": SchoolDBAccess sdba = new SchoolDBAccess(db); CreateTableToShowSchools(sdba.getAllSchools()); break;

            case "Staff": StaffDBAccess stdba = new StaffDBAccess(db); CreateTableToShowStaff(stdba.getAllStaff()); break;
            }
        }
Пример #6
0
        //When the label is clicked, the table will update to show all the data for parents

        private void label7_Click(object sender, EventArgs e)
        {
            ParentDBAccess pdba = new ParentDBAccess(db);

            createTableShowAllParents(pdba.SelectAllParents());
        }