private void createButton_Click(object sender, EventArgs e) { string passport = ClientComboBox.SelectedValue.ToString(); string carId = numCarComboBox.SelectedValue.ToString(); int duration = Convert.ToInt32(durationComboBox.Value); string from = fromTextBox.Text; string to = toTextBox.Text; if (db.createRent(passport, carId, user, from, to, duration)) { MessageBox.Show("Rent is created"); ClientComboBox.Text = ""; numCarComboBox.Text = ""; clientTeltextBox.Text = ""; clientNameTextBox.Text = ""; brandCarTextBox.Text = ""; modelCarTextBox.Text = ""; locationTextBox.Text = ""; durationComboBox.Value = 0; priceTextBox.Text = ""; fromTextBox.Text = ""; toTextBox.Text = ""; } else { MessageBox.Show("Rent doesn't create"); } this.Validate(); RCTableAdapterManager.UpdateAll(this.myDbDataSet); }
public void rentCar(dbHelper db) { string passport = Console.ReadLine(); string fullName = Console.ReadLine(); string phone = Console.ReadLine(); db.addClient(passport, fullName, phone); string carId = Console.ReadLine(); int duration; try { duration = Convert.ToInt32(Console.ReadLine()); } catch (Exception e) { duration = 0; } string from = Console.ReadLine(); string to = Console.ReadLine(); db.createRent(passport, carId, this, from, to, duration); }