private void frmErga_Single_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] filePaths = (string[])(e.Data.GetData(DataFormats.FileDrop)); foreach (string fileLoc in filePaths) { // Code to read the contents of the text file if (File.Exists(fileLoc)) { using (TextReader tr = new StreamReader(fileLoc)) { tblFileDap newDap = new tblFileDap(); long fldFileId = newDap.InsertFile(fileLoc, 1, DateTime.Now); tblProjectFileDap newProjectFileDap = new tblProjectFileDap(); tblProjectFile ProjectFile = new tblProjectFile(); ProjectFile.fldFileID = fldFileId; ProjectFile.fldProjectID = _tblProject.fldProjectID; newProjectFileDap.Insert(ProjectFile); List<vwvwProjectFile> listOfFiles = new List<vwvwProjectFile>(); vwvwProjectFileDap ProjectFileDap = new vwvwProjectFileDap(); listOfFiles = ProjectFileDap.GetProjectFiles(_tblProject.fldProjectID); bsFiles.DataSource = listOfFiles; } } } } }
public List<tblProjectFile> GettblProjectFileByfldProjectID(Int64 fldProjectID) { using (var dap = new tblProjectFileDap(this)) { return dap.GetByfldProjectID(fldProjectID); } }