/// <summary>
 /// Supprimer le fichier EPUB
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BT_SuppBook_Click(object sender, EventArgs e)
 {
     //File.Delete(openFileDialog.FileName);
     Database.Requete("DELETE FROM LIVRE WHERE id_livre='" + livre.id_livre + "';");
     Database.Requete("DELETE FROM EDITER_LIVRE WHERE id_livre='" + livre.id_livre + "';");
     Database.Requete("DELETE FROM A_ECRIT WHERE id_livre='" + livre.id_livre + "';");
 }
Exemple #2
0
        /// <summary>
        /// Créer une nouvelle bibliothèque
        /// </summary>
        /// <param name="selectedPath">Chemin de destination</param>
        private void Option_CreateNew(string _selectedPath, string _selectedName, bool _display)
        {
            Manuel manuel = new Manuel();

            if ((Directory.Exists(_selectedPath)))
            {
                if (!File.Exists(_selectedPath + "\\data.sqlite"))
                {
                    SQLiteConnection.CreateFile(_selectedPath + "\\data.sqlite");
                    Database = new ConnectSQLite(_selectedPath + "\\" + "data.sqlite");
                    Database.OuvrirBDD();
                    Database.Requete(File.ReadAllText("sqlite.sql"));
                    Database.FermerBDD();
                    if (_display)
                    {
                        MessageBox.Show("Bibliothèque créée", "Bibliothèque", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    SetCurrent(_selectedPath, _selectedName);
                    manuel.CopyManuelEpub(Database, _selectedPath);
                }
                else
                {
                    MessageBox.Show("Une bibliothèque existe déjà à cet emplacement", "Bibliothèque", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Le dossier " + _selectedPath + " n'existe pas.", "Bibliothèque", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BTN_SauvegarderFinal_Click(object sender, EventArgs e)
        {
            Encoding encoding           = Encoding.ASCII;
            string   _where             = ResultatRecherche();
            string   INSERT_INTO_VALUES = "'" + TXT_NomSauvegarde.Text + "'";
            string   INSERT_INTO_COLUMN = "nomWhere";

            if (TXT_Titre.Text.Length != 0)
            {
                INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", '" + TXT_Titre.Text + "'";
                INSERT_INTO_COLUMN = INSERT_INTO_COLUMN + ", titreWhere";
            }/*
              * else
              * {
              * INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", ";
              * }*/

            if (CBX_Auteur.Text != "")
            {
                INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", '" + ListAuteur[CBX_Auteur.SelectedIndex] + "'";
                INSERT_INTO_COLUMN = INSERT_INTO_COLUMN + ", idAuteurWhere";
                //MessageBox.Show("TestAuteurPlein");
            }/*
              * else
              * {
              * INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", ''";
              * //MessageBox.Show("TestAuteurVide");
              * }*/

            if (CBX_Genre.Text != "")
            {
                INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", " + ListGenre[CBX_Genre.SelectedIndex];
                INSERT_INTO_COLUMN = INSERT_INTO_COLUMN + ", idGenreWhere";
                //MessageBox.Show("TestGenrePlein");
            }/*
              * else
              * {
              * INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", -1";
              * //MessageBox.Show("TestGenreVide");
              * }*/

            if (CBX_Serie.Text != "")
            {
                INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", " + ListSerie[CBX_Serie.SelectedIndex];
                INSERT_INTO_COLUMN = INSERT_INTO_COLUMN + ", idSerieWhere";
                //MessageBox.Show("TestSeriePlein");
            }/*
              * else
              * {
              * INSERT_INTO_VALUES = INSERT_INTO_VALUES + ", -1";
              * //MessageBox.Show("TestSerieVide");
              * }*/

            //MessageBox.Show("INSERT INTO SauvegardeRecherche ( " + INSERT_INTO_COL + " ) VALUES ( " + INSERT_INTO_VALUES + ")");
            Database.Requete("INSERT INTO SauvegardeRecherche ( " + INSERT_INTO_COLUMN + " ) VALUES ( " + INSERT_INTO_VALUES + ")");
            RAZControl();
            affichageTitreAuteurSerieEtiquette();
        }
Exemple #4
0
        public bool BookKobo(string targetPath)
        {
            bool flag = true;
            // Manuel Kobo
            string   sourceFileKobo = Path.Combine(sourcePath, bookKobo), hash, id_livre, id_collect, id_editeur, id_auteur;
            FileInfo fileInfo = new FileInfo(sourceFileKobo);

            fileInfo.CopyTo(targetPath + "\\" + bookKobo);
            string destiFinal = targetPath + "\\" + bookKobo;

            hash = Hachage.FileToHashMD5(destiFinal);

            id_livre   = ClassAjout.MakeID(new Random(), "L");
            id_collect = ClassAjout.MakeID(new Random(), "C");
            id_editeur = ClassAjout.MakeID(new Random(), "A");
            id_auteur  = ClassAjout.MakeID(new Random(), "E");

            Database.Requete("INSERT INTO AUTEUR (id_auteur, nom_auteur, prenom_auteur) VALUES ('" + id_auteur + "', 'Rakuten Kobo', 'Rakuten Kobo')");
            Database.Requete("INSERT INTO LIVRE (id_livre, titre, nbpages, evaluation, datepubli, chemin_livre, description, avancement, langue, hash, id_genre, id_tomes, id_serie) VALUES ('" + id_livre + "', 'Manuel d''utilisation de Kobo Aura 2ème édition', 62, 0, '01/09/2019', '\\Manuel utilisation Kobo.epub', 'Manuel Kobo utilisateur', 0, 'fr', '" + hash + "', 44, null, null)");
            Database.Requete("INSERT INTO COLLECT (id_collect, nom_collect) VALUES ('" + id_collect + "', 'Manuel Kobo')");
            Database.Requete("INSERT INTO EDITEUR (id_editeur, nom_editeur) VALUES ('" + id_editeur + "', 'Rakuten Kobo Inc')");
            Database.Requete("INSERT INTO EDITER_LIVRE (id_editeur, id_livre, id_collect, ISBN, pays) VALUES ('" + id_editeur + "', '" + id_livre + "', '" + id_collect + "', '5215220101221', 'France')");
            Database.Requete("INSERT INTO A_ECRIT (id_livre, id_auteur) VALUES ('" + id_livre + "', '" + id_auteur + "')");

            return(flag);
        }