private static void BindGridDataSource(DataGridView dataGridView, IList <RuntimeScriptFile> scriptFilesList) { dataGridView.BeginInvoke((MethodInvoker)(() => { dataGridView.DataSource = null; dataGridView.DataSource = scriptFilesList; foreach (DataGridViewRow currGridRow in dataGridView.Rows) { currGridRow.Cells[0].Value = currGridRow.Index + 1; currGridRow.Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleCenter; RuntimeScriptFile currRowFileInfo = currGridRow.DataBoundItem as RuntimeScriptFile; currGridRow.Cells[1].Style.BackColor = currRowFileInfo.HashDiffType switch { HashDiffType.NotExist => Color.White, HashDiffType.Different => Color.LightSalmon, HashDiffType.Equal => Color.LightGreen, HashDiffType.EqualVirtual => Color.LightSeaGreen, _ => Color.White, }; } if (dataGridView.RowCount > 0) { dataGridView.FirstDisplayedScrollingRowIndex = dataGridView.RowCount - 1; } })); }
public void AssertFileState(int fileIndex, string expectedFilename, HashDiffType expectedSyncState) { RuntimeScriptFile scriptFileState = _scriptFilesComparer.AllFileSystemScriptFiles[fileIndex]; Assert.That(scriptFileState.Filename == expectedFilename, $"{_testName} >>> The {fileIndex + 1}st {_scriptFilesComparer.ScriptFileType.FileTypeCode} file should be: '{expectedFilename}' but was: '{scriptFileState.Filename}'"); Assert.That(scriptFileState.HashDiffType == expectedSyncState, $"{_testName} >>> The {fileIndex + 1}st {_scriptFilesComparer.ScriptFileType.FileTypeCode} SyncType should be: '{expectedSyncState}' but was: '{scriptFileState.HashDiffType}'"); }
public override List <RuntimeScriptFile> GetPendingFilesToExecute(string targetScriptFilename) { if (string.IsNullOrWhiteSpace(targetScriptFilename)) { throw new ArgumentNullException(nameof(targetScriptFilename)); } if (targetScriptFilename.Trim().ToUpperInvariant() == RuntimeScriptFile.TargetNoneScriptFileName.Trim().ToUpperInvariant()) { return(new List <RuntimeScriptFile>()); } RuntimeScriptFile targetRuntimeScriptFile = GetTargetRuntimeScriptFile(targetScriptFilename); if (targetRuntimeScriptFile == null) { //Comment: targetScriptFile can be null if the user send #Last file, but thie is no file. return(new List <RuntimeScriptFile>()); } RuntimeScriptFile prevExecutionLastScriptFile = CreateLasetExecutedFileItem(); List <RuntimeScriptFile> pendingScriptFilesList = FilterPendingScriptsFilesByTarget(prevExecutionLastScriptFile, targetRuntimeScriptFile, AllFileSystemScriptFiles); return(pendingScriptFilesList); }
private void AppendNoneDBTargetState() { List <RuntimeScriptFile> incScripts = _dbVersionsViewModelData.ScriptFilesState.IncrementalScriptFilesComparer.AllFileSystemScriptFiles.ToList(); RuntimeScriptFile incNoneTargetState = new RuntimeScriptFile(new IncrementalScriptFileType(), "", RuntimeScriptFile.TargetNoneScriptFileName, 0); incScripts.Insert(0, incNoneTargetState); _dbVersionsViewModelData.IncrementalScriptFiles = incScripts; _dbVersionsViewModelData.TargetIncScriptFileName = RuntimeScriptFile.TargetNoneScriptFileName; //List<RuntimeScriptFile> rptScripts = _dbVersionsViewModelData.ScriptFilesState.RepeatableScriptFilesComparer.AllFileSystemScriptFiles.ToList(); //RuntimeScriptFile rptNoneTargetState = // new RuntimeScriptFile(new RepeatableScriptFileType(), "", RuntimeScriptFile.TargetNoneScriptFileName, 0); //rptScripts.Insert(0, rptNoneTargetState); //_dbVersionsViewModelData.RepeatableScriptFiles = rptScripts; //_dbVersionsViewModelData.TargetRptScriptFileName = RuntimeScriptFile.TargetNoneScriptFileName; //if (_dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer!= null) //{ // List<RuntimeScriptFile> dddScripts = _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.AllFileSystemScriptFiles.ToList(); // RuntimeScriptFile dddNoneTargetState = // new RuntimeScriptFile(new DevDummyDataScriptFileType(), "", RuntimeScriptFile.TargetNoneScriptFileName, 0); // dddScripts.Insert(0, dddNoneTargetState); // _dbVersionsViewModelData.DevDummyDataScriptFiles = dddScripts; // _dbVersionsViewModelData.TargetDDDScriptFileName = RuntimeScriptFile.TargetNoneScriptFileName; //} }
public void AppendExecutedFile(RuntimeScriptFile runtimeScriptFile) { runtimeScriptFile.ThrowIfNull(nameof(runtimeScriptFile)); runtimeScriptFile.ExecutedDateTime = DateTime.Now; ExecutedFiles.Add(runtimeScriptFile); }
public override List <RuntimeScriptFile> GetPendingFilesToExecute(string targetScriptFilename) { RuntimeScriptFile prevExecutionLastScriptFile = CreateLasetExecutedFileItem(); List <RuntimeScriptFile> pendingScriptFilesList = FilterPendingScriptsFilesByTarget(prevExecutionLastScriptFile, null, AllFileSystemScriptFiles); return(pendingScriptFilesList); }
public ExecuteSingleFileScriptStep(ExecuteScriptBlockStepFactory executeScriptBlockStepFactory, DBCommands dbCommands, string stepName, RuntimeScriptFile scriptFile) { dbCommands.ThrowIfNull(nameof(dbCommands)); _stepName = stepName; _scriptFile = scriptFile; _dbCommands = dbCommands; _executeScriptBlockStepFactory = executeScriptBlockStepFactory; }
public override void Execute(DBVersionsProcessContext processContext) { processContext.ThrowIfNull(nameof(processContext)); DBVersionsProcessArgs dbVersionsProcessArgs = processContext.ProcessArgs as DBVersionsProcessArgs; var scriptFilesComparer = processContext.ScriptFilesState.ScriptFilesComparers[_scriptFileType.FileTypeCode]; RuntimeScriptFile newScriptFile = scriptFilesComparer.CreateNextNewScriptFile(dbVersionsProcessArgs.NewScriptName); processContext.Results = newScriptFile.FileFullPath; }
private void DgIncrementalScriptsFiles_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { RuntimeScriptFile currScriptFileInfo = (dgIncrementalScriptsFiles.DataSource as List <RuntimeScriptFile>)[e.RowIndex]; Task task = ViewModel.SelectTargetIncScriptFileNameCommand.ExecuteWrapped(currScriptFileInfo.Filename); task.Wait(); MarkUnMarkSelectedTargetInGrid(dgIncrementalScriptsFiles, ViewModel.DBVersionsViewModelData.TargetIncScriptFileName, true); } }
private static string GetLastIncFilename(DBVersionsProcessContext processContext) { string lastIncStriptFilename = ""; RuntimeScriptFile lastIncScriptFiles = processContext.ScriptFilesState.IncrementalScriptFilesComparer.AllFileSystemScriptFiles.LastOrDefault(); if (lastIncScriptFiles != null) { lastIncStriptFilename = lastIncScriptFiles.Filename; } return(lastIncStriptFilename); }
private static void MarkUnMarkSelectedTargetInGrid(DataGridView dgGrid, string targetScriptFileName, bool isEnable) { dgGrid.Columns[2].Visible = isEnable; foreach (DataGridViewRow currGridRow in dgGrid.Rows) { currGridRow.Cells[0].Value = (currGridRow.Index + 1).ToString(CultureInfo.InvariantCulture); currGridRow.Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleCenter; RuntimeScriptFile currRowFileInfo = currGridRow.DataBoundItem as RuntimeScriptFile; if (targetScriptFileName != null && currRowFileInfo.Filename.Trim().ToUpperInvariant() == targetScriptFileName.Trim().ToUpperInvariant()) { currGridRow.Cells[2].Style.BackColor = Color.Yellow; } else { currGridRow.Cells[2].Style.BackColor = Color.White; } } }
public ExecuteSingleFileScriptStep Create(DBCommands dbCommands, string stepName, RuntimeScriptFile scriptFile) { return(new ExecuteSingleFileScriptStep(_executeScriptBlockStepFactory, dbCommands, stepName, scriptFile)); }
private static void AssertFileHashState(string testName, RuntimeScriptFile runtimeFile, HashDiffType targetHashState) { Assert.That(runtimeFile.HashDiffType == targetHashState, $"{testName} >>> The {runtimeFile.ScriptFileType.FileTypeCode} file: '{runtimeFile.Filename}' should be '{targetHashState}' hash state, but was '{runtimeFile.HashDiffType}'"); }