Esempio n. 1
0
        private void btn1_Click(object sender, EventArgs e)
        {
            PupilDBAccess      PDBAccess = new PupilDBAccess(db);
            BookingDBAccess    BDBAccess = new BookingDBAccess(db);
            InstrumentDBAccess IDBAccess = new InstrumentDBAccess(db);
            List <Pupil>       pupils    = new List <Pupil>();
            Pupil Selected = new Pupil();

            if (string.IsNullOrWhiteSpace(txtBoxID.Text))
            {
                pupils = PDBAccess.getPupilByPupilName(txtBoxName.Text);
            }

            else
            {
                Selected = PDBAccess.getPupilByPupilNo(Convert.ToInt32(txtBoxID.Text));
                pupils.Add(Selected);
            }

            CreateTableResults(pupils);
        }
Esempio n. 2
0
        private void btn1_Click(object sender, EventArgs e)
        {
            //Searches pupil by either pupilNo or LastName
            PupilDBAccess pupilAccess = new PupilDBAccess(db);
            List <Pupil>  pupils      = new List <Pupil>();

            if (string.IsNullOrWhiteSpace(PupilNotxt.Text))
            {
                pupils = pupilAccess.getPupilByPupilName(Nametxt.Text);
            }
            else
            {
                Selected = pupilAccess.getPupilByPupilNo(Convert.ToInt32(PupilNotxt.Text));
                pupils.Add(Selected);
            }
            // Creates table with pupil information
            table = new DataTable();
            table.Columns.Add("PupilNo");
            table.Columns.Add("First Name");
            table.Columns.Add("Last Name");
            addpupil(pupils);
        }