bool InsertCallback(int recordsAffected, Exception exception) { AfterRecordInsertedEventArgs eAfterRecordInserted = new AfterRecordInsertedEventArgs(record, recordsAffected, exception, keys, values); this.OnAfterRecordInserted(eAfterRecordInserted); if (this.AutomaticResponseValues) { if (this.keys.Count > 0) { IEnumerator enumerator = this.keys.Keys.GetEnumerator(); enumerator.MoveNext(); string keyName = enumerator.Current as string; this.values[keyName] = this.keys[keyName]; } else { throw new Exception("Key value is not defined for inserted record"); } var mappings = new Dictionary <string, object>(); var model = this.ModelInstance; foreach (var key in values.Keys) { var field = model.Fields.FirstOrDefault <ModelField>(f => f.Name == key.ToString()); mappings.Add(field != null ? (field.Mapping.IsNotEmpty() ? field.Mapping : field.Name) : key.ToString(), values[key]); } this.responseRecords.Add(mappings); } return(eAfterRecordInserted.ExceptionHandled); }
protected virtual void OnAfterRecordInserted(AfterRecordInsertedEventArgs e) { AfterRecordInsertedEventHandler handler = (AfterRecordInsertedEventHandler)Events[EventAfterRecordInserted]; if (handler != null) { handler(this, e); } }
bool InsertCallback(int recordsAffected, Exception exception) { if (confirmation != null && recordsAffected > 0) { confirmation.ConfirmRecord(); } AfterRecordInsertedEventArgs eAfterRecordInserted = new AfterRecordInsertedEventArgs(record, recordsAffected, exception, keys, values, confirmation); this.OnAfterRecordInserted(eAfterRecordInserted); return(eAfterRecordInserted.ExceptionHandled); }
bool InsertCallback(int recordsAffected, Exception exception) { AfterRecordInsertedEventArgs eAfterRecordInserted = new AfterRecordInsertedEventArgs(record, recordsAffected, exception, keys, values); this.OnAfterRecordInserted(eAfterRecordInserted); if (this.AutomaticResponseValues) { if (this.keys.Count > 0) { IEnumerator enumerator = this.keys.Keys.GetEnumerator(); enumerator.MoveNext(); string keyName = enumerator.Current as string; this.values[keyName] = this.keys[keyName]; } else { throw new Exception("Key value is not defined for inserted record"); } var mappings = new Dictionary<string, object>(); var model = this.ModelInstance; foreach (var key in values.Keys) { var field = model.Fields.FirstOrDefault<ModelField>(f => f.Name == key.ToString()); mappings.Add(field != null ? (field.Mapping.IsNotEmpty() ? field.Mapping : field.Name) : key.ToString(), values[key]); } this.responseRecords.Add(mappings); } return eAfterRecordInserted.ExceptionHandled; }
bool InsertCallback(int recordsAffected, Exception exception) { if (confirmation != null && recordsAffected > 0) { confirmation.ConfirmRecord(); } AfterRecordInsertedEventArgs eAfterRecordInserted = new AfterRecordInsertedEventArgs(record, recordsAffected, exception, keys, values, confirmation); this.OnAfterRecordInserted(eAfterRecordInserted); return eAfterRecordInserted.ExceptionHandled; }