예제 #1
0
        private void showCarNameAndIdButton_Click(object sender, EventArgs e)
        {
            string roadpermitserch;

            roadpermitserch = showRoadPermitTextBox.Text;
            string        connectionString = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();

            string     queryString = "SELECT  FROM roadInformationTable WHERE roadPermit='" + roadpermitserch + "'";
            SqlCommand command     = new SqlCommand(queryString, connection);

            command.ExecuteNonQuery();
            List <roadPermitClass> rodPer  = new List <roadPermitClass>();
            roadInformationGetway  roadGet = new roadInformationGetway();

            rodPer = roadGet.GetRoadInformation();
            carNameAndIdlistView.Items.Clear();
            foreach (roadPermitClass roadObj in rodPer)
            {
                ListViewItem roadList = new ListViewItem(roadObj.CarId);
                roadList.SubItems.Add(roadObj.CarLisenceNumber);
                carNameAndIdlistView.Items.Add(roadList);
            }
            connection.Close();
        }
예제 #2
0
        private void roadSaveButton_Click(object sender, EventArgs e)
        {
            roadPermitClass roadPermitObj = new roadPermitClass();

            roadPermitObj.TypeOfCar        = typeOfCarComboBox.Text;
            roadPermitObj.CarId            = carIdTextBox.Text;
            roadPermitObj.CarLisenceNumber = carLisenceNumbertextBox.Text;
            roadPermitObj.RoadPermit       = carRoadPermitTextBox.Text;
            roadInformationGetway getway = new roadInformationGetway();

            getway.saveRoadInformation(roadPermitObj);

            MessageBox.Show("inforMation Save");
        }