public void GetFomDatabase() { if (BatchJobGroups.Count > 0) { OraSession oraSession = new OraSession(); var masterConString = oraSession.Load("Master"); var testConString = oraSession.Load("Test"); string errorMessage = ""; errorMessage = oraSession.OpenConnection(masterConString); if (errorMessage != "") { ErrorConnection?.Invoke(null, null); return; } errorMessage = oraSession.OpenConnection(testConString); if (errorMessage != "") { ErrorConnection?.Invoke(null, null); return; } else { foreach (var bjg in BatchJobGroups) { ExtractLogs(bjg); bjg.CompareLogs(); } LogsExtracted?.Invoke(BatchJobGroups.Where(item => item.Name != "").ToList(), null); } } }
public void InsertFromClipBoard(int index) { var text = Clipboard.GetText(); var data = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); foreach (var item in data) { var firstCol = item.Split('\t')[0]; bool isExists = BatchJobGroups.Any(i => i.Name == firstCol); if (isExists) { Error?.Invoke("Duplicate item(s) deleted.", null); } if (firstCol != "" && !isExists) { var bjg = new BatchJobGroup(firstCol); if (index < BatchJobGroups.Count) { BatchJobGroups.RemoveAt(index); BatchJobGroups.Insert(index, bjg); } else { BatchJobGroups.Add(bjg); } index++; } } }
public string SaveAsScope() { try { if (!BatchJobGroups.Any()) { return("Nothing to save."); } File.WriteAllLines(pathScopeFile, BatchJobGroups.Select(item => item.Name)); return(""); } catch (Exception ex) { return(ex.Message); } }
public string LoadFromScope() { try { if (!File.Exists(pathScopeFile)) { return("Scope file not yet defined."); } var names = File.ReadAllLines(pathScopeFile); if (!names.Any()) { return("Scope file is empty."); } BatchJobGroups.Clear(); foreach (var name in names) { var bjg = new BatchJobGroup(name); BatchJobGroups.Add(bjg); } return(""); } catch (Exception ex) { return(ex.Message); } }