public List <PersonInformationClass> GetPersonInformation()
        {
            PersonInformationClass        personinObj = null;
            List <PersonInformationClass> personses   = new List <PersonInformationClass>();
            string        connectionString            = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();

            string        queryString = "SELECT * FROM personInformationTable";
            SqlCommand    command     = new SqlCommand(queryString, connection);
            SqlDataReader reader      = command.ExecuteReader();

            while (reader.Read())
            {
                personinObj = new PersonInformationClass();
                personinObj.PersonNumber       = (reader["personNumber"]).ToString();
                personinObj.PersonLastName     = (reader["personLastName"]).ToString();
                personinObj.PersonFirstName    = (reader["personFirstName"]).ToString();
                personinObj.PersonAddress      = (reader["personAddress"]).ToString();
                personinObj.PersonMobailNumber = (reader["personMobailNumber"]).ToString();
                personinObj.PersonPostalCode   = (reader["personPostalCode"]).ToString();
                personinObj.Date = (reader["date"]).ToString();

                personses.Add(personinObj);
            }
            connection.Close();
            return(personses);
        }
        public void savePersonInformation(PersonInformationClass personinformationObj)
        {
            string        connectionString = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();

            string     insertString = "INSERT INTO personInformationTable VALUES('" + personinformationObj.PersonNumber + "','" + personinformationObj.PersonLastName + "','" + personinformationObj.PersonFirstName + "','" + personinformationObj.PersonAddress + "','" + personinformationObj.PersonMobailNumber + "','" + personinformationObj.PersonPostalCode + "','" + personinformationObj.Date + "')";
            SqlCommand command      = new SqlCommand(insertString, connection);

            command.ExecuteNonQuery();
            connection.Close();
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            PersonInformationClass personObj = new PersonInformationClass();

            personObj.PersonNumber       = personNumberTextBox.Text;
            personObj.PersonLastName     = personLastNameTextBox.Text;
            personObj.PersonFirstName    = personFirstNameTextBox.Text;
            personObj.PersonAddress      = personAddressTextBox.Text;
            personObj.PersonMobailNumber = personMobailNumberTextBox.Text;
            personObj.PersonPostalCode   = PersonPostalCodeTextBox.Text;
            personObj.Date = personDateTimePicker1.Text;

            PersonInformationGetway personseObj = new PersonInformationGetway();

            personseObj.savePersonInformation(personObj);


            MessageBox.Show("person Information save Correctly");
        }
        private void personSarchButton_Click(object sender, EventArgs e)
        {
            string personMobailNum;

            personMobailNum = sarchPersonTextBox.Text;
            PersonInformationClass personObj = null;
            string        connectionString   = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection         = new SqlConnection(connectionString);

            connection.Open();

            string        queryString = "SELECT * FROM personInformationTable WHERE personMobailNumber='" + personMobailNum + "'";
            SqlCommand    command     = new SqlCommand(queryString, connection);
            SqlDataReader reader      = command.ExecuteReader();

            while (reader.Read())
            {
                personObj = new PersonInformationClass();
                personObj.PersonNumber         = (reader["personNumber"]).ToString();
                personNumberTextBox.Text       = (reader["personNumber"]).ToString();
                personObj.PersonLastName       = (reader["personLastName"]).ToString();
                personLastNameTextBox.Text     = (reader["personLastName"]).ToString();
                personObj.PersonFirstName      = (reader["personFirstName"]).ToString();
                personFirstNameTextBox.Text    = (reader["personFirstName"]).ToString();
                personObj.PersonAddress        = (reader["personAddress"]).ToString();
                personAddressTextBox.Text      = (reader["personAddress"]).ToString();
                personObj.PersonMobailNumber   = (reader["personMobailNumber"]).ToString();
                personMobailNumberTextBox.Text = (reader["personMobailNumber"]).ToString();
                personObj.PersonPostalCode     = (reader["personPostalCode"]).ToString();
                PersonPostalCodeTextBox.Text   = (reader["personPostalCode"]).ToString();
                personObj.Date             = (reader["date"]).ToString();
                personDateTimePicker1.Text = (reader["date"]).ToString();
            }
            MessageBox.Show("personNumber=" + personObj.PersonNumber + "\n personLastName=" + personObj.PersonLastName + "personFirstName" + personObj.PersonFirstName + "\n personAddress=" + personObj.PersonAddress + "\n personMobailNumber=" + personObj.PersonMobailNumber);

            connection.Close();
        }