Beispiel #1
0
        //ELIMINAR Telefono de Taller
        public int eliminarTelefonoTaller(int cod)
        {
            NpgsqlConnection conn = DAOTelefono.getInstanceDAO();

            conn.Open();

            String        sql  = "DELETE FROM \"Telefono\" WHERE \"FK-TallerT\" = " + cod + "";
            NpgsqlCommand cmd  = new NpgsqlCommand(sql, conn);
            int           resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE

            conn.Close();

            return(resp);
        }
Beispiel #2
0
        //INSERTAR Telefono de Empleado
        public int insertarTelefonoEmp(int numero, int fkE)
        {
            NpgsqlConnection conn = DAOTelefono.getInstanceDAO();

            conn.Open();

            String sql = "INSERT INTO \"Telefono\" (\"COD\", \"Numero\", \"FK-Empleado\") " +
                         "VALUES ((SELECT NEXTVAL('seq'))," + numero + ", " + fkE + ")";
            NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);

            try
            {
                int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE
                conn.Close();
                return(resp);
            }
            catch
            {
                conn.Close();
                return(0);
            }
        }
Beispiel #3
0
        //MODIFICAR Telefono de Taller
        public int modificarTelefonoTaller(int fk, int numero)
        {
            NpgsqlConnection conn = DAOTelefono.getInstanceDAO();

            conn.Open();

            String sql = "UPDATE \"Telefono\" SET \"Numero\"='" + numero + "'" +
                         "WHERE \"FK-TallerT\"= " + fk + "";

            NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);

            try
            {
                int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE
                conn.Close();
                return(resp);
            }
            catch
            {
                conn.Close();
                return(0);
            }
        }