Exemplo n.º 1
0
        public static void ReadProcessFileList(Dictionary <string, clsFileList> verifyFiles, Utils.FileStatus fileStatus)
        {
            WindART_SMIDataContext windARTDataContext = new WindART_SMIDataContext();

            var processFilesCollection = from processFiles in windARTDataContext.ProcessFiles
                                         where processFiles.FileStatus == (int)fileStatus
                                         select processFiles;

            foreach (var pf in processFilesCollection)
            {
                clsFileList fl = new clsFileList();
                fl.FullFilePath   = pf.Name;
                fl.FileLocationId = (int)pf.FileLocationId;
                if (pf.FileFormatId != null)
                {
                    fl.FileFormatId = (int)pf.FileFormatId;
                }
                //fl.Encrypted = pf.Encrypted.Equals('Y'); // should be a bool
                fl.ProcessFileId = pf.ProcessFileId;
                if (pf.SiteId != null)
                {
                    fl.SiteId = (int)pf.SiteId;
                }
                // never add the same file twice
                if (!verifyFiles.Keys.Contains(fl.FullFilePath))
                {
                    verifyFiles.Add(fl.FullFilePath, fl);
                }
            }
        }
Exemplo n.º 2
0
        public static void CopyFilesToDocumentLibrary(clsFileList cfl, Utils.FileStatus status, string logProcessName)
        {
            Dictionary <string, clsFileList> importFiles = new Dictionary <string, clsFileList>();

            importFiles.Add(cfl.FullFilePath, cfl);

            CopyFilesToDocumentLibrary(importFiles, status, logProcessName);
        }
Exemplo n.º 3
0
        //static string rootLocation = @"D:\";



        public static void RecordFileDetailsInDB(clsFileList cfl, string logProcessName)
        {
            Dictionary <string, clsFileList> importFiles = new Dictionary <string, clsFileList>();

            importFiles.Add(cfl.FullFilePath, cfl);

            RecordFileDetailsInDB(importFiles, logProcessName);
        }
Exemplo n.º 4
0
 public static Utils.FileStatus GetNextFileStatus(clsFileList cf)
 {
     if (cf.IsExcel())
     {
         return(Utils.FileStatus.ReadyForConvertion);
     }
     else if (cf.Encrypted)
     {
         return(Utils.FileStatus.ReadyForDecyption);
     }
     else
     {
         return(Utils.FileStatus.ReadyForImport);
     }
 }
Exemplo n.º 5
0
        public static void UpdateStatusInDB(clsFileList updateFile, FileStatus newStatus)
        {
            WindART_SMIDataContext windARTDataContext = new WindART_SMIDataContext();

            var ProcessedFilesQuery = from processedFiles in windARTDataContext.ProcessFiles
                                      where processedFiles.ProcessFileId == updateFile.ProcessFileId
                                      select processedFiles;

            // set db status
            // there should be only one, but do a foreach anyway
            foreach (ProcessFile pf in ProcessedFilesQuery)
            {
                pf.FileStatus = (int)newStatus;
            }
            windARTDataContext.SubmitChanges();
        }
Exemplo n.º 6
0
        public static void DeleteMissingFileinDB(clsFileList updateFile)
        {
            WindART_SMIDataContext windARTDataContext = new WindART_SMIDataContext();

            var ProcessedFilesQuery = from processedFiles in windARTDataContext.ProcessFiles
                                      where processedFiles.ProcessFileId == updateFile.ProcessFileId
                                      select processedFiles;

            // set db status
            // there should be only one, but do a foreach anyway
            foreach (ProcessFile pf in ProcessedFilesQuery)
            {
                windARTDataContext.ProcessFiles.DeleteOnSubmit(pf);
            }
            windARTDataContext.SubmitChanges();
        }
Exemplo n.º 7
0
        public static void ReadProcessFileList(Dictionary <string, clsFileList> verifyFiles, Utils.FileStatus fileStatus)
        {
            WindART_SMIDataContext windARTDataContext = new WindART_SMIDataContext();

            var processFilesCollection = from processFiles in windARTDataContext.ProcessFiles
                                         where processFiles.FileStatus == (int)fileStatus
                                         select processFiles;

            //Console.WriteLine("just before iterating results from processfile");
            //Console.ReadLine();

            foreach (var pf in processFilesCollection)
            {
                clsFileList fl = new clsFileList();
                fl.FullFilePath = pf.Name;
                //****comment out for production
                // fl.FullFilePath = pf.Name.Replace(@"D:\", @"\\10.254.13.3\");
                //***************************

                fl.FileLocationId = (int)pf.FileLocationId;
                if (pf.FileFormatId != null)
                {
                    fl.FileFormatId = (int)pf.FileFormatId;
                }
                //fl.Encrypted = pf.Encrypted.Equals('Y'); // should be a bool
                fl.ProcessFileId = pf.ProcessFileId;
                if (pf.SiteId != null)
                {
                    fl.SiteId = (int)pf.SiteId;
                }
                // never add the same file twice
                if (!verifyFiles.Keys.Contains(fl.FullFilePath))
                {
                    verifyFiles.Add(fl.FullFilePath, fl);
                }
                fl.FullFilePath = pf.Name.Replace(@"\\10.254.13.3\", @"D:\");
            }

            // Console.WriteLine("built list of files successfully");
            //Console.ReadLine();
        }