public FormVehiculoModeloAddEdit(Modelo_Vehiculo modelo) { InitializeComponent(); db = new RentCarEntities(); //llenar combobox #region fill combobox var marcas = db.Marca_Vehiculo.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbMarca.DisplayMember = "Descripcion"; cbMarca.ValueMember = "ID"; cbMarca.DataSource = marcas; #endregion //crear o editar if (modelo == null) { modeloVehiculoBindingSource.DataSource = new Modelo_Vehiculo(); var m = modeloVehiculoBindingSource.Current as Modelo_Vehiculo; m.Estado = true; } else { label7.Text = "Editar"; modeloVehiculoBindingSource.DataSource = modelo; edit = true; } }
private void FormRenta_Load(object sender, EventArgs e) { db = new RentCarEntities(); //get rentas var ds = from renta in db.Rentas.Select(q => q) join empleado in db.Empleadoes.Select(q => q) on renta.Empleado equals empleado.ID join cliente in db.Clientes.Select(q => q) on renta.Cliente equals cliente.ID join vehiculo in db.Vehiculoes.Select(q => q) on renta.Vehiculo equals vehiculo.ID select new { ID = renta.ID, Vehiculo = vehiculo.Descripcion, Estado = renta.Estado, Dias = renta.CantDias, Renta = renta.FechaRenta, Devolucion = renta.FechaDevolucion, MontoDiario = renta.MontoDiario, Cliente = cliente.Nombre, Empleado = empleado.Nombre, Comentario = renta.Comentario }; //map columns dataGridView1.DataSource = ds.ToList(); }
private void FormVehiculo_Load(object sender, EventArgs e) { db = new RentCarEntities(); //get vehiculos var ds = from vehiculo in db.Vehiculoes.Select(q => q) join marca in db.Marca_Vehiculo.Select(q => q) on vehiculo.Marca_Vehiculo equals marca.ID join modelo in db.Modelo_Vehiculo.Select(q => q) on vehiculo.Modelo_Vehiculo equals modelo.ID join tipo in db.Tipo_Vehiculo.Select(q => q) on vehiculo.Tipo_Vehiculo equals tipo.ID join combustible in db.Tipo_Combustible_Vehiculo.Select(q => q) on vehiculo.Tipo_Combustible_Vehiculo equals combustible.ID select new { ID = vehiculo.ID, Descripcion = vehiculo.Descripcion, Estado = vehiculo.Estado, Tipo = tipo.Descripcion, Marca = marca.Descripcion, Modelo = modelo.Descripcion, Combustible = combustible.Descripcion, Placa = vehiculo.PlacaNum, Chasis = vehiculo.ChasisNum, Motor = vehiculo.MotorNum }; //map columns dataGridView1.DataSource = ds.ToList(); }
private void FormVehiculoModelo_Load(object sender, EventArgs e) { db = new RentCarEntities(); //get modelos var ds = from modelo in db.Modelo_Vehiculo.Select(q => q) join marca in db.Marca_Vehiculo.Select(q => q) on modelo.marca equals marca.ID select new { ID = modelo.ID, Marca = marca.Descripcion, Descripcion = modelo.Descripcion, Estado = modelo.Estado }; //map columns dataGridView1.DataSource = ds.ToList(); }
public FormVehiculoCombustibleAddEdit(Tipo_Combustible_Vehiculo comb) { InitializeComponent(); db = new RentCarEntities(); if (comb == null) { tipoCombustibleVehiculoBindingSource.DataSource = new Tipo_Combustible_Vehiculo(); var c = tipoCombustibleVehiculoBindingSource.Current as Tipo_Combustible_Vehiculo; c.Estado = true; db.Tipo_Combustible_Vehiculo.Add(c); } else { label7.Text = "Editar"; tipoCombustibleVehiculoBindingSource.DataSource = comb; edit = true; } }
public FormVehiculoTipoAddEdit(Tipo_Vehiculo tv) { InitializeComponent(); db = new RentCarEntities(); if (tv == null) { tipoVehiculoBindingSource.DataSource = new Tipo_Vehiculo(); var t = tipoVehiculoBindingSource.Current as Tipo_Vehiculo; t.Estado = true; db.Tipo_Vehiculo.Add(t); } else { label7.Text = "Editar"; tipoVehiculoBindingSource.DataSource = tv; edit = true; } }
public FormClienteAddEdit(Cliente cliente) { InitializeComponent(); db = new RentCarEntities(); if (cliente == null) { clienteBindingSource.DataSource = new Cliente(); var c = clienteBindingSource.Current as Cliente; c.Estado = true; db.Clientes.Add(c); } else { label7.Text = "Editar"; clienteBindingSource.DataSource = cliente; edit = true; } }
public FormEmpleadoAddEdit(Empleado empleado) { InitializeComponent(); db = new RentCarEntities(); if (empleado == null) { empleadoBindingSource.DataSource = new Empleado(); var e = empleadoBindingSource.Current as Empleado; e.Estado = true; db.Empleadoes.Add(e); } else { label7.Text = "Editar"; empleadoBindingSource.DataSource = empleado; edit = true; } }
public FormVehiculoMarcaAddEdit(Marca_Vehiculo marca) { InitializeComponent(); db = new RentCarEntities(); if (marca == null) { marcaVehiculoBindingSource.DataSource = new Marca_Vehiculo(); var c = marcaVehiculoBindingSource.Current as Marca_Vehiculo; c.Estado = true; db.Marca_Vehiculo.Add(c); } else { label7.Text = "Editar"; marcaVehiculoBindingSource.DataSource = marca; edit = true; } }
private void FormReportes_Load(object sender, EventArgs e) { db = new RentCarEntities(); #region fill combobox //cb tipo vehiculo var vehiculos = db.Tipo_Vehiculo.Select(q => q).ToList(); cbVehiculos.DisplayMember = "Descripcion"; cbVehiculos.ValueMember = "ID"; cbVehiculos.DataSource = vehiculos; //cb empleados var empleados = db.Empleadoes.Select(q => q).ToList(); cbEmpleado.DisplayMember = "Nombre"; cbEmpleado.ValueMember = "ID"; cbEmpleado.DataSource = empleados; //cb vehiculo var clientes = db.Clientes.Select(q => q).ToList(); cbCliente.DisplayMember = "Nombre"; cbCliente.ValueMember = "ID"; cbCliente.DataSource = clientes; #endregion //datasource var ds = from renta in db.Rentas.Select(q => q) join empleado in db.Empleadoes.Select(q => q) on renta.Empleado equals empleado.ID join cliente in db.Clientes.Select(q => q) on renta.Cliente equals cliente.ID join vehiculo in db.Vehiculoes.Select(q => q) on renta.Vehiculo equals vehiculo.ID select new { ID = renta.ID, Vehiculo = vehiculo.Descripcion, Estado = renta.Estado, Dias = renta.CantDias, Renta = renta.FechaRenta, Devolucion = renta.FechaDevolucion, MontoDiario = renta.MontoDiario, Cliente = cliente.Nombre, Empleado = empleado.Nombre, Comentario = renta.Comentario }; //map columns dataGridView1.DataSource = ds.ToList(); }
public FormRentaAddEdit(Renta renta) { InitializeComponent(); db = new RentCarEntities(); #region fill combobox //cb vehiculo var vehiculos = db.Vehiculoes.Where(q => q.Estado.ToString() == "Activo").Select(q => q).ToList(); cbVehiculo.DisplayMember = "Descripcion"; cbVehiculo.ValueMember = "ID"; cbVehiculo.DataSource = vehiculos; //cb empleados var empleados = db.Empleadoes.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbEmpleado.DisplayMember = "Nombre"; cbEmpleado.ValueMember = "ID"; cbEmpleado.DataSource = empleados; //cb vehiculo var clientes = db.Clientes.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbCliente.DisplayMember = "Nombre"; cbCliente.ValueMember = "ID"; cbCliente.DataSource = clientes; #endregion //crear o editar if (renta == null) { //fijar el cb de vehiculo var v = db.Inspeccions.Select(q => q).OrderByDescending(q => q.ID).FirstOrDefault(); v.Estado = "Rentado"; vehiculo = (int)v.Vehiculo; cbVehiculo.SelectedValue = vehiculo; cbVehiculo.Enabled = false; rentaBindingSource.DataSource = new Renta(); var c = rentaBindingSource.Current as Renta; c.Estado = true; } else { label7.Text = "Editar"; rentaBindingSource.DataSource = renta; edit = true; } }
public FormInspeccion() { InitializeComponent(); db = new RentCarEntities(); #region fill combobox //cb vehiculo var vehiculos = db.Vehiculoes.Where(q => q.Estado.ToString() == "Activo").Select(q => q).ToList(); cbVehiculo.DisplayMember = "Descripcion"; cbVehiculo.ValueMember = "ID"; cbVehiculo.DataSource = vehiculos; //cb empleados var empleados = db.Empleadoes.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbEmpleado.DisplayMember = "Nombre"; cbEmpleado.ValueMember = "ID"; cbEmpleado.DataSource = empleados; #endregion inspeccionBindingSource.DataSource = new Inspeccion(); var n = inspeccionBindingSource.Current as Inspeccion; }
public FormVehiculoAddEdit(Vehiculo vehiculo) { InitializeComponent(); db = new RentCarEntities(); #region fill combobox //cb tipo vehiculo var tipos = db.Tipo_Vehiculo.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbTipo.DisplayMember = "Descripcion"; cbTipo.ValueMember = "ID"; cbTipo.DataSource = tipos; //cb marca var marcas = db.Marca_Vehiculo.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbMarca.DisplayMember = "Descripcion"; cbMarca.ValueMember = "ID"; cbMarca.DataSource = marcas; //cb modelo cambiarModelo(); //cb combustible var combustible = db.Tipo_Combustible_Vehiculo.Where(q => q.Estado.ToString() == "true").Select(q => q).ToList(); cbCombustible.DisplayMember = "Descripcion"; cbCombustible.ValueMember = "ID"; cbCombustible.DataSource = combustible; #endregion //crear o editar if (vehiculo == null) { vehiculoBindingSource.DataSource = new Vehiculo(); var c = vehiculoBindingSource.Current as Vehiculo; c.Estado = "Activo"; } else { label7.Text = "Editar"; vehiculoBindingSource.DataSource = vehiculo; edit = true; } }
private void FormVehiculoTipo_Load(object sender, EventArgs e) { db = new RentCarEntities(); tipoVehiculoBindingSource.DataSource = db.Tipo_Vehiculo.ToList(); }
public ActionResult Index() { var context = new RentCarEntities(); context.Car.ToList(); return View(); }
private void FormEmpleado_Load(object sender, EventArgs e) { db = new RentCarEntities(); empleadoBindingSource.DataSource = db.Empleadoes.ToList(); }
private void FormVehiculoMarca_Load(object sender, EventArgs e) { db = new RentCarEntities(); marcaVehiculoBindingSource.DataSource = db.Marca_Vehiculo.ToList(); }
private void FormCliente_Load(object sender, EventArgs e) { db = new RentCarEntities(); clienteBindingSource.DataSource = db.Clientes.ToList(); }