public static DataTable LIBRO_DE_VENTAS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append(@"SELECT a.OrderID, a.CustomerID, d.ContactName, a.EmployeeID, CONCAT(e.FirstName, ' ', e.LastName) as 'Empleado', a.OrderDate, b.ProductID, c.ProductName, b.Quantity, b.UnitPrice FROM orders a, orderdetails b, products c, customers d, employees e WHERE a.OrderID = b.OrderID AND b.ProductID = c.ProductID AND a.CustOmerID = d.CustOmerID AND a.EmployeeID = e.EmployeeID; "); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public Boolean Actualzar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE Ejemplares SET "; Sentencia += "N_Ejemplar = '" + _N_Ejemplar + "',"; Sentencia += "Ubicacion = '" + _Ubicacion + "',"; Sentencia += "Fecha_Ingreso = '" + _Fecha_Ingreso + "',"; if (_Fecha_Salida != null) { Sentencia += "Fecha_Salida = '" + _Fecha_Salida + "',"; } else { Sentencia += "Fecha_Salida = null,"; } Sentencia += "Estado_Libro = '" + _Estado_Libro + "',"; Sentencia += "IDLibro = " + _IDLibro + ","; Sentencia += "IDEstado = " + IDEstado; Sentencia += " WHERE IDEjemplar =" + _IDEjemplar + ";"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Insertar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "INSERT INTO Empleados(Nombres, Apellidos, FechaNacimiento, Genero, Foto) VALUES("; Sentencia += "'" + _Nombres + "','"; Sentencia += _Apellidos + "','"; Sentencia += _FechaNacimiento + "','"; Sentencia += _Genero + "',"; Sentencia += "@Foto"; Sentencia += ");"; MySqlParameter param = new MySqlParameter("@Foto", MySqlDbType.MediumBlob); byte[] buffer = Functions.Class1.ImageToByteArray(_Foto); param.Size = buffer.Length; param.Value = buffer; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Insertar(Sentencia, param) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualizar(bool credencial = false) { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE Usuarios SET "; Sentencia += "Usuario = '" + _Usuario + "',"; if (credencial) { Sentencia += " Credencial = sha1('" + _Credencial + "'),"; } Sentencia += " IDEmpleado = " + _IDEmpleado + ", IDRol=" + _IDRol;; Sentencia += " WHERE IDUsuario=" + _IDUsuario + ";"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualizar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE facturasdeventas SET "; Sentencia += "Fecha='" + _Fecha + "',"; Sentencia += "FormasDePago='" + _FormasDePago + "',"; Sentencia += "IDCliente='" + _IDCliente + "',"; Sentencia += "IDEmpleado='" + _IDEmpleado + "'"; Sentencia += "Excento='" + _Excento + "',"; Sentencia += "Gravado='" + _Gravado + "'"; Sentencia += "NoSujeto='" + _NoSujeto + "',"; Sentencia += "MontoDeIVA='" + _MontoDeIVA + "',"; Sentencia += "SubTotal='" + _SubTotal + "',"; Sentencia += "TotalAPagar='" + _TotalAPagar + "'"; Sentencia += "WHERE IDFacturaDeVenta=" + _IDFacturaDeVenta + ";"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Insertar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "INSERT INTO Libros(Titulo, Fecha_Lanzamiento, Paginas, Contenidos, IDAutor, IDEditorial, IDCategoria, Edicion, Portada) VALUES("; Sentencia += "'" + _Titulo + "',"; Sentencia += "'" + _Fecha_Lanzamiento + "',"; Sentencia += _Paginas + ","; Sentencia += "'" + _Contenidos + "',"; Sentencia += _IDAutor + ","; Sentencia += _IDEditorial + ","; Sentencia += _IDCategoria + ","; Sentencia += "'" + _Edicion + "',"; Sentencia += "@Portada"; Sentencia += ");"; MySqlParameter param = new MySqlParameter("@Portada", MySqlDbType.MediumBlob); byte[] buffer = Functions.Class1.ImageToByteArray(_Portada); param.Size = buffer.Length; param.Value = buffer; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Insertar(Sentencia, param) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualizar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE detallesfaturas SET "; Sentencia += "Cantidad='" + Cantidad + "',"; Sentencia += "Precio='" + Precio + "',"; Sentencia += "NombreProducto='" + NombreProducto + "',"; Sentencia += "IDProducto='" + IDProducto + "'"; Sentencia += "IDFacturaDeVenta='" + IDFacturaDeVenta + "',"; Sentencia += "Exento='" + Exento + "'"; Sentencia += "Gravado='" + Gravado + "'"; Sentencia += "NoSujeto='" + NoSujeto + "'"; Sentencia += "WHERE IDDetallesFactura=" + IDDetallesFactura + ";"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualizar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE empleados SET "; Sentencia += "Nombres='" + _Nombres + "',"; Sentencia += "Apellidos='" + _Apellidos + "',"; Sentencia += "Direccion='" + _Direccion + "',"; Sentencia += "Telefono='" + _Telefono + "',"; Sentencia += "FechaNacimiento='" + _FechaNacimiento + "',"; Sentencia += "Genero='" + _Genero + "',"; Sentencia += "DUI='" + _DUI + "',"; Sentencia += "Email='" + _Email + "',"; Sentencia += "Foto=@Imagen "; Sentencia += "WHERE IDEmpleado=" + _IDEmpleado + ";"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia, _Foto) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualzar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE Libros SET "; Sentencia += "Titulo = '" + _Titulo + "',"; Sentencia += "Fecha_Lanzamiento = '" + _Fecha_Lanzamiento + "',"; Sentencia += "Paginas = '" + _Paginas + "',"; Sentencia += "Contenidos = '" + _Contenidos + "',"; Sentencia += "IDAutor = " + _IDAutor + ","; Sentencia += "IDEditorial = " + _IDEditorial + ","; Sentencia += "IDCategoria = " + _IDCategoria + ","; Sentencia += "Edicion = '" + _Edicion + "',"; Sentencia += "Portada= @Portada"; Sentencia += " WHERE IDLibro=" + _IDLibro + ";"; MySqlParameter param = new MySqlParameter("@Portada", MySqlDbType.MediumBlob); byte[] buffer = Functions.Class1.ImageToByteArray(_Portada); param.Size = buffer.Length; param.Value = buffer; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia, param) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Insertar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "INSERT INTO Ejemplares(N_Ejemplar, Ubicacion, Fecha_Ingreso, Fecha_Salida, Estado_Libro, IDLibro, IDEstado) VALUES("; Sentencia += "'" + _N_Ejemplar + "',"; Sentencia += "'" + _Ubicacion + "',"; Sentencia += "'" + _Fecha_Ingreso + "',"; if (_Fecha_Salida != null) { Sentencia += "'" + _Fecha_Salida + "',"; } else { Sentencia += "null,"; } Sentencia += "'" + _Estado_Libro + "',"; Sentencia += _IDLibro + ","; Sentencia += _IDEstado; Sentencia += ");"; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Insertar(Sentencia) > 0) { ok = true; } } catch { } return(ok); }
public Boolean Actualzar() { Boolean ok = false; String Sentencia = String.Empty; Sentencia += "UPDATE Empleados SET "; Sentencia += "Nombres = '" + _Nombres + "',"; Sentencia += "Apellidos = '" + _Apellidos + "',"; Sentencia += "FechaNacimiento = '" + _FechaNacimiento + "',"; Sentencia += "Genero='" + _Genero + "',"; Sentencia += "Foto= @Foto"; Sentencia += " WHERE IDEmpleado=" + _IDEmpleado + ";"; MySqlParameter param = new MySqlParameter("@Foto", MySqlDbType.MediumBlob); byte[] buffer = Functions.Class1.ImageToByteArray(_Foto); param.Size = buffer.Length; param.Value = buffer; DataController.Operacion oOperacion = new DataController.Operacion(); try { if (oOperacion.Actualizar(Sentencia, param) > 0) { ok = true; } } catch { } return(ok); }
private void CargarDatos() { DataController.Operacion oConsulta = new DataController.Operacion(); DataTable Datos = new DataTable(); Datos = oConsulta.Consultar("Select * from Roles;"); dtgTabla.DataSource = Datos; }
public static DataTable PERMISOS_DE_UN_USUARIO(String pIDRol) { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDOpcion,(Select Opcion from Opciones r where r.IDOpcion=p.IDOpcion) as 'Opcion' FROM sifbd.permisos p where IDRol=" + pIDRol + ";"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_PRODUCTOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT a.IDProducto, a.Nombre, a.Alias, a.Codigo, a.Imagen, a.Descripcion,a.PrecioDeVenta, a.Costo, a.IDCategoria,b.Nombre as Categoria FROM productos a, categorias b WHERE a.IDCategoria=b.IDCategoria;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_CLIENTES() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDCliente, Nombres, Apellidos, Direccion, Telefono FROM clientes ORDER BY Nombres ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_EMPLEADOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDEmpleado, Nombres, Apellidos, Direccion, Telefono, FechaNacimiento, Email, Genero,DUI,Foto FROM empleados ORDER BY Apellidos ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_USUARIOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT a.IDUsuario, a.Usuario, a.Credencial, a.IDEmpleado, a.IDRol, b.Nombres, b.Apellidos, c.Rol FROM usuarios a, empleados b, roles c WHERE a.IDEmpleado = b.IDEmpleado AND a.IDRol = c.IDRol ORDER BY Usuario ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODAS_LAS_CATEGORIAS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDCategoria, Nombre, Descripcion FROM categorias ORDER BY Nombre ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODAS_LAS_FOTOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDFotoEmpleado, IDEmpleado, Foto, Fecha FROM fotosempleados;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODAS_LAS_OPCIONES() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDOpcion, Opcion, Clasificacion FROM opciones ORDER BY Opcion ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_AUTORES() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDAutor, Nombre, Fecha_Nacimiento, Residencia FROM Autores ORDER BY Nombre ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable CONSULTAR_ID_FACTURA() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("select max(IDFacturaDeVenta) as 'IdFactura' from facturasdeventas;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_EMPLEADOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT a.IDEmpleado, a.Nombres, a.Apellidos, a.Direccion, a.Telefono, a.FechaNacimiento, a.Email, a.Genero, a.DUI, b.IDFotoEmpleado, b.Foto FROM empleados a, fotosempleados b WHERE a.IDEmpleado = b.IDEmpleado ORDER BY a.Apellidos ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_USUARIOS_PARA_REC_PASS(String pDUI) { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT CONCAT( b.Nombres,' ' ,b.Apellidos) AS Empleado, a.Credencial, b.DUI, b.Email FROM usuarios a, empleados b WHERE a.IDEmpleado = b.IDEmpleado and b.DUI=" + pDUI + ";"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable VALIDAR_USUARIO(String pUsuario, String pCredencial) { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT a.IDUsuario,a.Usuario, a.Credencial, a.IDEmpleado,CONCAT(b.Nombres,' ',b.Apellidos) as 'Empleado' ,a.IDRol,c.Rol FROM usuarios a, empleados b, roles c WHERE a.IDEmpleado=b.IDEmpleado AND a.IDRol=c.IDRol AND a.Usuario='" + pUsuario + "' AND a.Credencial=SHA1('" + pCredencial + "');"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODAS_LAS_EDITORIALES() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDEditorial, Nombre, Direccion, Telefono FROM Editoriales ORDER BY Nombre ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_ROLES() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDRol, Rol FROM roles ORDER BY Rol ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_USUARIOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDUsuario, Usuario, Credencial, IDEmpleado, IDRol FROM usuarios ORDER BY Usuario ASC;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable REPORTE_EMPLEADOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDEmpleado, Nombres, Apellidos,FechaNacimiento,Genero FROM empleados ORDER BY Apellidos, Nombres;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }
public static DataTable TODOS_LOS_ESTADOS() { DataTable Resultado = new DataTable(); StringBuilder Consulta = new StringBuilder(); Consulta.Append("SELECT IDEstado, Estado FROM Estados;"); DataController.Operacion oOperacion = new DataController.Operacion(); Resultado = oOperacion.Consultar(Consulta.ToString()); return(Resultado); }