示例#1
0
        public int GetIDOperador(string NomeOperador)
        {
            this.Conect();
            Operador o = new Operador();

            sql = "SELECT id, nome, cpf, email, telefone, nascimento, endereco, turno FROM tboperador where nome = @nome;";
            cmd = new NpgsqlCommand(sql, con);
            cmd.Parameters.AddWithValue("nome", NomeOperador);
            cmd.Prepare();
            rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                o.setId(rdr.GetInt32(0));
                o.setNome(rdr.GetString(1));
                o.setCpf(rdr.GetString(2));
                o.setEmail(rdr.GetString(3));
                o.setTelefone(rdr.GetString(4));
                o.setNascimento(rdr.GetString(5));
                o.setEndereco(rdr.GetString(6));
                o.setTurno(rdr.GetString(7));
            }
            this.Desconect();
            return(o.getId());
        }
示例#2
0
        public List <Operador> ListarOperador()
        {
            List <Operador> Lista = new List <Operador>();

            this.Conect();
            sql = "SELECT id, nome, cpf, email, telefone, nascimento, endereco, turno FROM tboperador order by id;";
            cmd = new NpgsqlCommand(sql, con);
            rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                //Console.WriteLine("{0}", rdr.GetInt32(0));
                Operador o = new Operador();
                o.setId(rdr.GetInt32(0));
                o.setNome(rdr.GetString(1));
                o.setCpf(rdr.GetString(2));
                o.setEmail(rdr.GetString(3));
                o.setTelefone(rdr.GetString(4));
                o.setNascimento(rdr.GetString(5));
                o.setEndereco(rdr.GetString(6));
                o.setTurno(rdr.GetString(7));
                Lista.Add(o);
            }
            this.Desconect();
            return(Lista);
        }
示例#3
0
        public Operador GetOperador(int idOperador)
        {
            this.Conect();
            Operador o = new Operador();

            sql = "SELECT id, nome, cpf, email, telefone, nascimento, endereco, turno FROM tboperador where id = @id;";
            cmd = new NpgsqlCommand(sql, con);
            cmd.Parameters.AddWithValue("id", idOperador);
            cmd.Prepare();
            rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                //Console.WriteLine("{0}", rdr.GetInt32(0));
                o.setId(rdr.GetInt32(0));
                o.setNome(rdr.GetString(1));
                o.setCpf(rdr.GetString(2));
                o.setEmail(rdr.GetString(3));
                o.setTelefone(rdr.GetString(4));
                o.setNascimento(rdr.GetString(5));
                o.setEndereco(rdr.GetString(6));
                o.setTurno(rdr.GetString(7));
            }
            this.Desconect();
            return(o);
        }