public List <Repuestos> listaRepuxRepa(string auxid) { //INSTANCIO LA LISTA List <Repuestos> lista = new List <Repuestos>(); //DECLARO EL OBJETO Repuestos aux; Reparaciones aux1; //INSTANCIO LA CONECCION A LA BASE AccesoDatos datos = new AccesoDatos(); //TIRO LA QUERY //datos.setearQuery("select codigo, nombre, cantidad, precio from repuestos where estado = 1"); datos.setearQuery("select repara.orden, repuxrepa.IDREPUESTO, repu.codigo ,repu.nombre, repu.precio from REPUESTOS_POR_REPARACIONES as repuxrepa inner join repuestos as repu on repuxrepa.IDREPUESTO = repu.id inner join REPARACIONES as repara on repuxrepa.IDREPARACIONES = repara.id where repara.id = @aux"); datos.agregarParametro("@aux", auxid); //EJECUTO EL LECTOR datos.ejecutarLector(); //MIENTRAS EL LECTOR LEA, DEVULVE LOS DATOS (DEBE COINSIDIR CON LA QUERY) while (datos.lector.Read()) { aux = new Repuestos(); aux1 = new Reparaciones(); aux1.orden = Convert.ToInt64(datos.lector["orden"]); aux.id = Convert.ToInt32(datos.lector["idrepuesto"]); aux.codigo = datos.lector["Codigo"].ToString(); aux.nombre = datos.lector["nombre"].ToString(); aux.precio = Convert.ToSingle(datos.lector["precio"]); lista.Add(aux); } return(lista); //datos.cerrarConexion(); }
public bool Repuestos_x_reparaciones(Reparaciones repa, Repuestos repu) { AccesoDatos data = new AccesoDatos(); try { data.prepareStatement("insert into REPUESTOS_POR_REPARACIONES values (@idreparaciones, @idrepuesto)"); data.agregarParametro("@idreparaciones", repa.id); data.agregarParametro("@idrepuesto", repu.id); data.ejecutarAccion(); if (data.getAffectedRows() <= 0) { return(false); } else { return(true); } } catch (Exception ex) { throw ex; } finally { data.cerrarConexion(); } }
public Reparaciones BuscarReparacion_ESPESIFICA_FINALIZADO(string aux) { //INSTANCIO LA LISTA List <Reparaciones> lista = new List <Reparaciones>(); //DECLARO EL OBJETO Reparaciones rep = new Reparaciones(); //INSTANCIO LA CONECCION A LA BASE AccesoDatos datos = new AccesoDatos(); //TIRO LA QUERY datos.setearQuery("SELECT R.ID, R.ORDEN, CLI.NOMBRE, CLI.APELLIDO, CLI.TELEFONO, EQ.NUMEROSERIE, EQ.MARCA,EQ.MODELO, TEC.USUARIO, R.FECHA_ENTRADA, R.PROBLEMA, R.IDESTADO, R.PRECIO, R.FECHA_SALIDA, R.INFORME FROM REPARACIONES AS R INNER JOIN CLIENTES AS CLI ON R.IDCLIENTE = CLI.ID INNER JOIN EQUIPOS AS EQ ON R.IDEQUIPO = EQ.ID INNER JOIN TECNICOS AS TEC ON R.IDTECNICO = TEC.ID WHERE R.IDESTADO = 2 AND R.ORDEN = @AUX"); datos.agregarParametro("@AUX", aux); //EJECUTO EL LECTOR datos.ejecutarLector(); //MIENTRAS EL LECTOR LEA, DEVULVE LOS DATOS (DEBE COINSIDIR CON LA QUERY) while (datos.lector.Read()) { rep.fecha_entrada = Convert.ToDateTime(datos.lector["fecha_entrada"]); rep.problema = datos.lector["PROBLEMA"].ToString(); rep.informe = datos.lector["INFORME"].ToString(); rep.presupuesto = Convert.ToSingle(datos.lector["precio"]); rep.fecha_salida = Convert.ToDateTime(datos.lector["fecha_salida"]); rep.id = Convert.ToInt32(datos.lector["ID"]); rep.orden = Convert.ToInt32(datos.lector["ORDEN"]); rep.cliente = new Clientes(); rep.cliente.nombre = datos.lector["NOMBRE"].ToString(); rep.cliente.apellido = datos.lector["APELLIDO"].ToString(); rep.cliente.telefono = datos.lector["TELEFONO"].ToString(); rep.equipo = new Equipos(); rep.equipo.numeroserie = datos.lector["numeroserie"].ToString(); rep.equipo.marca = datos.lector["MARCA"].ToString(); rep.equipo.modelo = datos.lector["MODELO"].ToString(); rep.tecnico = new Tecnicos(); rep.tecnico.usuario = datos.lector["usuario"].ToString(); rep.estados = new EstadosReparacion(); rep.estados.id = Convert.ToInt32(datos.lector["idestado"]); } return(rep); }
//SIN REPARACION public List <Reparaciones> listarRep5(string idtec) { //INSTANCIO LA LISTA List <Reparaciones> lista = new List <Reparaciones>(); //DECLARO EL OBJETO Reparaciones aux; //INSTANCIO LA CONECCION A LA BASE AccesoDatos datos = new AccesoDatos(); //TIRO LA QUERY datos.setear_SP("SP_ListarReparaciones_Propias"); datos.agregarParametro("@IDTEC", idtec); datos.agregarParametro("@ESTADO_REPARACION", 5); //datos.setearQuery("SELECT R.ORDEN, CLI.NOMBRE, CLI.APELLIDO, CLI.TELEFONO, EQ.MARCA, EQ.MODELO, R.PROBLEMA, R.INFORME, R.FECHA_ENTRADA, R.FECHA_SALIDA FROM REPARACIONES AS R INNER JOIN CLIENTES AS CLI ON R.IDCLIENTE = CLI.ID INNER JOIN ESTADOS_REPARACION AS ER ON R.IDESTADO = ER.ID INNER JOIN EQUIPOS AS EQ ON R.IDEQUIPO = EQ.ID WHERE ER.ID = 5 and R.IDTECNICO = @IDTEC"); //datos.agregarParametro("@IDTEC", idtec); //EJECUTO EL LECTOR datos.ejecutarLector(); //MIENTRAS EL LECTOR LEA, DEVULVE LOS DATOS (DEBE COINSIDIR CON LA QUERY) while (datos.lector.Read()) { aux = new Reparaciones(); aux.cliente = new Clientes(); aux.equipo = new Equipos(); aux.orden = Convert.ToInt64(datos.lector["ORDEN"]); aux.cliente.nombre = datos.lector["NOMBRE"].ToString(); aux.cliente.apellido = datos.lector["APELLIDO"].ToString(); aux.cliente.telefono = datos.lector["TELEFONO"].ToString(); aux.equipo.marca = datos.lector["MARCA"].ToString(); aux.equipo.modelo = datos.lector["MODELO"].ToString(); aux.problema = datos.lector["PROBLEMA"].ToString(); aux.informe = datos.lector["INFORME"].ToString(); aux.fecha_entrada = Convert.ToDateTime(datos.lector["FECHA_ENTRADA"]); aux.fecha_salida = Convert.ToDateTime(datos.lector["FECHA_SALIDA"]); aux.presupuesto = Convert.ToSingle(datos.lector["PRECIO"]); lista.Add(aux); } return(lista); //datos.cerrarConexion(); }
public Reparaciones BuscarReparacion_ESPESIFICA_REPARACION(string aux) { //INSTANCIO LA LISTA List <Reparaciones> lista = new List <Reparaciones>(); //DECLARO EL OBJETO Reparaciones rep = new Reparaciones(); //INSTANCIO LA CONECCION A LA BASE AccesoDatos datos = new AccesoDatos(); //TIRO LA QUERY datos.setearQuery("select r.id, r.orden, cli.nombre, cli.apellido, cli.telefono, eq.numeroserie, eq.marca, eq.modelo, tec.usuario, r.fecha_entrada, r.problema, r.idestado from reparaciones as r INNER JOIN CLIENTES AS CLI ON R.IDCLIENTE = CLI.ID INNER JOIN EQUIPOS AS EQ ON R.IDEQUIPO = EQ.ID INNER JOIN TECNICOS AS TEC ON R.IDTECNICO = TEC.ID where r.orden = @AUX"); datos.agregarParametro("@AUX", aux); //EJECUTO EL LECTOR datos.ejecutarLector(); //MIENTRAS EL LECTOR LEA, DEVULVE LOS DATOS (DEBE COINSIDIR CON LA QUERY) while (datos.lector.Read()) { rep.fecha_entrada = Convert.ToDateTime(datos.lector["fecha_entrada"]); rep.problema = datos.lector["PROBLEMA"].ToString(); rep.id = Convert.ToInt32(datos.lector["ID"]); rep.orden = Convert.ToInt32(datos.lector["ORDEN"]); rep.cliente = new Clientes(); rep.cliente.nombre = datos.lector["NOMBRE"].ToString(); rep.cliente.apellido = datos.lector["APELLIDO"].ToString(); rep.cliente.telefono = datos.lector["TELEFONO"].ToString(); rep.equipo = new Equipos(); rep.equipo.numeroserie = datos.lector["numeroserie"].ToString(); rep.equipo.marca = datos.lector["MARCA"].ToString(); rep.equipo.modelo = datos.lector["MODELO"].ToString(); rep.tecnico = new Tecnicos(); rep.tecnico.usuario = datos.lector["usuario"].ToString(); rep.estados = new EstadosReparacion(); rep.estados.id = Convert.ToInt32(datos.lector["idestado"]); } return(rep); }
public Reparaciones ValidarOrden1(string ord) { AccesoDatos datos = new AccesoDatos(); Reparaciones re = new Reparaciones(); datos.setearQuery("select id, idestado, orden from reparaciones where orden = @orden and idestado = 2"); datos.agregarParametro("@orden", ord); datos.ejecutarLector(); if (datos.lector.Read()) { re.id = datos.lector.GetInt32(0); re.estados = new EstadosReparacion(); re.estados.id = datos.lector.GetInt32(1); re.orden = datos.lector.GetInt64(2); } else { re = null; } return(re); }
public bool FinalizarReparacion(Reparaciones aux) { AccesoDatos data = new AccesoDatos(); data.prepareStatement("update reparaciones set idestado = 2, informe = @informe, precio = @precio, fecha_salida = @fecha_salida where id = @aux"); //data.agregarParametro("cantidad", aux.cantidad); data.agregarParametro("@aux", aux.id); data.agregarParametro("@informe", aux.informe); data.agregarParametro("@precio", aux.presupuesto); aux.fecha_salida = DateTime.Now; data.agregarParametro("@fecha_salida", aux.fecha_salida); data.ejecutarAccion(); data.cerrarConexion(); if (data.getAffectedRows() <= 0) { return(false); } return(true); }
//LISTA REPARACIONES EN REPARACION public List <Reparaciones> listarRep1() { //INSTANCIO LA LISTA List <Reparaciones> lista = new List <Reparaciones>(); //DECLARO EL OBJETO Reparaciones aux; //INSTANCIO LA CONECCION A LA BASE AccesoDatos datos = new AccesoDatos(); //TIRO LA QUERY datos.setear_SP("SP_ListarReparaciones"); datos.agregarParametro("@ESTADO_REPARACION", 1); //datos.setearquery("select r.orden, cli.nombre, cli.apellido, cli.telefono, eq.marca, eq.modelo, r.problema, r.fecha_entrada from reparaciones as r inner join clientes as cli on r.idcliente = cli.id inner join estados_reparacion as er on r.idestado = er.id inner join equipos as eq on r.idequipo = eq.id where er.id = 1"); //EJECUTO EL LECTOR datos.ejecutarLector(); //MIENTRAS EL LECTOR LEA, DEVULVE LOS DATOS (DEBE COINSIDIR CON LA QUERY) while (datos.lector.Read()) { aux = new Reparaciones(); aux.cliente = new Clientes(); aux.equipo = new Equipos(); aux.orden = Convert.ToInt64(datos.lector["ORDEN"]); aux.cliente.nombre = datos.lector["NOMBRE"].ToString(); aux.cliente.apellido = datos.lector["APELLIDO"].ToString(); aux.cliente.telefono = datos.lector["TELEFONO"].ToString(); aux.equipo.marca = datos.lector["MARCA"].ToString(); aux.equipo.modelo = datos.lector["MODELO"].ToString(); aux.problema = datos.lector["PROBLEMA"].ToString(); //aux.presupuesto = Convert.ToSingle(datos.lector["PRESUPUESTO"]); aux.fecha_entrada = Convert.ToDateTime(datos.lector["FECHA_ENTRADA"]); lista.Add(aux); } return(lista); //datos.cerrarConexion(); }
public bool NuevaReparacion(Reparaciones aux) { AccesoDatos data = new AccesoDatos(); try { data.prepareStatement("insert into REPARACIONES values (@orden, @idcliente, @idequipo, @idtecnico, 1, @problema, @fecha_entrada , null, null, null)"); data.agregarParametro("@orden", aux.orden); data.agregarParametro("@idcliente", aux.cliente.id); data.agregarParametro("@idequipo", aux.equipo.id); data.agregarParametro("@idtecnico", aux.tecnico.ID); data.agregarParametro("@problema", aux.problema); aux.fecha_entrada = DateTime.Now; data.agregarParametro("@fecha_entrada", aux.fecha_entrada); data.ejecutarAccion(); if (data.getAffectedRows() <= 0) { return(false); } else { return(true); } } catch (Exception ex) { throw ex; } finally { data.cerrarConexion(); } }
protected void btnBuscarOrden_Click(object sender, EventArgs e) { Reparaciones rep = new Reparaciones(); ReparacionesNegocio repn = new ReparacionesNegocio(); Repuestos repu = new Repuestos(); RepuestosNegocio repun = new RepuestosNegocio(); if (string.IsNullOrEmpty(txtBuscarOrden.Text)) { lblIngreseNumeroOrden.Visible = true; } //rep = repn.BuscarReparacion_ESPESIFICA(txtBuscarOrden.Text); rep_reparacion = repn.ValidarOrden(txtBuscarOrden.Text); rep_finalizado = repn.ValidarOrden1(txtBuscarOrden.Text); //orden en reparacion if (rep_reparacion != null && rep_finalizado == null) { Mostrar_reparacion(); rep = repn.BuscarReparacion_ESPESIFICA_REPARACION(txtBuscarOrden.Text); txtIDESTADO.Text = Convert.ToInt32(rep.estados.id).ToString(); txtIDORDEN.Text = Convert.ToInt32(rep.id).ToString(); //CLIENTE lblCliNombre.Text = rep.cliente.nombre; lblCliApellido.Text = rep.cliente.apellido; lblCliTelefono.Text = rep.cliente.telefono; //equipo lblEqSN.Text = rep.equipo.numeroserie; lblEqMarca.Text = rep.equipo.marca; lblEqModelo.Text = rep.equipo.modelo; //tecnico, problema y fecha de ingreso lblTecasignado.Text = rep.tecnico.usuario; txtProblema.Text = rep.problema; lblFechaIng.Text = Convert.ToDateTime(rep.fecha_entrada).ToString(); } //ORDEN FINALIZADA else if (rep_reparacion == null && rep_finalizado != null) { Mostrar_reparacion(); Mostrar_finalizado(); rep = repn.BuscarReparacion_ESPESIFICA_FINALIZADO(txtBuscarOrden.Text); txtIDESTADO.Text = Convert.ToInt32(rep.estados.id).ToString(); txtIDORDEN.Text = Convert.ToInt32(rep.id).ToString(); //CLIENTE lblCliNombre.Text = rep.cliente.nombre; lblCliApellido.Text = rep.cliente.apellido; lblCliTelefono.Text = rep.cliente.telefono; //equipo lblEqSN.Text = rep.equipo.numeroserie; lblEqMarca.Text = rep.equipo.marca; lblEqModelo.Text = rep.equipo.modelo; //tecnico, problema y fecha de ingreso lblTecasignado.Text = rep.tecnico.usuario; txtProblema.Text = rep.problema; lblFechaIng.Text = Convert.ToDateTime(rep.fecha_entrada).ToString(); //informe, preciofinal, fecha salida lblFechaSal.Text = Convert.ToDateTime(rep.fecha_salida).ToString(); txtInforme.Text = rep.informe; lblPreciofinal.Text = Convert.ToSingle(rep.presupuesto).ToString(); //REPUESTOS USADOS List <Repuestos> lista; lista = new List <Repuestos>(); lista = repun.listaRepuxRepa(txtIDORDEN.Text); lista.Add(repu); dwRepuestosUsados.DataSource = lista; dwRepuestosUsados.DataBind(); } else if (rep_reparacion == null && rep_finalizado == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('ORDEN INEXSISTENTE');window.location ='BuscarOrden.aspx';", true); } }