Exemple #1
0
        public static bool ObtenerEmpresas()
        {
            bool   retorno;
            string query = "SELECT * FROM tbempresa";

            try
            {
                MySqlCommand cmdselect = new MySqlCommand(string.Format(query), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdselect.ExecuteScalar());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
Exemple #2
0
        public static bool InfoMail(string idUsuario)
        {
            bool retorno;

            try
            {
                string       query     = "SELECT email FROM tbusuarios WHERE idUsuario = binary ?param1";
                MySqlCommand cmdselect = new MySqlCommand(string.Format(query), Conexion.getConnect());
                cmdselect.Parameters.Add(new MySqlParameter("param1", idUsuario));
                retorno = Convert.ToBoolean(cmdselect.ExecuteScalar());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
Exemple #3
0
        public static bool Acceso(string usuario, string clave)
        {
            bool retorno;

            try
            {
                string       query     = "SELECT * FROM tbusuarios WHERE Usuario = binary ?param1 AND Contrasenia = binary ?param2";
                MySqlCommand cmdselect = new MySqlCommand(string.Format(query), Conexion.getConnect());
                cmdselect.Parameters.Add(new MySqlParameter("param1", usuario));
                cmdselect.Parameters.Add(new MySqlParameter("param2", clave));
                retorno = Convert.ToBoolean(cmdselect.ExecuteScalar());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
        public static DataTable CargarTipoEmpresa()
        {
            DataTable data;

            try
            {
                string           query     = "SELECT * FROM tbtipo_empresa";
                MySqlCommand     cmdselect = new MySqlCommand(string.Format(query), Conexion.getConnect());
                MySqlDataAdapter adp       = new MySqlDataAdapter(cmdselect);
                data = new DataTable();
                adp.Fill(data);
                return(data);
            }
            catch (Exception)
            {
                return(data = null);
            }
            finally
            {
                Conexion.getConnect().Close();
            }
        }
Exemple #5
0
        //Metodo para mostrar los clientes en el data grid view
        public static DataTable ListaClientes()
        {
            DataTable data;

            try
            {
                string           query     = "SELECT * FROM tbcliente_persona";
                MySqlCommand     cmdselect = new MySqlCommand(string.Format(query), Conexion.getConnect());
                MySqlDataAdapter adp       = new MySqlDataAdapter(cmdselect);
                data = new DataTable();
                adp.Fill(data);
                return(data);
            }
            catch (Exception)
            {
                return(data = null);
            }
            finally
            {
                Conexion.getConnect().Close();
            }
        }
        public static bool registrarEmpresa(string NombreEmpresa, string Correo, string NIT, string Representante, string Direccion, int TipoEmpresa)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbempresa (Empresa, Correo, NIT, Representantelegal, idTipo_Empresa,Direccion) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", NombreEmpresa, Correo, NIT, Representante, TipoEmpresa, Direccion), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
        public static bool RegistrarClienteEmpresa(string NombreEmpresa, string Direccion, string Correo, int Estadocliente)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbcliente_empresa ( Nombre_Empresa,  Direccion, Correo, idEstado_Cliente) VALUES ('{0}', '{1}', '{2}', '{3}')", NombreEmpresa, Direccion, Correo, Estadocliente), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
Exemple #8
0
        //Registrar los datos ingresados en el formulario
        public static bool registrarmateriales(string NombreMaterial, string CodigoMaterial, double PrecioUnitario, string MarcaMaterial, int Proveedor, int Categoria, int Estado, string FechaIngreso, string Descripcion)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbmateriales (Nombre, Codigo, Precio_Unitario, Descripcion, Marca, idProveedor, idCategoria, idEstado_Material, Fecha_Ingreso) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}')", NombreMaterial, CodigoMaterial, PrecioUnitario, Descripcion, MarcaMaterial, Proveedor, Categoria, Estado, FechaIngreso), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
Exemple #9
0
        public static bool RegistrarProveedor(string DUI, string nombreProveedor, string direccion, string correoProveedor, string descripcion, int estadoProveedor)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbproveedor (NIF, Nombre,  Direccion, Correo,Descripcion, idEstado_Proveedor) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", DUI, nombreProveedor, direccion, correoProveedor, descripcion, estadoProveedor), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
Exemple #10
0
        //Registrar los datos ingresados en el formulario
        public static bool registrarCliente(string PrimerNombre, string SegundNombre, string PrimerApellido, string SegundoApellido, string fecha_nacimiento, string dui, string correo, string direccion, int estado)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbCliente_Persona (DUI, Nombre1, Nombre2, Apellido1, Apellido2, Fecha_Nacimineto, Direccion, Correo, idEstado_ClienteP) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}')", dui, PrimerNombre, SegundNombre, PrimerApellido, SegundoApellido, fecha_nacimiento, direccion, correo, estado), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }
        public static bool RegistrarUsuario(string Usuario, string Contraseña, string Nombre, string Apellido, string Correo, int idTipoUsuario)
        {
            bool retorno;

            try
            {
                MySqlCommand cmdinsert = new MySqlCommand(string.Format("INSERT INTO tbusuarios(Usuario, Contrasenia,  Nombre, Apellido, email, idTipo_Usuario) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", Usuario, Contraseña, Nombre, Apellido, Correo, idTipoUsuario), Conexion.getConnect());
                retorno = Convert.ToBoolean(cmdinsert.ExecuteNonQuery());
                return(retorno);
            }
            catch (Exception)
            {
                return(retorno = false);
            }
        }