public void AfterRead(AfterReadEventArgs e) { if (string.IsNullOrWhiteSpace(account)) { throw new Exception("Customer account is missing!"); } }
public void AfterRead(AfterReadEventArgs e) { if (string.IsNullOrWhiteSpace(code)) { throw new Exception("Category code is missing!"); } }
private void AfterEvent(EngineBase engine, AfterReadEventArgs <OrdersFixed> e) { // we want to drop all records with no freight if (e.Record.Freight == 0) { e.SkipThisRecord = true; } }
public void AfterRead(AfterReadEventArgs e) { // we want to drop all records with no freight if (Freight == 0) { e.SkipThisRecord = true; } }
private static void Reader_AfterReadEvent(EventLogReader sender, AfterReadEventArgs args) { if (args.RowData != null) { _lastPeriodEvent = args.RowData.Period; } Console.SetCursorPosition(0, Console.CursorTop - 2); Console.WriteLine($"{DateTime.Now}: [+]{_eventNumber}"); Console.WriteLine($"{DateTime.Now}: {_lastPeriodEvent}"); }
private static void Reader_AfterReadEvent(TechJournalReader sender, AfterReadEventArgs args) { if (args.EventData != null) { _lastPeriodEvent = args.EventData.Period; } Console.SetCursorPosition(0, Console.CursorTop - 2); Console.WriteLine($"{DateTime.Now}: [{_lastLogDirectory}] [+]{_eventNumber}"); Console.WriteLine($"{DateTime.Now}: [{_lastLogDirectory}] {_lastPeriodEvent}"); }
private void EventLogReader_AfterReadEvent(EventLogReader sender, AfterReadEventArgs args) { if (sender.CurrentRow == null) { return; } _dataToSend.Add(sender.CurrentRow); if (_dataToSend.Count >= _portionSize) { SendDataCurrentPortion(sender); } }
public void AfterRead(AfterReadEventArgs e) { if (name.StartsWith("A")) { //roomNum = Int32.Parse(Regex.Replace(name, @"\D", "")); //int subEndNum = name.IndexOf("("); } else { time = DateTime.Parse(ymd + " " + hms); int subEndNum = name.IndexOf("("); roomNum = int.Parse(name.Substring(subEndNum + 1, 3)); name = Regex.Replace(name.Substring(0, subEndNum), @"\d", ""); } }
bool IDataReader.Read() { var read = _dataReader.Read(); if (read) { ++_rowCount; } else if (_afterRead != null) { var eventArgs = new AfterReadEventArgs(_rowCount); _afterRead(this, eventArgs); } return(read); }
/// <summary> /// Post process a record /// </summary> /// <param name="line">Record read</param> /// <param name="record">Type of record</param> /// <param name="lineChanged">Has the line been updated so that the engine switches to this version</param> /// <param name="lineNumber">Number of line in file</param> /// <returns>true if record to be skipped</returns> protected bool OnAfterReadRecord(string line, T record, bool lineChanged, int lineNumber) { var e = new AfterReadEventArgs <T>(this, line, lineChanged, record, lineNumber); if (RecordInfo.NotifyRead) { ((INotifyRead)record).AfterRead(e); } if (AfterReadRecord != null) { AfterReadRecord(this, e); } return(e.SkipThisRecord); }
private void AfterReadCSVEvent(EngineBase engine, AfterReadEventArgs <ImportCLassModel> e) { if (e.Record.PurchaseOrder.Length > 11) { throw new Exception("Line " + e.LineNumber + ": PurchaseOrder is too long"); } if (e.Record.Material.Length > 8) { throw new Exception("Line " + e.LineNumber + ": Material is too long"); } if (e.Record.MaterialShortText.Length > 41) { throw new Exception("Line " + e.LineNumber + ": MaterialShortText is too long"); } if (e.Record.StorageBin.Length > 6) { throw new Exception("Line " + e.LineNumber + ": StorageBin is too long"); } }
private void AfterEvent2(EngineBase sender, AfterReadEventArgs <SampleType> e) { e.SkipThisRecord = true; after++; }
private void AfterEvent(EngineBase sender, AfterReadEventArgs <SampleType> e) { after++; }
private void AfterReadRecord(EngineBase engine, AfterReadEventArgs <T> e) { e.Record.Validate(); ++ValidRecords; }
public void AfterRead(AfterReadEventArgs <SampleType> e) { AfterReadNotif = true; }
public void AfterRead(AfterReadEventArgs e) { }
public void AfterRead(AfterReadEventArgs e) { //Do nothing. }
public void AfterRead(AfterReadEventArgs e) { LineNumber = e.LineNumber; }
private void ReadNextRecord() { string currentLine = mAsyncReader.ReadNextLine(); mLineNumber++; bool byPass = false; mLastRecord = null; var line = new LineInfo(currentLine) { mReader = mAsyncReader }; while (true) { if (currentLine != null) { try { mTotalRecords++; Type currType = mRecordSelector(this, currentLine); line.ReLoad(currentLine); if (currType != null) { AfterReadEventArgs <object> e = null; var info = (RecordInfo)mRecordInfoHash[currType]; if (info == null) { throw new BadUsageException("A record is of type '" + currType.Name + "' which this engine is not configured to handle. Try adding this type to the constructor."); } var values = new object[info.FieldCount]; mLastRecord = info.Operations.StringToRecord(line, values); if (MustNotifyRead) { OnAfterReadRecord(currentLine, mLastRecord, false, LineNumber); } if (mLastRecord != null) { byPass = true; return; } } } catch (Exception ex) { switch (mErrorManager.ErrorMode) { case ErrorMode.ThrowException: byPass = true; throw; case ErrorMode.IgnoreAndContinue: break; case ErrorMode.SaveAndContinue: var err = new ErrorInfo { mLineNumber = mAsyncReader.LineNumber, mExceptionInfo = ex, mRecordString = currentLine }; // err.mColumnNumber = mColumnNum; mErrorManager.AddError(err); break; } } finally { if (byPass == false) { currentLine = mAsyncReader.ReadNextLine(); mLineNumber = mAsyncReader.LineNumber; } } } else { mLastRecord = null; if (RecordInfo.IgnoreLast > 0) { mFooterText = mAsyncReader.RemainingText; } try { mAsyncReader.Close(); } catch {} return; } } }
static void engine_AfterReadRecord(EngineBase engine, AfterReadEventArgs <ImportRecord> e) { e.Record.ParsedTestProperty = e.Record.TestProperty.Split('|').Select(x => Convert.ToInt32(x)).ToArray(); }
protected void RaiseAfterRead(AfterReadEventArgs args) { AfterReadEvent?.Invoke(this, args); }
private static void Reader_AfterReadEvent(EventLogReader sender, AfterReadEventArgs args) { Console.SetCursorPosition(0, Console.CursorTop - 1); Console.WriteLine($"{DateTime.Now}: [+]{_eventNumber}"); }
private void ConnectionAfterRead(object sender, AfterReadEventArgs e) { var duration = e.Timestamp - _beforeExecuteReader.Timestamp; Log.Trace("{0} row(s) read in {1} seconds.", e.RowCount, StopwatchTimeSpan.ToString(duration, 3)); }
public void AfterRead(AfterReadEventArgs e) { AfterReadNotif = true; }
public void AfterRead(AfterReadEventArgs <SampleType> e) { }
private static void Engine_AfterReadRecord(EngineBase engine, AfterReadEventArgs <object> e) { // Increment the event counter _EventCount++; }