/// <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> /// Class XtrmAddons Fotootof Libraries Common Window Section Form Model Constructor. /// </summary> /// <param name="owner">The associated window form base.</param> /// <param name="SectionId"></param> public WindowFormSectionModel(WindowFormSectionLayout owner, int SectionId) : this(owner) { LoadSection(SectionId); // Set model entity to dependencies converters. IsAclGroupInSection.Entity = NewFormData; IsAlbumInSection.Entity = NewFormData; // Assign list of AclGroup to the model for dependencies. // Assign list of Album to the model for dependencies. AclGroups = new AclGroupEntityCollection(true); Albums = new AlbumEntityCollection(true); }
/// <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."); }