Ejemplo n.º 1
0
        /// <summary>
        /// Performs an insert operation on the list of data that the <see cref="DataSourceView"/> object represents.
        /// </summary>
        /// <param name="values">An <see cref="IDictionary"/> of name/value pairs used during an insert operation.</param>
        /// <returns>The number of items that were inserted into the underlying data storage.</returns>
        protected override int ExecuteInsert(IDictionary values)
        {
            Guard.ArgumentNotNull(values, "values");

            ObjectContainerDataSourceInsertingEventArgs insertingEventArgs = new ObjectContainerDataSourceInsertingEventArgs(values);

            OnInserting(insertingEventArgs);
            if (insertingEventArgs.Cancel)
            {
                return(0);
            }

            object instance = CreateInstance();

            TypeDescriptionHelper.BuildInstance(values, instance);
            Add(instance);
            OnDataSourceViewChanged(EventArgs.Empty);

            int rowsAffected = 1;
            ObjectContainerDataSourceStatusEventArgs insertedEventArgs = new ObjectContainerDataSourceStatusEventArgs(instance, rowsAffected);

            OnInserted(insertedEventArgs);

            return(rowsAffected);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Fires the <see cref="ObjectContainerDataSourceView.Inserting"/> event.
        /// </summary>
        /// <param name="e">The event associated data.</param>
        protected virtual void OnInserting(ObjectContainerDataSourceInsertingEventArgs e)
        {
            EventHandler <ObjectContainerDataSourceInsertingEventArgs> handler =
                base.Events[InsertingEventKey] as EventHandler <ObjectContainerDataSourceInsertingEventArgs>;

            if (handler != null)
            {
                handler(this, e);
            }
        }
 void TestableObjectContainerDataSource_Inserting(object sender, ObjectContainerDataSourceInsertingEventArgs e)
 {
     _InsertingFired = true;
 }
Ejemplo n.º 4
0
        protected void TrefwoordenTableDatasource_Inserting(object sender, ObjectContainerDataSourceInsertingEventArgs e)
        {

        }