Exemplo n.º 1
0
        private void btnGetCar_Click(object sender, EventArgs e)
        {
            int id = int.Parse(tbxId.Text);

            Car car = _client.GetCar(id);

            tbxId.Text     = car.Id.ToString();
            tbxVendor.Text = car.Vendor;
            tbxModel.Text  = car.Model;
            tbxYear.Text   = car.Year.ToString();

            if (car is TruckCar)
            {
                cbxType.SelectedIndex = 1;
                tbxType.Text          = ((TruckCar)car).Capacity.ToString(CultureInfo.GetCultureInfo("en-US"));
            }
            else if (car is PassengerCar)
            {
                cbxType.SelectedIndex = 2;
                tbxType.Text          = ((PassengerCar)car).Passengers.ToString(CultureInfo.GetCultureInfo("en-US"));
            }
            else
            {
                cbxType.SelectedIndex = 0;
                tbxType.Text          = "";
            }
        }