/// <summary> /// OnRecordsetChangeComplete event is called after the ADORecordsetHelper has changed. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">A EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> /// <param name="errors">Array containing all the errors occurred during the field change.</param> protected void OnRecordsetChangeComplete(EventReasonEnum reason, ref EventStatusEnum status, string[] errors) { if (RecordsetChangeComplete != null) { RecordSetChangeCompleteEventArgs args = new RecordSetChangeCompleteEventArgs(reason, errors, status); RecordsetChangeComplete(this, args); status = args.Status; } }
/// <summary> /// OnMoveComplete event is called after the current position in the ADORecordsetHelper changes. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">A EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> /// <param name="errors">Array containing all the errors occurred during the field change.</param> protected void OnMoveComplete(EventReasonEnum reason, ref EventStatusEnum status, string[] errors) { if (MoveComplete != null) { MoveCompleteEventArgs args = new MoveCompleteEventArgs(reason, errors, status); MoveComplete(this, args); status = args.Status; } }
/// <summary> /// OnWillMove event is called before a pending operation changes the current position in the ADORecordsetHelper. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">A EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> protected void OnWillMove(EventReasonEnum reason, ref EventStatusEnum status) { if (WillMove != null) { MoveEventArgs args = new MoveEventArgs(reason, status); WillMove(this, args); status = args.Status; } }
/// <summary> /// The OnWillChangeRecord event is called before one or more records (rows) in the Recordset change. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">A EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> /// <param name="numRecords">Value indicating the number of records changed (affected).</param> protected void OnWillChangeRecord(EventReasonEnum reason, ref EventStatusEnum status, int numRecords) { if (WillChangeRecord != null) { RecordChangeEventArgs args = new RecordChangeEventArgs(reason, numRecords, status); WillChangeRecord(this, args); status = args.Status; } }
/// <summary> /// OnWillChangeRecordset event is called before a pending operation changes the ADORecordsetHelper. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">A EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> protected void OnWillChangeRecordset(EventReasonEnum reason, ref EventStatusEnum status) { if (WillChangeRecordset != null) { RecordSetChangeEventArgs args = new RecordSetChangeEventArgs(reason, status); WillChangeRecordset(this, args); status = args.Status; } }
/// <summary> /// Creates a new RecordSetChangeEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> protected RecordSetChangeEventArgs(EventReasonEnum reason, string[] errors, EventStatusEnum status) : base(status, errors) { this.reason = reason; }
/// <summary> /// Move the current record according to the value of “records”. /// </summary> /// <param name="records">The number of records to move forward (if positive), backwards (if negative).</param> /// <param name="reason">The reason of the change.</param> /// <param name="status">An EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> private void Move(int records, EventReasonEnum reason, EventStatusEnum status) { //if ((!UsingView && Tables[0].Rows.Count == 0) || (UsingView && currentView.Count == 0)) //{ // throw new InvalidOperationException("Requested operation requires a current record"); //} OnWillMove(reason, ref status); string[] errors = null; if (status != EventStatusEnum.adStatusCancel) { try { if (records != 0 && index >= 0) { Update(false); } BasicMove(index + records); if (eof && reason != EventReasonEnum.adRsnMoveFirst && reason != EventReasonEnum.adRsnMovePrevious) { EndOfRecordsetLogic(); } //else //{ // eof = false; //} } catch (Exception e) { errors = new string[] { e.Message }; status = EventStatusEnum.adStatusErrorsOccurred; } OnMoveComplete(reason, ref status, errors); } }
/// <summary> /// Creates a new MoveEventArgs instance. /// </summary> /// <param name="reason">The reason of the move.</param> /// <param name="status">The status of the event.</param> public MoveEventArgs(EventReasonEnum reason, EventStatusEnum status) : this(reason, null, status) { }
/// <summary> /// Creates a new RecordSetChangeCompleteEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> public RecordSetChangeCompleteEventArgs(EventReasonEnum reason, string[] errors, EventStatusEnum status) : base(reason, errors, status) { }
/// <summary> /// Creates a new RecordChangeCompleteEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="numberOfRecords">The number of fields affected.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> public RecordChangeCompleteEventArgs(EventReasonEnum reason, int numberOfRecords, string[] errors, EventStatusEnum status) : base(reason, numberOfRecords, errors, status) { }
/// <summary> /// Creates a new MoveCompleteEventArgs instance. /// </summary> /// <param name="reason">The reason of the move.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> public MoveCompleteEventArgs(EventReasonEnum reason, string[] errors, EventStatusEnum status) : base(reason, errors, status) { }
/// <summary> /// Creates a new RecordChangeEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="numberOfRecords">The number of fields affected.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> protected RecordChangeEventArgs(EventReasonEnum reason, int numberOfRecords, string[] errors, EventStatusEnum status) : base(status, errors) { this.reason = reason; this.numberOfRecords = numberOfRecords; }
/// <summary> /// Move the current record to the beginning of the ADORecordsetHelper object. /// </summary> /// <param name="reason">The reason of the change.</param> private void MoveFirst(EventReasonEnum reason) { if (index == -1) { index = 0; } Move((-1 * index), reason, EventStatusEnum.adStatusOK); }
/// <summary> /// Creates a new RecordChangeEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="numberOfRecords">The number of fields affected.</param> /// <param name="status">The status of the event.</param> public RecordChangeEventArgs(EventReasonEnum reason, int numberOfRecords, EventStatusEnum status) : this(reason, numberOfRecords, null, status) { }
/// <summary> /// Creates a new RecordSetChangeEventArgs instance. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">The status of the event.</param> public RecordSetChangeEventArgs(EventReasonEnum reason, EventStatusEnum status) : this(reason, null, status) { }
/// <summary> /// Creates a new MoveEventArgs instance. /// </summary> /// <param name="reason">The reason of the move.</param> /// <param name="errors">The errors ocurred during the operation.</param> /// <param name="status">The status of the event.</param> protected MoveEventArgs(EventReasonEnum reason, string[] errors, EventStatusEnum status) : base(status, errors) { this.reason = reason; }
/// <summary> /// OnWillMove event is called before a pending operation changes the current position in the ADORecordsetHelper. /// </summary> /// <param name="reason">The reason of the change.</param> /// <param name="status">An EventStatusEnum value that indicates the state of the ADORecordsetHelper in the moment that the event rose.</param> protected void OnWillMove(EventReasonEnum reason, ref EventStatusEnum status) { firstChange = true; if (WillMove != null) { MoveEventArgs args = new MoveEventArgs(reason, status); WillMove(this, args); status = args.Status; firstChange = status == EventStatusEnum.adStatusCancel ? false : true; } }