/// <summary> /// Raises the <see cref="Inserted"/> event. /// </summary> /// <param name="args">The <see cref="NIntegrate.Web.EventArgs.DataSourceStatusEventArgs"/> instance containing the event data.</param> internal void OnInserted(DataSourceStatusEventArgs args) { if (Inserted != null) { Inserted(this, args); } }
/// <summary> /// Raises the <see cref="Updated"/> event. /// </summary> /// <param name="args">The <see cref="NIntegrate.Web.EventArgs.DataSourceStatusEventArgs"/> instance containing the event data.</param> internal void OnUpdated(DataSourceStatusEventArgs args) { if (Updated != null) { Updated(this, args); } }
/// <summary> /// Raises the <see cref="Deleted"/> event. /// </summary> /// <param name="args">The <see cref="NIntegrate.Web.EventArgs.DataSourceStatusEventArgs"/> instance containing the event data.</param> internal void OnDeleted(DataSourceStatusEventArgs args) { if (Deleted != null) { Deleted(this, args); } }
protected override int ExecuteInsert(IDictionary values) { if (_owner.Criteria == null) { throw new ArgumentException("Missing QueryTableType or Criteria setting on QueryDataSource"); } if (values == null || values.Count == 0) { throw new ArgumentNullException("values"); } var insertingArgs = new DataSourceInsertingEventArgs(values); _owner.OnInserting(insertingArgs); if (insertingArgs.Cancel) { return(0); } var criteria = CreateInsertCriteria(values); var affectedRows = _owner.QueryService.Execute(criteria, false); var statusArgs = new DataSourceStatusEventArgs(this, affectedRows); _owner.OnInserted(statusArgs); if (affectedRows > 0) { OnDataSourceViewChanged(System.EventArgs.Empty); } return(affectedRows); }
/// <summary> /// This method checks if the search resulted in any hits. If not it hides the searchResult and displays a "no results" message. /// </summary> /// <param name="sender">The sender (the SearchDataSource).</param> /// <param name="e">The <see cref="EPiServer.Web.WebControls.DataSourceStatusEventArgs"/> instance containing the event data.</param> protected void HandleEmptyResult(object sender, DataSourceStatusEventArgs e) { if (e.AffectedRows < 1) { SearchResult.Visible = false; NoSearchResult.Visible = true; } }
/// <summary> /// This method looks for exceptions in the DataSourceStatusEventArgs parameter and invalidates a validator with the corresponding exception message /// </summary> protected void HandleErrors(object sender, DataSourceStatusEventArgs e) { if (e.Exception == null) { return; } SearchKeywordsValidator.ErrorMessage = e.Exception.Message; SearchKeywordsValidator.Text = e.Exception.Message; SearchKeywordsValidator.IsValid = false; e.ExceptionHandled = true; }
protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) { if (_owner.Criteria == null) { throw new ArgumentException("Missing QueryTableType or Criteria setting on QueryDataSource"); } if (keys == null || keys.Count == 0) { throw new ArgumentNullException("keys"); } if (values == null || values.Count == 0) { throw new ArgumentNullException("values"); } var updatingArgs = new DataSourceUpdatingEventArgs(GetReadOnlyDictionary(keys), values, oldValues); _owner.OnUpdating(updatingArgs); if (updatingArgs.Cancel) { return(0); } if (_owner.ConflictDetection == ConflictOptions.CompareAllValues) { DetectCompareAllValuesConflicts(oldValues, keys); } var criteria = CreateUpdateCriteria(keys, values); var affectedRows = _owner.QueryService.Execute(criteria, false); var statusArgs = new DataSourceStatusEventArgs(this, affectedRows); _owner.OnUpdated(statusArgs); if (affectedRows > 0) { OnDataSourceViewChanged(System.EventArgs.Empty); } return(affectedRows); }