public static string AgregarFactura(Factura factura, IList <FacturaDetalle> listaFacturaDetalle) { IList <string> listaSQL = new List <string> { "INSERT INTO Facturas (numero_factura, id_cliente, fecha, id_usuario_creador, borrado) " + "VALUES (" + "'" + factura.NumeroFactura + "', " + factura.Cliente.Id_cliente.ToString() + ", " + "CAST('" + factura.FechaCreacion.ToString("yyyy-MM-dd") + "' AS Date), " + "3, " + "'0')" }; for (int i = 0; i < listaFacturaDetalle.Count; i++) { listaSQL.Add ( "INSERT INTO FacturasDetalle (numero_factura, id_proyecto, cantidad_licencias, precio, borrado)" + "VALUES (" + listaFacturaDetalle[i].NumeroFactura + ", " + Proyecto.ObtenerProyectoPorDescripcion(listaFacturaDetalle[i].ProyectoAsociado.Descripcion).IdProyecto.ToString() + ", " + listaFacturaDetalle[i].CantidadLicencias.ToString() + ", " + listaFacturaDetalle[i].Precio.ToString() + ", " + "'0')" ); } return(GestorBD.MultipleEjecucion(listaSQL)); }
public static string InsertarCliente(Cliente cliente) { string error; string SQL = "INSERT INTO Clientes " + "VALUES " + "('" + cliente.Cuit.ToString() + "', '" + cliente.Razon_social.ToString() + "', '" + "0', '" + cliente.Calle.ToString() + "', '" + cliente.Numero.ToString() + "', " + "CAST(N'" + cliente.Fecha_alta.ToString("yyyy-MM-dd") + "' AS Date), " + cliente.BarrioAsociado.Id_barrio + ", " + "null" + ")"; error = GestorBD.Ejecutar(SQL); if (error == "") { error = ContactoDatos.InsertarContacto(cliente.ContactoAsociado); } return(error); }
public static DataTable ConsultarTablaProyectosComboBox() { string SQL = "SELECT proyectos.* " + "FROM Proyectos proyectos " + "WHERE borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static DataTable ConsultarTablaBarriosFiltro(string filtro) { string SQL = "SELECT barrios.* " + "FROM Barrios barrios " + "WHERE nombre LIKE '" + filtro + "%'"; return(GestorBD.Consultar(SQL)); }
public static DataTable ConsultarTablaClientesComboBox() { string SQL = "SELECT clientes.* " + "FROM Clientes clientes " + "WHERE borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static DataTable ConsultarTablaUsuariosComboBox() { string SQL = "SELECT usuarios.* " + "FROM Usuarios usuarios " + "WHERE borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static DataTable ConsultarTablaPerfilesFiltro(string filtro) { string SQL = "SELECT perfiles.* " + "FROM Perfiles perfiles " + "WHERE nombre LIKE '" + filtro + "%'"; return(GestorBD.Consultar(SQL)); }
public static string EliminarUsuario(Usuario usuario) { string SQL = "UPDATE Usuarios " + "SET " + "borrado = 1 " + "WHERE dni = '" + usuario.Dni.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static string EliminarBarrio(Barrio barrio) { string SQL = "UPDATE Barrios " + "SET " + "borrado = 1 " + "WHERE nombre = '" + barrio.Nombre.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static string EliminarProyecto(Proyecto proyecto) { string SQL = "UPDATE Proyectos " + "SET " + "borrado = 1 " + "WHERE descripcion = '" + proyecto.Descripcion.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static DataTable ConsultarListadoClientesActivos() { string SQL = "SELECT cuit, razon_social, CONVERT(varchar(10), CAST(fecha_alta AS date), 103) as fecha_alta, borrado " + "FROM Clientes " + "WHERE " + "borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static DataTable ConsultarBarriosComboBox() { string SQL = "SELECT * " + "FROM Barrios " + "WHERE " + "borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static string EliminarPerfil(Perfil perfil) { string SQL = "UPDATE Perfiles " + "SET " + "borrado = 1 " + "WHERE nombre = '" + perfil.Nombre.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static string EliminarContacto(Contacto contacto) { string SQL = "UPDATE Contactos " + "SET " + "borrado = 1 " + "WHERE cuit = '" + contacto.Cuit.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static string ModificarBarrio(Barrio barrio) { string SQL = "UPDATE Barrios " + "SET " + "nombre = '" + barrio.Nombre.ToString() + "', " + "borrado = " + Convert.ToInt32(barrio.Borrado) + " " + "WHERE id_barrio = '" + barrio.Id_barrio.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static DataTable ConsultarListadoUsuariosActivos() { string SQL = "SELECT u.dni, u.usuario, u.email, p.nombre " + "FROM Usuarios u, Perfiles p " + "WHERE " + "u.id_perfil = p.id_perfil AND " + "u.borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static string ModificarPerfil(Perfil perfil) { string SQL = "UPDATE Perfiles " + "SET " + "nombre = '" + perfil.Nombre.ToString() + "', " + "borrado = " + Convert.ToInt32(perfil.Borrado) + " " + "WHERE id_perfil = '" + perfil.Id_perfil.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }
public static Usuario ConsultarUsuarioPorDNI(string DNI) { string SQL = "SELECT usuarios.* " + "FROM Usuarios usuarios " + "WHERE dni = '" + DNI + "'"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarUsuario(0, tabla) : null); }
public static Usuario ConsultarUsuarioPorID(int idUsuario) { string SQL = "SELECT usuarios.* " + "FROM Usuarios usuarios " + "WHERE id_usuario = " + idUsuario.ToString(); DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarUsuario(0, tabla) : null); }
public static Cliente ConsultarClientePorCUIT(string CUIT) { string SQL = "SELECT clientes.* " + "FROM Clientes clientes " + "WHERE cuit = '" + CUIT.ToString() + "'"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarCliente(0, tabla) : null); }
public static DataTable ConsultarListadoProyectosActivos() { string SQL = "SELECT p.descripcion, p.version, p.alcance, u.usuario " + "FROM Proyectos p, Usuarios u " + "WHERE " + "p.id_responsable = u.id_usuario AND " + "p.borrado = 0"; return(GestorBD.Consultar(SQL)); }
public static Cliente ConsultarClientePorID(int idCliente) { string SQL = "SELECT clientes.* " + "FROM Clientes clientes " + "WHERE " + "id_cliente = " + idCliente.ToString(); DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarCliente(0, tabla) : null); }
public static string InsertarPerfil(Perfil perfil) { string SQL = "INSERT INTO Perfiles " + "VALUES " + "(" + "'" + perfil.Nombre.ToString() + "', " + "0" + ")"; return(GestorBD.Ejecutar(SQL)); }
public static Barrio ConsultarBarrioPorNombre(string nombreBarrio) { string SQL = "SELECT * " + "FROM Barrios " + "WHERE " + "nombre = '" + nombreBarrio.ToString() + "'"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarBarrio(0, tabla) : null); }
public static string InsertarBarrio(Barrio barrio) { string SQL = "INSERT INTO Barrios " + "VALUES " + "(" + "'" + barrio.Nombre.ToString() + "', " + "0" + ")"; return(GestorBD.Ejecutar(SQL)); }
public static Perfil ConsultarPerfilPorNombre(string nombrePerfil) { string SQL = "SELECT * " + "FROM Perfiles " + "WHERE " + "nombre = '" + nombrePerfil.ToString() + "'"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarPerfil(0, tabla) : null); }
public static Proyecto ConsultarProyectoPorDescripcion(string descripcionProyecto) { string SQL = "SELECT * " + "FROM Proyectos " + "WHERE " + "descripcion = '" + descripcionProyecto.ToString() + "'"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarProyecto(0, tabla) : null); }
public static Proyecto ConsultarProyectoPorID(int idProyecto) { string SQL = "SELECT proyectos.* " + "FROM Proyectos proyectos " + "WHERE " + "id_proyecto = " + idProyecto.ToString() + " AND " + "borrado = 0"; DataTable tabla = GestorBD.Consultar(SQL); return((tabla.Rows.Count > 0) ? DiseniarProyecto(0, tabla) : null); }
public static DataTable ConsultarProyectosConMasVentas(string fechaDesde, string fechaHasta) { string SQL = "SELECT TOP(15) p.descripcion, SUM(fd.cantidad_licencias) as cantidad_licencias " + "FROM FacturasDetalle fd, Proyectos p, Facturas f " + "WHERE " + "fd.id_proyecto = p.id_proyecto AND " + "f.fecha BETWEEN '" + fechaDesde + "' AND '" + fechaHasta + "'" + " AND " + "f.numero_factura = fd.numero_factura " + "GROUP BY p.descripcion"; return(GestorBD.Consultar(SQL)); }
public static string ModificarProyecto(Proyecto proyecto) { string SQL = "UPDATE Proyectos " + "SET " + "version = '" + proyecto.Version.ToString() + "', " + "alcance = '" + proyecto.Alcance.ToString() + "', " + "id_responsable = " + proyecto.Responsable.Id_usuario.ToString() + ", " + "borrado = " + Convert.ToInt32(proyecto.Borrado) + " " + "WHERE descripcion = '" + proyecto.Descripcion.ToString() + "'"; return(GestorBD.Ejecutar(SQL)); }