public void UpdateFailure(FailiureDto dtoToUpdate) { List<FailiureDto> failList = ReadAllFailiures(); var existingFailiure = failList.First(s => s.Process == dtoToUpdate.Process); failList.Remove(existingFailiure); failList.Add(existingFailiure); OverwriteFile(failList); }
public List<FailiureDto> ReadAllFailiures() { List<FailiureDto> failList = new List<FailiureDto>(); var reader = File.ReadAllLines(FilePath); for (int i = 1; i < reader.Length; i++) { var columns = reader[i].Split(','); var column = new FailiureDto(); column.Process = columns[0]; column.Date = DateTime.Parse(columns[1]); column.Message = columns[2]; failList.Add(column); } return failList; }
public void CreateFailure(FailiureDto inFailDto) { var failList = ReadAllFailiures(); failList.Add(inFailDto); OverwriteFile(failList); }
private void LogFailiure(string process, DateTime date, string message) { var fDto = new FailiureDto(); fDto.Process = process; fDto.Message = message; var fRepo = new FailiureRepo(); fRepo.CreateFailure(fDto); }