コード例 #1
0
        public string loadFileInfo(string path, string fileName, string userID)
        {
            int lineCount = System.IO.File.ReadLines(path).Count();

            using (var streamReader = System.IO.File.OpenText(path))
            {
                string source = streamReader.ReadLine();
                //confirm filetype and detect seperator
                LoadViewModel LoadView  = new LoadViewModel();
                string        fileType  = LoadView.DetectFileType(source);
                char          seperator = LoadView.DetectDelimeter(source);

                string loadid;

                LoadedFiles ctx        = new LoadedFiles();
                LoadedFile  loadedfile = new LoadedFile {
                    LoadedFileID = Guid.NewGuid(), FileName = fileName, FileType = fileType, FileImportDate = DateTime.Now, UserID = userID, LineCount = lineCount
                };
                ctx.DBLoadedFiles.Add(loadedfile);
                ctx.SaveChanges();

                loadid = loadedfile.LoadedFileID.ToString();

                return(loadid);
            }
        }
コード例 #2
0
 public void progressupdate(Guid id)
 {
     using (var context = new LoadedFiles())
     {
         var result = context.DBLoadedFiles.SingleOrDefault(b => b.LoadedFileID == id);
         if (result != null)
         {
             result.Progress = 100;
             context.SaveChanges();
         }
     }
 }