Esempio n. 1
0
        public void Add(List <FileLocalDto> fileDtos)
        {
            AccessRetriever retriever = new AccessRetriever(databasePath);

            DataSet   dataSet        = RetrieveFileEntriesFromDatabase(retriever);
            DataTable filenamesTable = dataSet.Tables[0];

            foreach (FileLocalDto file in fileDtos)
            {
                DataRow newRow = filenamesTable.NewRow();
                newRow["Filename"] = file.Filename;
                newRow["Genre"]    = file.Genre;
                newRow["Disc"]     = file.Disc;
                if (file.Series is null)
                {
                    newRow["Series"] = DBNull.Value;
                }
                else
                {
                    newRow["Series"] = file.Series;
                }
                if (file.Notes is null)
                {
                    newRow["Notes"] = DBNull.Value;
                }
                else
                {
                    newRow["Notes"] = file.Notes;
                }
                filenamesTable.Rows.Add(newRow);
            }
            retriever.UpdateFileEntries(dataSet);
        }
        public void UpdateFileEntries_Temp_ActuallyUpdateFileEntries()
        {
            string          dbLocation  = @"c:\temp\Files on Dvd.accdb";
            AccessRetriever myRetriever = new AccessRetriever(dbLocation);
            DataSet         dataSet     = myRetriever.GetFileEntries();
            DataRow         newEntry    = dataSet.Tables[0].NewRow();

            newEntry["Filename"] = "Succession - 1.01 - Pilot";
            newEntry["Genre"]    = 3;
            newEntry["Disc"]     = 224;
            newEntry["Series"]   = 14;
            dataSet.Tables[0].Rows.Add(newEntry);

            DataRow newEntry2 = dataSet.Tables[0].NewRow();

            newEntry2["Filename"] = "Buffy the Vampire Slayer - 1.01 - Welcome to the Hellmouth";
            newEntry2["Genre"]    = 3;
            newEntry2["Disc"]     = 224;
            newEntry2["Series"]   = 15;
            dataSet.Tables[0].Rows.Add(newEntry2);

            myRetriever.UpdateFileEntries(dataSet);
            Console.WriteLine("Debug this line");
        }