protected void Avanzar(object sender, EventArgs e) { if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible == false)) { Buscadores bus = new Buscadores(); cliente ocliente = bus.oclientedni(txtdni.Value); vehiculo ovehiculo = bus.buscarvehiculo(txtpatente.Value); cliente oclientes = bus.ocliente(ovehiculo); if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id)) { Server.Transfer("DetalleTaller.aspx"); } else { } } }
private void GuardarCambiodecliente() { Buscadores bus = new Buscadores(); vehiculo ovehiculo = bus.buscarvehiculo(txtpatente.Value); cliente ocliente = bus.ocliente(ovehiculo); cliente oclientes = bus.oclientedni(txtdni.Value); btnGuardar.Visible = false; if ((ocliente != null) && (oclientes != null)) { ocliente = bus.oclientedni(txtdni.Value); using (aplicadaBDEntities DBF = new aplicadaBDEntities()) { vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First(); oVehiculo.id_cliente = ocliente.id; DBF.SaveChanges(); } } else { using (aplicadaBDEntities DBF = new aplicadaBDEntities()) { cliente ncliente = new cliente { dni = txtdni.Value, nombre = txtapellido.Value + " " + txtnombre.Value, telefono = txttelefono.Value, email = txtemail.Value, }; DBF.cliente.Add(ncliente); DBF.SaveChanges(); } ocliente = bus.oclientedni(txtdni.Value); using (aplicadaBDEntities DBF = new aplicadaBDEntities()) { vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First(); oVehiculo.id_cliente = ocliente.id; DBF.SaveChanges(); } } }
protected void CargaryAvanzar(object sender, EventArgs e) { Buscadores bus = new Buscadores(); cliente ocliente = bus.oclientedni(txtdni.Value); vehiculo ovehiculo = bus.buscarvehiculo(txtpatente.Value); if (ovehiculo == null) { GuardarVehiculo(); } ovehiculo = bus.buscarvehiculo(txtpatente.Value); cliente oclientes = bus.ocliente(ovehiculo); if ((ovehiculo.id_cliente == null) || (ocliente == null) || (ocliente.dni != oclientes.dni)) { GuardarCambiodecliente(); } EstadoOriginal(); VerGrid(); btnServicios.Visible = true; }
protected void Avanzar(object sender, EventArgs e) { if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible = true)) { Buscadores bus = new Buscadores(); cliente ocliente = bus.oclientedni(txtdni.Value); vehiculo ovehiculo = bus.buscarvehiculo(txtpatente.Value); cliente oclientes = bus.ocliente(ovehiculo); if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id) && (Lservi.Count <= 5) && (Lservi.Count >= 1)) { CargarOrden(); Server.Transfer("DetalleTaller.aspx"); } else { Server.Transfer("NuevoDetalle.aspx"); } } else { Server.Transfer("NuevoDetalle.aspx"); } }