private void EditClient(Client client) { UC_EditClient eClient = new UC_EditClient(client); this.Controls.Clear(); this.Controls.Add(eClient); }
private void btnOwner_Click(object sender, EventArgs e) { if (_vehicle.Client != null && _vehicle.Company == null) { this.Controls.Clear(); UC_EditClient client = new UC_EditClient(_vehicle.Client); this.Controls.Add(client); } else if (_vehicle.Client == null && _vehicle.Company != null) { this.Controls.Clear(); UC_EditCompany company = new UC_EditCompany(_vehicle.Company); this.Controls.Add(company); } else { if (_vehicle.Client == null && _vehicle.Company == null) { DialogResult dr = MessageBox.Show("This car has no owner!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnNext_Click(object sender, EventArgs e) { try { if (rbClient.Checked == true) { UC_EditClient newClient = new UC_EditClient(new Vehicle(txbLicensePlate.Text, txbVin.Text, int.Parse(txbProductYear.Text), cbType.Text, cbModel.Text, int.Parse(txbCubic.Text))); panelClient.Visible = true; panelClient.Controls.Clear(); panelClient.Controls.Add(newClient); } else if (rbCompany.Checked == true) { UC_EditCompany newCompany = new UC_EditCompany(new Vehicle(txbLicensePlate.Text, txbVin.Text, int.Parse(txbProductYear.Text), cbType.Text, cbModel.Text, int.Parse(txbCubic.Text))); panelClient.Visible = true; panelClient.Controls.Clear(); panelClient.Controls.Add(newCompany); } } catch { MessageBox.Show("Please fill the fields correctly!", "Invalid atempt input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }