/// <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); }
/// <summary> /// Fires the <see cref="ObjectContainerDataSourceView.Inserted"/> event. /// </summary> /// <param name="e">The event associated data.</param> protected virtual void OnInserted(ObjectContainerDataSourceStatusEventArgs e) { EventHandler <ObjectContainerDataSourceStatusEventArgs> handler = base.Events[InsertedEventKey] as EventHandler <ObjectContainerDataSourceStatusEventArgs>; if (handler != null) { handler(this, e); } }
protected void ThemaTableDataSource_Inserted(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity thema = new BeheerContextEntity(); thema = e.Instance as BeheerContextEntity; if (thema != null) { thema.Tablename = "thema"; thema.DataKeyName = "themanaam"; m_Presenter.OnBusinessEntityAdded(thema); } m_Presenter.OnViewLoaded(); }
/// <summary> /// Performs an update operation on the list of data that the <see cref="DataSourceView"/> object represents. /// </summary> /// <param name="keys">An <see cref="System.Collections.IDictionary"/> of object or row keys to be updated by the update operation.</param> /// <param name="values">An <see cref="System.Collections.IDictionary"/> of name/value pairs that represent data elements and their new values.</param> /// <param name="oldValues">An <see cref="System.Collections.IDictionary"/> of name/value pairs that represent data elements and their original values.</param> /// <returns>The number of items that were updated in the underlying data storage.</returns> protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) { Guard.CollectionNotNullNorEmpty(keys, String.Format(CultureInfo.CurrentCulture, Resources.NoKeysSpecified), "keys"); Guard.ArgumentNotNull(values, "values"); ObjectContainerDataSourceUpdatingEventArgs updatingEventArgs = new ObjectContainerDataSourceUpdatingEventArgs(DictionaryHelper.GetReadOnlyDictionary(keys), values, oldValues); OnUpdating(updatingEventArgs); if (updatingEventArgs.Cancel) { return(0); } object newInstance = CreateInstance(); TypeDescriptionHelper.BuildInstance(keys, newInstance); TypeDescriptionHelper.BuildInstance(values, newInstance); int rowsAffected; object oldInstance = FindInstance(keys); if (oldInstance != null) { int index = Data.IndexOf(oldInstance); Data[index] = newInstance; rowsAffected = 1; } else { rowsAffected = 0; } OnDataSourceViewChanged(EventArgs.Empty); ObjectContainerDataSourceStatusEventArgs updatedEventArgs = new ObjectContainerDataSourceStatusEventArgs(newInstance, rowsAffected); OnUpdated(updatedEventArgs); return(rowsAffected); }
/// <summary> /// Performs a delete operation on the list of data that the <see cref="DataSourceView"/> object represents. /// </summary> /// <param name="keys">An <see cref="IDictionary"/> of object or row keys to be deleted by /// the <see cref="DataSourceView.ExecuteDelete(System.Collections.IDictionary,System.Collections.IDictionary)"/> /// operation.</param> /// <param name="oldValues">An <see cref="System.Collections.IDictionary"/> of name/value pairs that represent data elements and their original values.</param> /// <returns>The number of items that were deleted from the underlying data storage.</returns> protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues) { Guard.CollectionNotNullNorEmpty(keys, String.Format(CultureInfo.CurrentCulture, Resources.NoKeysSpecified), "keys"); ObjectContainerDataSourceDeletingEventArgs deletingEventArgs = new ObjectContainerDataSourceDeletingEventArgs(DictionaryHelper.GetReadOnlyDictionary(keys), oldValues); OnDeleting(deletingEventArgs); if (deletingEventArgs.Cancel) { return(0); } int rowsAffected; object instance = FindInstance(keys); if (instance == null) { rowsAffected = 0; } else { Data.Remove(instance); rowsAffected = 1; } instance = CreateInstance(); TypeDescriptionHelper.BuildInstance(oldValues, instance); TypeDescriptionHelper.BuildInstance(keys, instance); OnDataSourceViewChanged(EventArgs.Empty); ObjectContainerDataSourceStatusEventArgs deletedEventArgs = new ObjectContainerDataSourceStatusEventArgs(instance, rowsAffected); OnDeleted(deletedEventArgs); return(rowsAffected); }
protected void OrderItemContainerDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { _presenter.OnChangedOrderItemLine((OrderItemLine)e.Instance); }
protected void OrderItemContainerDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { UpdateRowIfInEditMode(); List<OrderItemLine> lines = new List<OrderItemLine>(); lines.Add((OrderItemLine)e.Instance); _presenter.OnDeleteOrderItemLines(lines); SetLastRowToEditMode(); }
protected void ProductsDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { this.presenter.OnProductDeleted((UserProduct)e.Instance); }
protected void StoresDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { this.presenter.OnStoreDeleted((Store)e.Instance); }
void TestableObjectContainerDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { _UpdatedFired = true; }
protected void StoresDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { this.presenter.OnStoreAddedForUser((Store)e.Instance); }
protected void CustomersDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { _presenter.OnCustomerUpdated((Customer)e.Instance); }
protected void TransferBatchDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { _presenter.OnTransferUpdated((Transfer) e.Instance); }
protected void ThemaTableDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { m_Presenter.OnBusinessEntityUpdated(e.Instance as BeheerContextEntity); m_Presenter.OnViewLoaded(); }
protected void PersonalLocationsDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { this.presenter.OnPersonalLocationDeleted(e.Instance as PersonalLocation); }
protected void TrefwoordenTableDatasource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity trefwoord = new BeheerContextEntity(); trefwoord = e.Instance as BeheerContextEntity; if (trefwoord != null) { if (m_DeleteAlleenTrefwoord) { trefwoord.Tablename = "trefwoord"; trefwoord.DataKeyName = "trefwoord"; m_Presenter.OnDetailEntityDeleted(trefwoord); } else { //Verwijder de master/categorie. var detail = trefwoord; BeheerContextEntity categorie; //Haal gegevens op van de master. string naam = detail.Master; var master = m_ListBeheerEntities.Where(cat => cat.DataKeyValue == naam).FirstOrDefault(); categorie = new BeheerContextEntity { DataKeyValue = naam, Id = master.Id }; m_Presenter.OnBusinessEntityDeleted(categorie); } } m_Presenter.OnViewLoaded(); }
protected void TrefwoordenTableDatasource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity trefwoord = new BeheerContextEntity(); trefwoord = e.Instance as BeheerContextEntity; if (!m_IsInsertingInline) { if (trefwoord != null) { trefwoord.DataKeyValue = trefwoord.DataKeyValue.Trim(); trefwoord.Tablename = "trefwoord"; trefwoord.DataKeyName = "trefwoord"; //var detail = m_ListDetailsEntities.Where(det => det.Id == trefwoord.Id).FirstOrDefault(); var master = m_ListBeheerEntities.Where(mas => mas.Id == trefwoord.MasterId).FirstOrDefault(); var updatedMaster = new BeheerContextEntity { Id = master.Id, DataKeyValue = trefwoord.Master//update de master. }; trefwoord.Parent= new ParentKeyEntity { Id = master.Id, DataKeyValue = master.DataKeyValue }; if (trefwoord.Id == -1 && !trefwoord.DataKeyValue.Equals(string.Empty)) { //-1 = geen trefwoord, -2 = lege tabel, -3 = nieuw trefwoord. trefwoord.Id = -3; updatedMaster.Details.Add(trefwoord); m_Presenter.OnBusinessEntityUpdated(updatedMaster); } else m_Presenter.OnDetailEntityUpdated(trefwoord); } } else { #region inline insert trefwoord gebruikt een selectedrow int selectedIndex = TrefwoordView.SelectedIndex; GridViewRow row = TrefwoordView.Rows[selectedIndex]; var tbCategorie = row.FindControl("tbCategorie") as TextBox; var tbTrefwoordInline = TrefwoordView.Rows[selectedIndex].FindControl("TrefwoordTextBoxInline") as TextBox; var master = m_ListBeheerEntities.Where(mas => mas.DataKeyValue == tbCategorie.Text).FirstOrDefault(); var updatedMaster = new BeheerContextEntity { Id = master.Id, DataKeyValue = master.DataKeyValue }; trefwoord = new BeheerContextEntity { Id = -3, //-1 = geen trefwoord, -2 = lege tabel, -3 = nieuw trefwoord. DataKeyValue = tbTrefwoordInline.Text, Master = master.DataKeyValue, MasterId = master.Id, Parent = new ParentKeyEntity { Id = master.Id, DataKeyValue = master.DataKeyValue } }; updatedMaster.Details.Add(trefwoord); m_Presenter.OnBusinessEntityUpdated(updatedMaster); #endregion TrefwoordView.SelectedIndex = -1; } m_Presenter.OnViewLoaded(); }
protected void TrefwoordenTableDatasource_Inserted(object sender, ObjectContainerDataSourceStatusEventArgs e) { }
protected void CategorieTableDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { m_Presenter.OnBusinessEntityDeleted(e.Instance as BeheerContextEntity); }
// TODO: Forward events to the presenter and show state to the user. // For examples of this, see the View-Presenter (with Application Controller) QuickStart: // ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.wcsf.2007oct/wcsf/html/08da6294-8a4e-46b2-8bbe-ec94c06f1c30.html protected void TrefwoordTableDataSource_Inserted(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity trefwoord = new BeheerContextEntity(); trefwoord = e.Instance as BeheerContextEntity; if (trefwoord != null) { trefwoord.Tablename = "trefwoord"; trefwoord.DataKeyName = "trefwoord"; m_Presenter.OnBusinessEntityAdded(trefwoord); } AllowCrud = true; }
protected void CategorieTableDataSource_Inserted(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity categorie = new BeheerContextEntity(); categorie = e.Instance as BeheerContextEntity; if (categorie != null) { categorie.Tablename = "categorie"; categorie.DataKeyName = "categorienaam"; m_Presenter.OnBusinessEntityAdded(categorie); } m_Presenter.OnViewLoaded(); }
protected void TrefwoordTableDataSource_Deleted(object sender, ObjectContainerDataSourceStatusEventArgs e) { m_Presenter.OnBusinessEntityDeleted(e.Instance as BeheerContextEntity); AllowCrud = true; }
protected void ProductsDataSource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { this.presenter.OnProductAddedForUser((Locator.Products.UserProduct)e.Instance); }
protected void TrefwoordenTableDatasource_Updated(object sender, ObjectContainerDataSourceStatusEventArgs e) { BeheerContextEntity trefwoord = new BeheerContextEntity(); trefwoord = e.Instance as BeheerContextEntity; if (trefwoord != null) { trefwoord.Tablename = "trefwoord"; trefwoord.DataKeyName = "trefwoord"; //var detail = m_ListDetailsEntities.Where(det => det.Id == trefwoord.Id).FirstOrDefault(); var master = m_ListBeheerEntities.Where(mas => mas.Id == trefwoord.MasterId).FirstOrDefault(); var updatedMaster = new BeheerContextEntity { Id = master.Id, DataKeyValue = trefwoord.Master//update de master. }; trefwoord.Parent= new ParentKeyEntity { Id = master.Id, DataKeyValue = master.DataKeyValue }; if (trefwoord.Id == -1) { //-1 = geen trefwoord, -2 = lege tabel, -3 = nieuw trefwoord. trefwoord.Id = -3; updatedMaster.Details.Add(trefwoord); m_Presenter.OnBusinessEntityUpdated(updatedMaster); } else m_Presenter.OnDetailEntityUpdated(trefwoord); } m_Presenter.OnViewLoaded(); }