Example #1
0
        public void deleteServTec(ServicoTecnico servTec)
        {
            string sql = "DELETE FROM servico_tecnicos WHERE id = " + servTec.Id;

            MySqlConnection conn = new Conn().conectar();

            new Conn().executar(sql, conn);
            conn.Close();
        }
Example #2
0
        public void addTecServ(object sender, EventArgs e)
        {
            int ueAdd = Int32.Parse(servTecsEmp.SelectedValue);

            ServicoTecnico servTec = new ServicoTecnico(0, servicoget, ueAdd, 0, "-");

            new ServicoTecnicoDAO().insertServTec(servTec);
            Response.Redirect("servicoDetalhes.aspx?idSerDet=" + servicoget);
        }
Example #3
0
        private ServicoTecnico preencherServTec(MySqlDataReader reader)
        {
            ServicoTecnico servTec = new ServicoTecnico();

            servTec.Id      = reader.GetInt32(0);
            servTec.IdServ  = reader.GetInt32(1);
            servTec.IdTec   = reader.GetInt32(2);
            servTec.RepServ = reader.GetInt32(3);
            servTec.ObsUser = reader.GetString(4);
            return(servTec);
        }
Example #4
0
        public ServicoTecnico selectServTec(int id)
        {
            string          sql     = "SELECT * FROM servico_tecnicos WHERE id = " + id;
            ServicoTecnico  servTec = new ServicoTecnico();
            MySqlConnection conn    = new Conn().conectar();
            MySqlDataReader reader  = new Conn().consultar(sql, conn);

            while (reader.Read() && reader.HasRows)
            {
                servTec = preencherServTec(reader);
            }
            conn.Close();
            return(servTec);
        }
Example #5
0
        public void updateServTec(ServicoTecnico servTec)
        {
            string sql = "UPDATE servico_tecnicos " +
                         " SET id_servico = " + servTec.IdServ + ", " +
                         "id_tecnico = " + servTec.IdTec + ", " +
                         "reputacao_servico = " + servTec.RepServ + ", " +
                         "obs_usuario = '" + servTec.ObsUser + "' " +
                         " WHERE id  = " + servTec.Id + " ";

            MySqlConnection conn = new Conn().conectar();

            new Conn().executar(sql, conn);
            conn.Close();
        }
Example #6
0
        public void insertServTec(ServicoTecnico servTec)
        {
            //Vou deixar bem separado o que é oq pra ficar mais claro
            string sql = "INSERT INTO servico_tecnicos (id, id_servico, id_tecnico, reputacao_servico, obs_usuario) " +
                         " VALUES( " +
                         " NULL, " +
                         " " + servTec.IdServ + ", " +
                         " " + servTec.IdTec + ", " +
                         " " + servTec.RepServ + ", " +
                         " '" + servTec.ObsUser + "' " +
                         "); ";

            MySqlConnection conn = new Conn().conectar();

            new Conn().executar(sql, conn);
            conn.Close();
        }
Example #7
0
        public List <ServicoTecnico> selectAllServTecs()
        {
            string sql = "SELECT * FROM servico_tecnicos";
            List <ServicoTecnico> servTecs = new List <ServicoTecnico>();
            ServicoTecnico        servTec  = new ServicoTecnico();
            MySqlDataReader       reader   = null;
            MySqlConnection       conn     = new Conn().conectar();

            reader = new Conn().consultar(sql, conn);

            while (reader.Read() && reader.HasRows)
            {
                servTec = preencherServTec(reader);
                servTecs.Add(servTec);
            }
            conn.Close();
            return(servTecs);
        }