public void updateRechercheInternet(RechercheInternet r) { using (SQLiteCommand command = new SQLiteCommand("INSERT OR REPLACE INTO " + TABLE_RECHERCHES + "(" + RECHERCHE_NOM + "," + RECHERCHE_RANG + "," + RECHERCHE_URL_FILM + "," + RECHERCHE_URL_RECHERCHE + "," + RECHERCHE_XPATH_ACTEURS + "," + RECHERCHE_XPATH_AFFICHE + "," + RECHERCHE_XPATH_DATESORTIE + "," + RECHERCHE_XPATH_GENRES + "," + RECHERCHE_XPATH_NATIONALITE + "," + RECHERCHE_XPATH_REALISATEUR + "," + RECHERCHE_XPATH_RECHERCHE + "," + RECHERCHE_XPATH_RESUME + ")" + " VALUES (@nom, @rang, @urlfilm, @urlrecherche, @acteurs, @affiche, @datesortie, @genres, @nationalite, @realisateur, @recherche, @resume)")) { command.Parameters.AddWithValue("@nom", r.nom); command.Parameters.AddWithValue("@rang", r.rang); command.Parameters.AddWithValue("@urlfilm", r.formatUrlFilm); command.Parameters.AddWithValue("@urlrecherche", r.formatUrlRecherche); command.Parameters.AddWithValue("@acteurs", r.xpathActeurs); command.Parameters.AddWithValue("@affiche", r.xpathAffiche); command.Parameters.AddWithValue("@datesortie", r.xpathDateSortie); command.Parameters.AddWithValue("@genres", r.xpathGenres); command.Parameters.AddWithValue("@nationalite", r.xpathNationalite); command.Parameters.AddWithValue("@realisateur", r.xpathRealisateur); command.Parameters.AddWithValue("@recherche", r.xpathRecherche); command.Parameters.AddWithValue("@resume", r.xpathResume); executeNonQuery(command); } }
private void onClicButtonNext(object sender, EventArgs e) { if (listViewRecherches.SelectedIndices.Count == 0) { return; } int selected = listViewRecherches.SelectedIndices[0]; if (selected < listViewRecherches.Items.Count - 1) { List <RechercheInternet> liste = BaseConfiguration.instance.getListeRechercheInternet(); RechercheInternet r = liste[selected]; liste.RemoveAt(selected); liste.Insert(selected + 1, r); for (int i = 0; i <= selected + 1; i++) { liste[i].rang = i; BaseConfiguration.instance.updateRechercheInternet(liste[i]); } remplitListeRecherches(); listViewRecherches.SelectedItems.Clear(); listViewRecherches.Items[selected + 1].Selected = true;; } }
/// <summary> /// Modifier un site de recherche /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonEditClick(object sender, EventArgs e) { if (listViewRecherches.SelectedIndices.Count == 0) { return; } string nom = listViewRecherches.Items[listViewRecherches.SelectedIndices[0]].Text; if (nom == null) { return; } EditeRechercheInternet dlg = new EditeRechercheInternet(); dlg.rechercheInternet = BaseConfiguration.instance.getRechercheInternet(nom); if (dlg.ShowDialog(this) == DialogResult.OK) { RechercheInternet r = dlg.rechercheInternet; if (r != null) { r.rang = listViewRecherches.Items.Count; BaseConfiguration.instance.updateRechercheInternet(r); remplitListeRecherches(); } } }
/// <summary> /// Ajouter un site de recherche internet /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonAddClick(object sender, EventArgs e) { EditeRechercheInternet dlg = new EditeRechercheInternet(); if (dlg.ShowDialog(this) == DialogResult.OK) { RechercheInternet r = dlg.rechercheInternet; if (r != null) { r.rang = listViewRecherches.Items.Count; BaseConfiguration.instance.addRechercheInternet(r); remplitListeRecherches(); } } }
private async void onClickItemRechargerDepuis(object sender, EventArgs e) { Film selected = getSelectedFilm(); if (selected == null) { return; } ToolStripLabel l = sender as ToolStripLabel; if (l != null) { RechercheInternet ri = l.Tag as RechercheInternet; if (ri != null) { WriteMessageToConsole($"Recherche de {selected.Titre} sur {ri.nom}"); selected.Etat = Film.ETAT.RECHERCHE; update(selected); // Ajouter recherche internet forcee sur ce site _actionsDifferees.ajoute(new ActionChargeSite(selected, ri.nom), ActionsDifferees.PRIORITE.HAUTE); } } }
private bool valide() { string message = ""; if (textBoxNom.Text.Length == 0) { message += "Le nom ne doit pas être vide\n"; textBoxNom.BackColor = Color.Salmon; } else { textBoxNom.BackColor = SystemColors.Window; } if (!textBoxFormatURLRecherche.Text.Contains("{0}")) { message += "Le format d'URL pour la recherche du fichier doit comporter {0} qui sera remplacé par le titre du film.\n"; textBoxFormatURLRecherche.BackColor = Color.Salmon; } else { textBoxFormatURLRecherche.BackColor = SystemColors.Window; } if (textBoxXPathRecherche.Text.Length == 0) { message += "Le XPath de recherche ne doit pas être vide\n "; textBoxXPathRecherche.BackColor = Color.Salmon; } else { textBoxXPathRecherche.BackColor = SystemColors.Window; } if (!textBoxFormatUrlFilm.Text.Contains("{0}")) { message += "Le format d'URL pour la page du film doit comporter {0} qui sera remplacé par le titre du film.\n"; textBoxFormatUrlFilm.BackColor = Color.Salmon; } else { textBoxFormatUrlFilm.BackColor = SystemColors.Window; } if (message.Length > 0) { MessageBox.Show(this, message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (rechercheInternet == null) { rechercheInternet = new RechercheInternet(); } rechercheInternet.nom = textBoxNom.Text; rechercheInternet.formatUrlRecherche = textBoxFormatURLRecherche.Text; rechercheInternet.xpathRecherche = textBoxXPathRecherche.Text; rechercheInternet.formatUrlFilm = textBoxFormatUrlFilm.Text; rechercheInternet.xpathRealisateur = textBoxXPathRealisateur.Text; rechercheInternet.xpathActeurs = textBoxXPathActeurs.Text; rechercheInternet.xpathGenres = textBoxXPathGenres.Text; rechercheInternet.xpathNationalite = textBoxXPathNationalite.Text; rechercheInternet.xpathResume = textBoxXPathResume.Text; rechercheInternet.xpathDateSortie = textBoxXPathDateSortie.Text; rechercheInternet.xpathAffiche = textBoxXPathAffiche.Text; return(true); }