Beispiel #1
0
        private string storeInDatabase(string filePath, QueryObject downloadedFile)
        {
            string fileStoragePath = XmlTools.getStoragePath(downloadedFile);

            downloadedFile.SetField("FileStoragePath", fileStoragePath);

            if (!File.Exists(fileStoragePath))
            {
                try
                {
                    File.Move(filePath, fileStoragePath);
                    database.Add((DownloadedFileInfo)downloadedFile, Constants.database);
                    MessageBox.Show("File downloaded and stored in " + fileStoragePath);
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString());
                }
            }
            else
            {
                MessageBox.Show("file already present in database ");
            }
            File.Delete(filePath);

            return(XmlTools.getFolderStoragePath(downloadedFile) + downloadedFile.GetField("InstanceNumber"));
        }