private void DisplayRecords()
        {
            string Username            = Session["user"].ToString();
            clsPersonCollection Record = new clsPersonCollection(Username);

            GVPerson.DataSource = Record.PersonList;
            GVPerson.DataBind();
        }
        protected void btnFind_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;

            persons = new clsPersonCollection();
            persons.FilterByName(username);
            GenerateTable();
        }
        protected void DeleteRecord()
        {
            //new instance of clsPersonCollection
            clsPersonCollection Record = new clsPersonCollection();

            //get the number of the Person to be deleted from the session object
            PersonID = Convert.ToInt32(Session["PersonID"]);
            //find the record
            Record.ThisPerson.Find(PersonID);
            //delete the record
            Record.Delete();
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            clsPersonCollection Person = new clsPersonCollection();
            //validation here
            Boolean OK = Person.ThisPerson.Valid(txtFirstname.Text, txtLastName.Text, txtDob.Text, txtAddress.Text, txtPostcode.Text, txtTown.Text, txtCountry.Text, txtTeleNo.Text, txtEmail.Text, txtUsername.Text);
            //set some vars for the txt elements
            string Firstname = txtFirstname.Text;
            string Lastname  = txtLastName.Text;
            string DoB       = txtDob.Text;
            string Address   = txtAddress.Text;
            string Postcode  = txtPostcode.Text;
            string Town      = txtTown.Text;
            string Country   = txtCountry.Text;
            string TeleNo    = txtTeleNo.Text;
            string Email     = txtEmail.Text;
            string Username  = txtUsername.Text;

            //if the data is OK add it to the object
            if (OK == true)
            {
                Person.ThisPerson.FirstName = Firstname;
                Person.ThisPerson.LastName  = Lastname;
                Person.ThisPerson.DoB       = DoB;
                Person.ThisPerson.Address   = Address;
                Person.ThisPerson.Postcode  = Postcode;
                Person.ThisPerson.Town      = Town;
                Person.ThisPerson.Country   = Country;
                Person.ThisPerson.TeleNo    = TeleNo;
                Person.ThisPerson.Email     = Email;
                Person.ThisPerson.Username  = Username;
                Person.Add();
                //refresh the page
                Response.Redirect("Users.aspx");
                //success
                lblValid.Text = "Success";
            }
            else
            {
                //report an error
                lblValid.Text = "Please try again";
            }
        }
        private void DisplayUsers()
        {
            clsPersonCollection PersonList = new clsPersonCollection();
            Int32 Index       = 0;
            Int32 RecordCount = PersonList.Count;

            while (Index < RecordCount)
            {
                Response.Write(PersonList.PersonList[Index].PersonID);
                Response.Write(PersonList.PersonList[Index].FirstName);
                Response.Write(PersonList.PersonList[Index].LastName);
                Response.Write(PersonList.PersonList[Index].DoB);
                Response.Write(PersonList.PersonList[Index].Address);
                Response.Write(PersonList.PersonList[Index].Postcode);
                Response.Write(PersonList.PersonList[Index].Town);
                Response.Write(PersonList.PersonList[Index].Country);
                Response.Write(PersonList.PersonList[Index].TeleNo);
                Response.Write(PersonList.PersonList[Index].Email);
                //increment the index
                Index++;
            }
        }
        protected void btnReset_Click(object sender, EventArgs e)
        {
            clsPersonCollection Person = new clsPersonCollection();

            GenerateTable();
        }