Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO roles(Rol) values(";
            Sentencia += "'" + _Rol + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 5
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO usuarios(Usuario,Credencial,IDEmpleado,IDRol) values(";
            Sentencia += "'" + _Usuario + "'," + "SHA1('" + _Credencial + "'),'" + _IDEmpleado + "','" + _IDRol + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 6
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO productos(Nombre,Alias,Codigo,Descripcion,IDCategoria,PrecioDeVenta,Costo) values(";
            Sentencia += "'" + _Nombre + "','" + _Alias + "','" + _Codigo + "','" + _Descripcion + "','" + _IDCategoria + "','" + _PrecioDeVenta.ToString().Replace(",", ".") + "','" + _Costo.ToString().Replace(",", ".") + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 7
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO empleados(Nombres,Apellidos,Direccion,telefono,FechaNacimiento,Genero,DUI,Email,Foto) values(";
            Sentencia += "'" + _Nombres + "','" + _Apellidos + "','" + _Direccion + "','" + _Telefono + "','" + _FechaNacimiento + "','" + _Genero + "','" + _DUI + "','" + _Email + "',@Imagen";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia, _Foto) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 8
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO detallesfacturas(Cantidad, Precio, NombreProducto, IDProducto, IDFacturaDeVenta, Exento, Gravado, NoSujeto) values(";
            Sentencia += "'" + _Cantidad + "','" + _Precio.ToString().Replace(",", ".") + "','" + _NombreProducto + "','" + _IDProducto + "','" + _IDFacturaDeVenta + "','" + _Exento.Replace(",", ".") + "','" + _Gravado.Replace(",", ".") + "','" + _NoSujeto.Replace(",", ".") + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 9
0
Archivo: Empleado.cs Proyecto: Ede4g/em
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO empleados(Nombres,Apellidos,FechaNacimiento,Genero) values(";
            Sentencia += "'" + _Nombres + "','" + _Apellidos + "','" + _FechaNacimiento + "','" + _Genero + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 10
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO clientes(Nombres, Apellidos, Direccion, Telefono) values(";
            Sentencia += "'" + _Nombres + "','" + _Apellidos + "','" + _Direccion + "','" + _Telefono + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 11
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO fotosempleados(IDEmpleado, Foto, Fecha) values(";
            Sentencia += "'" + _IDEmpleado + "','" + _Foto + "','" + _Fecha + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 12
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO categorias(Nombre,Descripcion) values(";
            Sentencia += "'" + _Nombre + "','" + _Descripcion + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 13
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO facturasdeventas(Fecha, FormasDePago, IDCliente, IDEmpleado, Excento, Gravado, NoSujeto, MontoDeIVa, SubTotal, TotalAPagar) values(";
            Sentencia += "'" + _Fecha + "','" + _FormasDePago + "','" + _IDCliente + "','" + _IDEmpleado + "','" + _Excento + "','" + _Gravado + "','" + _NoSujeto + "','" + _MontoDeIVA + "','" + _SubTotal + "','" + _TotalAPagar + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 14
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO facturasdeventas(NumeroDeFactura, Fecha, FormaDePago, TotalAPagar, IDEmpleado, IDCliente) values(";
            Sentencia += "'" + _NumeroDeFactura + "','" + _Fecha + "','" + _FormaDePago + "','" + _TotalAPagar.ToString().Replace(",", ".") + "','" + _IDEmpleado + "','" + _IDCliente + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 15
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO detallesfacturas(Cantidad, PrecioDeVenta, NombreProducto, IDProducto, IDFacturaDeVenta, Descripcion) values(";
            Sentencia += "'" + Cantidad + "','" + PrecioDeVenta + "','" + NombreProducto + "','" + IDProducto + "','" + IDFacturaDeVenta + "','" + Descripcion + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch { }
            return(ok);
        }
Ejemplo n.º 16
0
        public Boolean Conceder()
        {
            Boolean Concedido = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO permisos(IDRol, IDOpcion) values(";
            Sentencia += "'" + _IDRol + "',";
            Sentencia += "'" + _IDOpcion + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    Concedido = true;
                }
            }
            catch { }
            return(Concedido);
        }
Ejemplo n.º 17
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO Categorias(Categoria) VALUES(";
            Sentencia += "'" + _Categoria + "'";
            Sentencia += ");";
            DataController.Operacion oOperacion = new DataController.Operacion();
            try
            {
                if (oOperacion.Insertar(Sentencia) > 0)
                {
                    ok = true;
                }
            }
            catch
            { }
            return(ok);
        }
Ejemplo n.º 18
0
        public Boolean Insertar()
        {
            Boolean ok        = false;
            String  Sentencia = String.Empty;

            Sentencia += "INSERT INTO lectores(Usuario, Credencial, Nombres, Apellidos, FechaNacimiento, Genero, MaxPrestamo, Credibilidad, MaxTiempoPrestamo, Fecha_Inicio, Foto) VALUES(";
            Sentencia += "'" + _Usuario + "',";
            Sentencia += "SHA1('" + _Credencial + "'),";
            Sentencia += "'" + _Nombres + "',";
            Sentencia += "'" + _Apellidos + "',";
            Sentencia += "'" + _FechaNacimiento + "',";
            Sentencia += "'" + _Genero + "',";
            Sentencia += "'" + _MaxPrestamo + "',";
            Sentencia += "'" + _Credibilidad + "',";
            Sentencia += "'" + _MaxTiempoPrestamo + "',";
            Sentencia += "'" + _Fecha_inicio + "',";
            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);
        }