Exemplo n.º 1
0
        public bool Consultar()
        {
            MySqlConnection cnn      = new MySqlConnection();
            conexionbd      conectar = new conexionbd();

            cnn = conectar.obtenerconexion();


            string Consultasol = "select * from testadosol";


            MySqlCommand cmd = new MySqlCommand(Consultasol, cnn);


            OCommand = cmd;

            // OCommand.Connection = cnn;
            //   OCommand.CommandText = Consultasol;
            try
            {
                OReader = OCommand.ExecuteReader();
                return(true);
            }
            catch (Exception ex)
            {
                _Error = ex.Message + "Consultar en Conexionbd.cs";
                return(false);
            }
        }
Exemplo n.º 2
0
        public Boolean insertararchivo(string nombre, string ext, string contentType, byte[] imagen)
        {
            MySqlConnection cnn      = new MySqlConnection();
            conexionbd      conectar = new conexionbd();

            cnn = conectar.obtenerconexion();



            String selectss = " insert into carga (nombre,ext,ctype,imagen)  values ('" + nombre + " ','" + ext + "','" + contentType + "','" + imagen + "')";

            try
            {
                MySqlCommand mycomand = new MySqlCommand(selectss, cnn);

                mycomand.ExecuteNonQuery();
                cnn.Close();


                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public MySqlDataReader consultarlogin(string struser, string strpass)
        {
            conexionbd      conectar = new conexionbd();
            String          query    = "select cod_auto,id_rol from logins where nom_usuario='" + struser + "' and pass='******' ";
            MySqlCommand    mycomand = new MySqlCommand(query, conectar.obtenerconexion());
            MySqlDataReader myreader = mycomand.ExecuteReader();

            try
            {
                myreader.Read();
            }
            catch (Exception erro)
            {
                //   validausuario.Visible = true;
            }
            return(myreader);
        }
Exemplo n.º 4
0
        public bool LlenarDataSet()
        {
            if (_MYSQL == "")
            {
                _Error = "No definio la instrucción SQL";
                return(false);
            }
            if (_NombreTabla == "")
            {
                _Error = "No definio el nombre de la tabla";
                return(false);
            }


            MySqlConnection cnn      = new MySqlConnection();
            conexionbd      conectar = new conexionbd();

            cnn = conectar.obtenerconexion();


            // string Consultasol = "select * from testadosol";
            string Consultasol = "SELECT Num_ticket as Ticket , nom_usr as Nombre, ape_usr as Apellido, ced_usr as Cedula,tel_usr as Telefono,placa_ve as Placa, testadosol.desc_estado as Estado , tresponsable.Nomb_resp as Responsable,fecha as Fecha_Creacion,fecUlmodificacion as Fecha_Ult_modificación from tsolicitudes inner join testadosol on testadosol.Id_estado_sol= tsolicitudes.Id_estado_sol  inner join tresponsable on tresponsable.id_resp= tsolicitudes.id_resp  order by fecha desc";


            try
            {
                MySqlCommand cmd = new MySqlCommand(Consultasol, cnn);


                OCommand = cmd;
                MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                OAdapter = da;
                OAdapter.Fill(ODataSet, _NombreTabla);



                return(true);
            }
            catch (Exception ex)
            {
                _Error = ex.Message + "Mamiño";
                return(false);
            }
        }
Exemplo n.º 5
0
        public DataSet CargarSolicitudes(string ced, string tk, string placa, int llama)
        {
            MySqlConnection cnn      = new MySqlConnection();
            conexionbd      conectar = new conexionbd();

            cnn = conectar.obtenerconexion();



            DataSet dt = new DataSet();

            //   using (SqlConnection cnn = new SqlConnection("Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True"))
            conectar.obtenerconexion();
            string Consultasol = "";

            if (llama == 1)
            {
                Consultasol = "SELECT Num_ticket as Ticket , nom_usr as Nombre, ape_usr as Apellido, ced_usr as Cedula,tel_usr as Telefono,placa_ve as Placa, testadosol.desc_estado as Estado , tresponsable.Nomb_resp as Responsable,fecha as Fecha_Creacion,fecUlmodificacion as Fecha_Ult_modificación from tsolicitudes inner join testadosol on testadosol.Id_estado_sol= tsolicitudes.Id_estado_sol  inner join tresponsable on tresponsable.id_resp= tsolicitudes.id_resp where ced_usr like'" + ced + "%' and Num_Ticket like'" + tk + "%'  and placa_ve like'" + placa + "%' order by fecha desc";
            }
            else if (llama == 2)
            {
                Consultasol = "select Num_Ticket as Ticket, nom_usr as Nombre_Usuario, ape_usr as Apellido,placa_ve as Placa, tresponsable.Nomb_resp as Responsable, tsolicitudes.fecha from tsolicitudes inner join tresponsable on tsolicitudes.id_resp = tresponsable.id_resp  where tsolicitudes.Id_estado_sol < 3 order by fecha desc";
            }

            if (llama == 3)
            {
                Consultasol = "select Num_Ticket as Ticket, nom_usr as Nombre_Usuario, ape_usr as Apellido,placa_ve as Placa, tresponsable.Nomb_resp as Responsable,testadosol.desc_estado as Estado_Solicitud, tsolicitudes.fecha from tsolicitudes  inner join tresponsable on tsolicitudes.id_resp = tresponsable.id_resp  inner join testadosol on tsolicitudes.Id_estado_sol = testadosol.Id_estado_sol order by fecha desc";
            }


            try
            {
                MySqlCommand cmd = new MySqlCommand(Consultasol, cnn);

                MySqlDataAdapter da = new MySqlDataAdapter(cmd);

                da.Fill(dt);
            }
            catch (Exception erro)
            {
            }

            return(dt);
        }
Exemplo n.º 6
0
        public DataSet llenarddl(int llama, int est)
        {
            MySqlConnection cnn      = new MySqlConnection();
            conexionbd      conectar = new conexionbd();

            cnn = conectar.obtenerconexion();
            conectar.obtenerconexion();
            string Consultasol = "";

            if (llama == 2)
            {
                Consultasol = "select Id_estado_sol,desc_estado from testadosol ";
            }

            if (llama == 3)

            {
                Consultasol = "select Id_estado_sol,desc_estado from testadosol where Id_estado_sol='" + est + "' ";
            }
            DataSet dt = new DataSet();

            conectar.obtenerconexion();


            try
            {
                MySqlCommand     cmd = new MySqlCommand(Consultasol, cnn);
                MySqlDataAdapter da  = new MySqlDataAdapter(cmd);
                da.Fill(dt);
            }
            catch (Exception erro)
            {
            }


            return(dt);
        }