private void button1_Click(object sender, EventArgs e) { AddvehicleDetails passdata = new AddvehicleDetails(); DateTime dd = DateTime.Now; CabDriver create = new CabDriver(); create.VehicaleNo = textBox6.Text; create.FirstName = textBox2.Text; create.LastName = textBox3.Text; create.ContactNo = int.Parse(textBox4.Text); create.Address = textBox5.Text; create.VehicleType = SelectvehicleID(); create.RegisterdDate = dd; create.Paymethod = textBox7.Text; create.IsAvailable = textBox8.Text; create.DriverId = textBox1.Text; passdata.SaveDriverDetails(create); }
private void button1_Click(object sender, EventArgs e) { Vehicle vv = new Vehicle(); vv.Type = comboBox1.Text; using (var db = new TaxiiContext()) { var data = db.VehicleCts.Where(i => i.VehicleCategory .Equals(comboBox1.Text)) .Select(i => i.ID) .First(); if (data == 1) { vv.DepositAmount = 35000; } else if (data == 2) { vv.DepositAmount = 25000; } else { vv.DepositAmount = 15000; } } vv.PerKM = int.Parse(textBox3.Text); //vv.PerKM = int.Parse(textBox3.Text); AddvehicleDetails ss = new AddvehicleDetails(); string msg = ss.AddVehicle(vv); MessageBox.Show(msg); }