Exemple #1
0
 private void AddFilesToDatabase(DvdFolderToImport dvdFolder)
 {
     if (!dvdFolder.IsReadyToImport)   // throw a NotReadyToImportException or something
     {
     }
     fileRepository.Add(dvdFolder.Files);
 }
        public void AddDisc(DvdFolderToImport dvd)
        {
            AccessRetriever retriever = new AccessRetriever(DatabasePath);

            try {
                DataSet dataSet = retriever.GetDiscs();
                DataRow newDisc = dataSet.Tables[0].NewRow();
                newDisc["DiscName"] = dvd.DiscName;
                newDisc["Wallet"]   = dvd.WalletType;
                newDisc["Notes"]    = dvd.Notes;
                dataSet.Tables[0].Rows.Add(newDisc);
                retriever.UpdateDiscs(dataSet);
            }
            catch (Exception e) {
                Log.Error(e, "Error adding disc {0} to database", dvd.DiscName);
            }
        }
Exemple #3
0
 public OperationResult Import(DvdFolderToImport dvdFolder)
 {
     try {
         dvdFolder.DatabaseId = discRepository.Add(dvdFolder);
         dvdFolder.SetFilesDiscId();
         AddFilesToDatabase(dvdFolder);
         var fileDtosFromDatabase = fileRepository.GetByDisc((int)dvdFolder.DatabaseId);
         dvdFolder.SetFilesIdsFromDatabase(fileDtosFromDatabase);
         var joinDtos = dvdFolder.GetPerformerFilenameJoinDtos();
         performerRepository.JoinPerformerToFile(joinDtos);
     }
     catch (Exception e) {
         Log.Error(e, "Import failed!");
         return(new OperationResult()
         {
             Success = false,
             Message = $"Error importing {dvdFolder.DiscName}"
         });
     }
     return(new OperationResult()
     {
         Success = true, Message = null
     });
 }