Пример #1
0
        public AddCars(Main m, Cars c, string pt)
        {
            InitializeComponent();
            button3.Visible = false;
            List <Clients> list = Clients.GetAllClients();

            for (int i = 0; i < list.Count; i++)
            {
                comboBox1.Items.Add(list[i].surname);
            }
            List <Model> list2 = Cars.GetModels();

            for (int i = 0; i < list2.Count; i++)
            {
                comboBox2.Items.Add(list2[i].name);
            }

            this.m  = m;
            this.c  = c;
            this.pt = pt;;
            if (c != null)
            {
                Clients v = Clients.GetClient(c.IdClient);
                comboBox1.Text = v.surname;
                List <String> a = Cars.GetModel(c.IdModel);
                comboBox2.Text  = a[0];
                textBox1.Text   = c.Vin;
                textBox2.Text   = c.Color;
                textBox3.Text   = c.IssueDate;
                textBox4.Text   = c.Milleage;
                textBox5.Text   = c.Transmission;
                button3.Visible = true;
            }
        }
Пример #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form AddModel = new AddModel(this, pt);

            AddModel.Owner = this;
            AddModel.ShowDialog();
            comboBox2.Items.Clear();
            List <Model> list2 = Cars.GetModels();

            for (int i = 0; i < list2.Count; i++)
            {
                comboBox2.Items.Add(list2[i].name);
            }
        }