private void MoveFileToArchive(ResidentRollCall rc) { string fileName = rc.FileLocation + "\\" + rc.FileName; string movFile = _jarvis.InputFileArchiveLocation + "\\" + rc.FileName; DMFileManager.DataFile df = new DMFileManager.DataFile(); df.MoveFile(fileName, movFile); }
private void PopulateFieldList() { DMFileManager.DataFile df = new DMFileManager.DataFile(_fileExportBase.Jarvis.ExportFielFieldList); df.ImportData(); //List<string> fieldList = CommonFunctions.PropertiesFromType(Jarvis.ExportOjectType); _fieldListMapper = CommonFunctions.TableToFieldMapping(df.DataSource, _fileExportBase.Jarvis.ExportOjectType); BindingSource bs = new BindingSource(); dgFieldList.AutoGenerateColumns = false; bs.DataSource = _fieldListMapper; dgFieldList.DataSource = bs; dgFieldList.Refresh(); }
public void BackupDatabase() { string conString = DataAccess.Singleton.GetConnectionString(); string[] split = conString.Split('='); string databasePath = split[split.Length - 1].Replace(@"""", ""); string databaseBackupLocation = ConfigurationManager.AppSettings["DatabaseBackupLocation"]; //string DMFileManager.DataFile df = new DMFileManager.DataFile(databasePath); string backupFilePath = databaseBackupLocation + df.FileNameWithoutExtension + "_backup" + df.FileExtension; df.CopyFile(databasePath, backupFilePath); }
private void DragAndDropFile_DragDrop(object sender, DragEventArgs e) { ep.Clear(); btnSave.Enabled = false; var files = e.Data.GetData(DataFormats.FileDrop); string[] droppedFiles = (string[])files; try { if (droppedFiles.Length > 0) { DMFileManager.DataFile df1 = new DMFileManager.DataFile(droppedFiles[0]); if (df1.FileExtension.ToUpper() == ".XLSX" || df1.FileExtension.ToUpper() == ".XLS") { txtFileLocation.Text = df1.FolderName; txtFileName.Text = df1.FileName; if (CheckIfFileAlreadyImported()) { MessageBox.Show("'" + _residentRollCall.FileName + "' already imported", "Import Roll Call", MessageBoxButtons.OK, MessageBoxIcon.Error); txtFileLocation.Text = string.Empty; txtFileName.Text = string.Empty; } else { string[] arr = df1.FileName.Split('_'); _residentRollCall.MonthNumber = Convert.ToInt16(arr[1]); txtMonthName.Text = CommonFunctions.GetMonthName(Convert.ToInt16(arr[1])); _residentRollCall.MonthName = txtMonthName.Text; txtYearNumber.Text = arr[2]; txtRollReference.Text = arr[3]; ImportRollCall(); btnSave.Enabled = true; } } else { MessageBox.Show("Not a valid file type, only Excel files acceptable", "Drag and drop files", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Drag and drop files", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void txtFileDrop_DragDrop(object sender, DragEventArgs e) { ep.Clear(); var files = e.Data.GetData(DataFormats.FileDrop); string[] droppedFiles = (string[])files; try { if (droppedFiles.Length > 0) { DMFileManager.DataFile df1 = new DMFileManager.DataFile(droppedFiles[0]); txtFileLocation.Text = df1.FolderName; txtFileName.Text = df1.FileName; _incident.FileLocation = txtFileLocation.Text; _incident.FileName = txtFileName.Text; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Drag and drop files", MessageBoxButtons.OK, MessageBoxIcon.Information); } }