/// <summary> /// Method called on <see cref="SectionEntity"/> default change event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void SectionsDataGrid_DefaultChanged(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Setting default Section. Please wait..."); SectionEntity newEntity = (SectionEntity)e.NewEntity; SectionEntityCollection.SetDefault(newEntity); Model.LoadSections(); log.Warn("Setting default Section. Done."); } catch (Exception ex) { log.Fatal(ex.Output(), ex); MessageBoxs.Fatal(ex, "Setting default Section. Fail."); } finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on User view cancel event. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e"></param> private void UcDataGridUsers_UserCanceled(object sender, EntityChangesEventArgs e) { log.Info("Adding or editing User operation canceled. Please wait..."); Model.LoadUsers(); log.Info("Adding or editing AclGroup operation canceled. Done."); }
/// <summary> /// Method called on AclGroup default change event. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Event arguments.</param> private void UcDataGridAclGroups_DefaultChanged(object sender, EntityChangesEventArgs e) { log.Info("Setting default Section. Please wait..."); AclGroupEntity newEntity = (AclGroupEntity)e.NewEntity; AclGroupEntityCollection.SetDefault(newEntity); Model.LoadAclGroups(); log.Info("Setting default Section. Done."); }
/// <summary> /// Method called on AclGroup view changes event. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Event arguments.</param> private void UcDataGridAclGroups_AclGroupAdded(object sender, EntityChangesEventArgs e) { log.Info("Saving new AclGroup informations. Please wait..."); AclGroupEntity item = (AclGroupEntity)e.NewEntity; Model.AclGroups.Items.Add(item); AclGroupEntityCollection.DbInsert(new List <AclGroupEntity> { item }); Model.LoadAll(); log.Info("Saving new AclGroup informations. Done."); }
/// <summary> /// Method called on AclGroup view delete event. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e"></param> private void UcDataGridAclGroups_AclGroupDeleted(object sender, EntityChangesEventArgs e) { log.Info("Deleting AclGroup(s). Please wait..."); AclGroupEntity item = (AclGroupEntity)e.NewEntity; // Remove item from list. Model.AclGroups.Items.Remove(item); // Delete item from database. AclGroupEntityCollection.DbDelete(new List <AclGroupEntity> { item }); Model.LoadAll(); log.Info("Deleting AclGroup(s). Done."); }
/// <summary> /// Method called on AclGroup view add event. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Event arguments.</param> private void UcDataGridAclGroups_AclGroupChanged(object sender, EntityChangesEventArgs e) { log.Info("Saving AclGroup informations. Please wait..."); AclGroupEntity newEntity = (AclGroupEntity)e.NewEntity; AclGroupEntity old = Model.AclGroups.Items.Single(x => x.AclGroupId == newEntity.AclGroupId); int index = Model.AclGroups.Items.IndexOf(old); Model.AclGroups.Items[index] = newEntity; AclGroupEntityCollection.DbUpdateAsync(new List <AclGroupEntity> { newEntity }, new List <AclGroupEntity> { old }); Model.LoadAll(); log.Info("Saving AclGroup informations. Done."); }
/// <summary> /// Method called on Section delete event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void PicturesCollection_Added(object sender, EntityChangesEventArgs e) { try { //// Start to busy application. //MessageBoxs.IsBusy = true; //log.Warn("Starting adding Picture(s). Please wait..."); //// Get item from list. //PictureEntity[] items = (PictureEntity[])e.NewEntities; //// Stop to busy application. //log.Warn("Ending adding Picture(s)."); //MessageBoxs.IsBusy = false; } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Error(ex.Output()); } }
/// <summary> /// /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e">Event arguments.</param> private void UcDataGridUsers_UserChanged(object sender, EntityChangesEventArgs e) { MessageBoxs.IsBusy = true; log.Warn("Editing User informations. Please wait..."); try { Model.SaveUserChanges((UserEntity)e.NewEntity); log.Info("Editing User informations. Done."); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Error(ex); } finally { log.Warn("Editing User informations. End."); MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on User view delete event. /// </summary> /// <param name="sender">The object sender of the event.</param> /// <param name="e"></param> private void UcDataGridUsers_UserDeleled(object sender, EntityChangesEventArgs e) { MessageBoxs.IsBusy = true; log.Info("Deleting selected Users. Please wait..."); try { Model.DeleleUser((UserEntity)e.NewEntity); log.Info(MessageBoxs.BusyContent = "Deleting selected Users. Done."); } catch (Exception ex) { MessageBoxs.BusyContent = "Deleting selected Users. failed !"; log.Fatal(MessageBoxs.BusyContent, ex); MessageBoxs.Fatal(ex, (string)MessageBoxs.BusyContent); } finally { log.Warn(MessageBoxs.BusyContent = "Deleting selected Users. End."); MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on <see cref="ListView"/> <see cref="AlbumEntity"/> deleted event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void AlbumsListView_OnDelete(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Deleting Album informations. Please wait..."); Model.DeleteAlbum((AlbumEntity)e.NewEntity); log.Warn("Deleting Album informations. Done."); } catch (Exception ex) { log.Fatal(ex.Output(), ex); MessageBoxs.Fatal(ex, "Deleting Album informations. Fail."); } finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on <see cref="ListView"/> <see cref="AlbumEntity"/> candeled event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">The entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void AlbumsListView_OnCancel(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Canceling Album informations edit. Please wait..."); // LoadAlbums(); log.Warn("Canceling Album informations edit. Done."); } catch (Exception ex) { log.Fatal(ex.Output(), ex); MessageBoxs.Fatal(ex, "Canceling Album informations edit. Fail."); } finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on <see cref="SectionEntity"/> delete event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void SectionsDataGrid_Deleted(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Deleting Section informations. Please wait..."); Model.DeleteSection((SectionEntity)e.OldEntity); log.Warn("Deleting Section informations. Done."); } catch (Exception ex) { log.Fatal(ex.Output(), ex); MessageBoxs.Fatal(ex, "Deleting Section informations. Fail."); } finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on <see cref="SectionEntity"/> edit view cancel event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void SectionsDataGrid_Canceled(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Canceling Section informations edit. Please wait..."); //Model.LoadSections(); log.Warn("Canceling Section informations edit. Done."); } catch (Exception ex) { log.Fatal(ex.Output(), ex); MessageBoxs.Fatal(ex, "Canceling Section informations edit. Fail."); } finally { MessageBoxs.IsBusy = false; } }
/// <summary> /// Method called on <see cref="SectionEntity"/> update view save event. /// </summary> /// <param name="sender">The <see cref="object"/> sender of the event.</param> /// <param name="e">Entity changes event arguments <see cref="EntityChangesEventArgs"/>.</param> private void SectionsDataGrid_Changed(object sender, EntityChangesEventArgs e) { try { MessageBoxs.IsBusy = true; log.Warn("Saving Section informations. Please wait..."); Model.UpdateSection((SectionEntity)e.NewEntity); RefreshAlbums(); log.Warn("Saving Section informations. Done."); } catch (Exception ex) { log.Error(ex.Output(), ex); MessageBoxs.Fatal(ex, "Saving Section informations. Fail."); } finally { MessageBoxs.IsBusy = false; } }