Exemple #1
0
        /// <summary>
        /// Method to delete a list of Info entities from the database.
        /// </summary>
        /// <param name="oldItems">The list of items to remove.</param>
        public static void DbDelete(List <InfoEntity> oldItems)
        {
            // Check for Removing items.
            try
            {
                log.Info("Deleting Section(s). Please wait...");

                if (oldItems != null && oldItems.Count > 0)
                {
                    foreach (InfoEntity entity in oldItems)
                    {
                        //MainWindow.Database.Info_Delete(entity.PrimaryKey);

                        throw new NotImplementedException();

                        //Logger.Info(string.Format("Section [{0}:{1}] deleted.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Adding Section(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Deleting Section(s) list failed !");
            }
        }
Exemple #2
0
        /// <summary>
        /// Method to update a list of Info entities into the database.
        /// </summary>
        /// <param name="newItems">The list of items to update.</param>
        /// <param name="oldItems"></param>
        public static async void DbUpdateAsync(List <InfoEntity> newItems, List <InfoEntity> oldItems)
        {
            // Check for Replace | Edit items.
            try
            {
                log.Info("Replacing Info. Please wait...");

                if (newItems != null && newItems.Count > 0)
                {
                    foreach (InfoEntity entity in newItems)
                    {
                        //await MainWindow.Database.Infos.UpdateAsync(entity);
                        await Task.Delay(10);

                        throw new NotImplementedException();

                        //Logger.Info(string.Format("Info [{0}:{1}] updated.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Replacing Info(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Replacing Info(s) failed !");
            }
        }
Exemple #3
0
        /// <summary>
        /// Method to insert a list of Info entities into the database.
        /// </summary>
        /// <param name="newItems">The list of items to add.</param>
        public static void DbInsert(List <InfoEntity> newItems)
        {
            try
            {
                log.Info("Adding Info(s). Please wait...");

                if (newItems != null && newItems.Count > 0)
                {
                    foreach (InfoEntity entity in newItems)
                    {
                        //entity.Initialize();
                        //MainWindow.Database.Info_Add(entity);

                        throw new NotImplementedException();

                        //Logger.Info(string.Format("Info [{0}:{1}] added.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Adding Info(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Adding Info(s) failed !");
            }
        }
Exemple #4
0
        /// <summary>
        /// Method to update a list of Section entities into the database.
        /// </summary>
        /// <param name="newItems">Thee list of items to update.</param>
        /// <param name="oldItems"></param>
        public static async void DbUpdateAsync(List <SectionEntity> newItems, List <SectionEntity> oldItems)
        {
            log.Info("Replacing Section. Please wait...");

            try
            {
                if (newItems != null && newItems.Count > 0)
                {
                    foreach (SectionEntity entity in newItems)
                    {
                        FormatAlias(entity);

                        await Db.Sections.UpdateAsync(entity);

                        log.Info(string.Format("Section [{0}:{1}] updated.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Replacing Section(s) failed !");
            }
        }
Exemple #5
0
        /// <summary>
        /// Method to insert a list of AclGroup entities into the database.
        /// </summary>
        /// <param name="newItems">Thee list of items to add.</param>
        public static void DbInsert(List <AclGroupEntity> newItems)
        {
            log.Info("Adding AclGroup(s). Please wait...");

            try
            {
                if (newItems != null && newItems.Count > 0)
                {
                    foreach (AclGroupEntity entity in newItems)
                    {
                        Db.AclGroups.Add(entity);

                        log.Info($"AclGroup [{entity.PrimaryKey}:{entity.Name}] added.");
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Adding AclGroup(s). Done !");
            }
            catch (Exception e)
            {
                log.Error(e.Output(), e);
                MessageBoxs.Fatal(e, "Adding AclGroup(s) failed !");
            }
        }
Exemple #6
0
        /// <summary>
        /// Method to update a list of AclAction entities into the database.
        /// </summary>
        /// <param name="newItems">Thee list of items to update.</param>
        /// <param name="oldItems"></param>
        public static void DbUpdate(List <AclActionEntity> newItems, List <AclActionEntity> oldItems)
        {
            log.Info("Replacing AclAction. Please wait...");

            try
            {
                if (newItems != null && newItems.Count > 0)
                {
                    foreach (AclActionEntity entity in newItems)
                    {
                        //await Db.AclActions.Update(entity);

                        MessageBoxs.NotImplemented();

                        log.Info($"AclAction [{entity.PrimaryKey}:{entity.Action}] updated.");
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Replacing AclAction(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex);
                MessageBoxs.Fatal(ex, "Replacing AclAction(s) failed !");
            }
        }
Exemple #7
0
        /// <summary>
        /// Method called on quality filter selection changed event.
        /// </summary>
        /// <param name="sender">The <see cref="object"/> sender of the event.</param>
        /// <param name="e">The celection changed event arguments <see cref="SelectionChangedEventArgs"/></param>
        private void FiltersQuality_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ((ComboBox)((ListViewAlbumsLayout)FindName("ListViewAlbumsLayoutName"))
                 .FindName("FiltersQualitySelector")).IsEditable = false;

                if (((ComboBox)sender).SelectedItem is InfoEntity info)
                {
                    Model.ChangeFiltersQuality(info);
                }
            }

            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Filters Quality Selection Changed. Fail.");
            }

            finally
            {
                MessageBoxs.IsBusy = false;
            }

            RefreshAlbums();
        }
Exemple #8
0
        /// <summary>
        /// Method to update a list of Picture entities into the database.
        /// </summary>
        /// <param name="newItems">The list of items to update.</param>
        /// <param name="oldItems"></param>
        public static async void DbUpdateAsync(List <PictureEntity> newItems, List <PictureEntity> oldItems)
        {
            // Check for Replace | Edit items.
            try
            {
                log.Info("Replacing Picture. Please wait...");

                if (newItems != null && newItems.Count > 0)
                {
                    foreach (PictureEntity entity in newItems)
                    {
                        await Db.Pictures.UpdateAsync(entity);

                        log.Info(string.Format("Picture [{0}:{1}] updated.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Replacing Picture(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Replacing Picture(s) failed !");
            }
        }
Exemple #9
0
        /// <summary>
        /// Method to update a list of AclGroup entities into the database.
        /// </summary>
        /// <param name="newItems">Thee list of items to update.</param>
        /// <param name="oldItems"></param>
        public static async void DbUpdateAsync(List <AclGroupEntity> newItems, List <AclGroupEntity> oldItems)
        {
            log.Info("Replacing AclGroup. Please wait...");

            try
            {
                if (newItems != null && newItems.Count > 0)
                {
                    foreach (AclGroupEntity entity in newItems)
                    {
                        await Db.AclGroups.UpdateAsync(entity);

                        if (entity.IsDefault)
                        {
                            Db.AclGroups.SetDefault(entity.PrimaryKey);
                        }

                        log.Info(string.Format("AclGroup [{0}:{1}] updated.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Replacing AclGroup(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Replacing AclGroup(s) failed !");
            }
        }
Exemple #10
0
        /// <summary>
        /// Method to delete a list of AclGroup entities from the database.
        /// </summary>
        /// <param name="oldItems">The list of items to remove.</param>
        public static void DbDelete(List <AclGroupEntity> oldItems)
        {
            log.Info("Deleting AclGroup(s). Please wait...");

            try
            {
                if (oldItems != null && oldItems.Count > 0)
                {
                    foreach (AclGroupEntity entity in oldItems)
                    {
                        if (!entity.IsDefault)
                        {
                            Db.AclGroups.Delete(entity.PrimaryKey);
                        }

                        log.Info(string.Format("AclGroup [{0}:{1}] deleted.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Deleting AclGroup(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Deleting AclGroup(s) list failed !");
            }
        }
Exemple #11
0
        /// <summary>
        /// Method to refresh the list of <see cref="AlbumEntity"/> from database.
        /// </summary>
        private void RefreshAlbums()
        {
            try
            {
                MessageBoxs.IsBusy = true;
                log.Warn("Refreshing Albums list. Please wait...");

                FindName <ListViewAlbumsLayout>("ListViewAlbumsLayoutName").Visibility = Visibility.Hidden;
                Model.LoadAlbums();
                FindName <ListViewAlbumsLayout>("ListViewAlbumsLayoutName").Visibility = Visibility.Visible;

                log.Warn($"Refreshing {Model?.Albums?.Items?.Count() ?? 0} Albums. Done.");
            }

            catch (Exception ex)
            {
                log.Fatal(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Refreshing Albums list. Fail.");
            }

            finally
            {
                MessageBoxs.IsBusy = false;
            }
        }
Exemple #12
0
        /// <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;
            }
        }
Exemple #13
0
        /// <summary>
        /// Method called asynchronously on User entities collection changed.
        /// </summary>
        /// <param name="oldItems">The list of items to remove.</param>
        public static void DbDelete(List <UserEntity> oldItems)
        {
            log.Info("Deleting User(s). Please wait...");

            try
            {
                log.Info("Deleting User(s). Please wait...");

                if (oldItems != null && oldItems.Count > 0)
                {
                    foreach (UserEntity entity in oldItems)
                    {
                        Db.Users.Delete(entity);

                        log.Info(string.Format("User [{0}:{1}] deleted.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Adding User(s). Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Deleting User(s) list failed !");
            }
        }
Exemple #14
0
        /// <summary>
        /// Method called asynchronously on User entities collection changed.
        /// </summary>
        /// <param name="newItems">Thee list of items to add.</param>
        public static void DbInsert(List <UserEntity> newItems)
        {
            MessageBoxs.IsBusy = true;
            log.Info("Adding User(s). Please wait...");

            try
            {
                log.Info("Adding User(s). Please wait...");

                if (newItems != null && newItems.Count > 0)
                {
                    foreach (UserEntity entity in newItems)
                    {
                        Db.Users.Add(entity);

                        log.Info(string.Format("User [{0}:{1}] added.", entity.PrimaryKey, entity.Name));
                    }
                }

                AppNavigatorBase.Clear();
                log.Info("Adding User(s). Done !");
            }
            catch (Exception e)
            {
                log.Error(e);
                MessageBoxs.Fatal(e, "Adding User(s) failed !");
            }
            finally
            {
                MessageBoxs.IsBusy = false;
            }
        }
Exemple #15
0
        /// <summary>
        /// Method to insert a list of Album entities into the database.
        /// </summary>
        /// <param name="newItem">The <see cref="AlbumEntity"/> to add.</param>
        public static AlbumEntity DbInsert(AlbumEntity newItem)
        {
            try
            {
                return(DbInsert(new AlbumEntity[] { newItem })?.First());
            }

            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Adding Album to database failed.");
            }

            return(null);
        }
Exemple #16
0
        /// <summary>
        /// Method to update a list of Album entities into the database.
        /// </summary>
        /// <param name="newItems">The list of items to update.</param>
        /// <param name="oldItems">The list of items before changes.</param>
        public static async Task <IList <AlbumEntity> > DbUpdateAsync(IEnumerable <AlbumEntity> newItems, IEnumerable <AlbumEntity> oldItems)
        {
            // Log error if the list to update if not null.
            if (newItems == null)
            {
                log.Error(Exceptions.GetArgumentNull(nameof(newItems), typeof(IEnumerable <AlbumEntity>)).Output());
                return(null);
            }

            // Check if the list to update is not empty.
            if (newItems.Count() == 0)
            {
                log.Debug($"{typeof(AlbumEntityCollection).Name}.{MethodBase.GetCurrentMethod().Name} : the list of {typeof(AlbumEntity).Name} to update is empty.");
                return(null);
            }

            // Create a new list for update return.
            IList <AlbumEntity> itemsUpdated = new List <AlbumEntity>();

            log.Info($"Updating {newItems.Count()} album{(newItems.Count() > 1 ? "s" : "")} : Please wait...");

            try
            {
                foreach (AlbumEntity entity in newItems)
                {
                    // Get all Album to check some properties before inserting new item.
                    // Format Alias before update.
                    FormatAlias(entity);

                    // Update item into the database.
                    itemsUpdated.Add(await Db.Albums.UpdateAsync(entity));
                    log.Info($"Album [{entity.PrimaryKey}:{entity.Name}] updated.");
                }

                // Clear application navigator to refresh it for new data.
                AppNavigatorBase.Clear();
                log.Info($"Updating {itemsUpdated.Count()} album{(itemsUpdated.Count() > 1 ? "s" : "")} : Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, $"Updating {newItems.Count() - itemsUpdated.Count()}/{newItems.Count()} album{(newItems.Count() > 1 ? "s" : "")} : Failed.");
            }

            return(itemsUpdated);
        }
Exemple #17
0
        /// <summary>
        /// Method to insert a list of Album entities into the database.
        /// </summary>
        /// <param name="newItems">The list of items to add.</param>
        public static IEnumerable <AlbumEntity> DbInsert(IEnumerable <AlbumEntity> newItems)
        {
            if (newItems == null)
            {
                ArgumentNullException e = Exceptions.GetArgumentNull(nameof(newItems), typeof(IEnumerable <AlbumEntity>));
                log.Error(e.Output());
                return(null);
            }

            // Check if the list to add is not empty.
            if (newItems.Count() == 0)
            {
                log.Debug($"{typeof(AlbumEntityCollection).Name}.{MethodBase.GetCurrentMethod().Name} : the list of {typeof(AlbumEntity).Name} to insert is empty.");
                return(null);
            }

            IList <AlbumEntity> itemsAdded = new List <AlbumEntity>();

            log.Info($"Adding {newItems.Count()} album{(newItems.Count() > 1 ? "s" : "")} : Please wait...");

            try
            {
                foreach (AlbumEntity entity in newItems)
                {
                    // Get all Album to check some properties before inserting new item.
                    // Format Alias before update.
                    FormatAlias(entity);

                    // Add new item into the database.
                    itemsAdded.Add(Db.Albums.Add(entity));
                    log.Info($"Album [{entity.PrimaryKey}:{entity.Name}] added.");
                }

                // Clear application navigator to refresh it for new data.
                AppNavigatorBase.Clear();
                log.Info($"Adding {itemsAdded.Count()} album{(itemsAdded.Count() > 1 ? "s" : "")} : Done.");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);;
                MessageBoxs.Fatal(ex, $"Adding {newItems.Count() - itemsAdded.Count()}/{newItems.Count()} album{(newItems.Count() > 1 ? "s" : "")} : Failed.");
            }

            return(itemsAdded);
        }
Exemple #18
0
        /// <summary>
        /// Method to insert a list of Section entities into the database.
        /// </summary>
        /// <param name="newItems">Thee list of items to add.</param>
        public static void DbInsert(List <SectionEntity> newItems)
        {
            log.Info("Adding Section(s) to database. Please wait...");

            try
            {
                // Get all Section to check some properties before inserting new item.
                var items = Db.Sections.List(GetOptionsDefault());

                // Define if it is first item insertion.
                bool firstItem = true;

                // Check if we have new items list to insert.
                if (newItems != null && newItems.Count > 0)
                {
                    int i = 0;
                    foreach (SectionEntity entity in newItems)
                    {
                        // Check it is the first entity to set IsDefault if required.
                        if (items.Count == 0 && firstItem)
                        {
                            entity.IsDefault = true;
                            firstItem        = false;
                        }

                        FormatAlias(entity);

                        // Finally add the entity into the database.
                        Db.Sections.AddAsync(entity);
                        i++;

                        log.Info(string.Format("Section [{0}:{1}] added to database.", entity.PrimaryKey, entity.Name));
                    }
                }

                // Clear navigation cache.
                AppNavigatorBase.Clear();
                log.Info("Adding Section(s) to database. Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Adding Section(s) to database. Fail !");
            }
        }
Exemple #19
0
        /// <summary>
        /// Method to delete a list of Album entities from the database.
        /// </summary>
        /// <param name="oldItems">The list of items to remove.</param>
        public static async Task <IList <AlbumEntity> > DbDeleteAsync(IEnumerable <AlbumEntity> oldItems)
        {
            // Log error if the list to update if not null.
            if (oldItems == null)
            {
                ArgumentNullException e = Exceptions.GetArgumentNull(nameof(oldItems), typeof(IEnumerable <AlbumEntity>));
                log.Error(e.Output(), e);
                return(null);
            }

            // Check if the list to update is not empty.
            if (oldItems.Count() == 0)
            {
                log.Debug($"{typeof(AlbumEntityCollection).Name}.{MethodBase.GetCurrentMethod().Name} : the list of {typeof(AlbumEntity).Name} to delete is empty.");
                return(null);
            }

            // Create a new list for update return.
            IList <AlbumEntity> itemsDeleted = new List <AlbumEntity>();

            log.Info($"Deleting {oldItems.Count()} album{(oldItems.Count() > 1 ? "s" : "")} : Please wait...");

            // Check for Removing items.
            try
            {
                foreach (AlbumEntity entity in oldItems)
                {
                    itemsDeleted.Add(await Db.Albums.DeleteAsync(entity));
                    log.Info($"Album [{entity.PrimaryKey}:{entity.Name}] deleted.");
                }

                // Clear application navigator to refresh it for new data.
                AppNavigatorBase.Clear();
                log.Info($"Deleting {itemsDeleted.Count()} album{(itemsDeleted.Count() > 1 ? "s" : "")} : Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, $"Deleting {oldItems.Count() - itemsDeleted.Count()}/{oldItems.Count()} album{(oldItems.Count() > 1 ? "s" : "")} : Failed.");
            }

            return(itemsDeleted);
        }
Exemple #20
0
        /// <summary>
        /// Method to update a list of Section entities into the database.
        /// </summary>
        /// <param name="newItem"></param>
        public static void SetDefault(SectionEntity newItem)
        {
            log.Info("Setting default Section. Please wait...");

            try
            {
                if (newItem != null)
                {
                    Db.Sections.SetDefaultAsync(newItem.PrimaryKey);
                }

                AppNavigatorBase.Clear();
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Setting default Section. Failed !");
            }
        }
Exemple #21
0
        /// <summary>
        /// Method to update a list of AclGroup entities into the database.
        /// </summary>
        /// <param name="newItem"></param>
        public static void SetDefault(AclGroupEntity newItem)
        {
            log.Info("Setting default User Group. Please wait...");

            try
            {
                if (newItem != null)
                {
                    Db.AclGroups.SetDefault(newItem.PrimaryKey);
                }

                AppNavigatorBase.Clear();
                log.Info("Setting default User Group. Done !");
            }
            catch (Exception ex)
            {
                log.Error(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Setting default User Group failed !");
            }
        }
Exemple #22
0
        /// <summary>
        /// Method to load the list of AclGroups from the database.
        /// </summary>
        public void LoadAclGroups()
        {
            MessageBoxs.IsBusy = true;
            log.Info("Loading Acl Groups list : Start. Please wait...");

            try
            {
                AclGroups.Items = new AclGroupEntityCollection(true);
            }
            catch (Exception e)
            {
                string message = "Loading Acl Groups list failed !";
                log.Fatal(message, e);
                MessageBoxs.Fatal(e, message);
            }
            finally
            {
                log.Info("Loading Acl Groups list : End.");
                MessageBoxs.IsBusy = false;
            }
        }
Exemple #23
0
        /// <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;
            }
        }
Exemple #24
0
        /// <summary>
        /// Method to load the list of users from the database.
        /// </summary>
        public void LoadUsers()
        {
            MessageBoxs.IsBusy = true;
            log.Warn(MessageBoxs.BusyContent = "Loading Users list. Please wait...");

            try
            {
                UserOptionsList op = new UserOptionsList
                {
                    Dependencies = { EnumEntitiesDependencies.UsersInAclGroups }
                };

                if (((DataGridAclGroupsLayout)(ControlView.FindName("UcDataGridAclGroupsServerName")))?.SelectedItem is AclGroupEntity a && a.PrimaryKey > 0)
                {
                    op.IncludeAclGroupKeys = new List <int>()
                    {
                        a.PrimaryKey
                    };
                }

                UserEntityCollection users = new UserEntityCollection(op, false);
                users.Load();
                Users.Items = users;

                log.Info(MessageBoxs.BusyContent = "Loading Users list. Done.");
            }
            catch (Exception e)
            {
                MessageBoxs.BusyContent = "Loading Users list. failed !";
                log.Fatal(MessageBoxs.BusyContent, e);
                MessageBoxs.Fatal(e, (string)MessageBoxs.BusyContent);
            }
            finally
            {
                log.Warn(MessageBoxs.BusyContent = "Loading Users list. Done.");
                MessageBoxs.IsBusy = false;
            }
        }
Exemple #25
0
        /// <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;
            }
        }
Exemple #26
0
        private void LoadAlbums()
        {
            try
            {
                MessageBoxs.IsBusy = true;
                log.Warn("Loading Albums list. Please wait...");

                Model.Albums.Items = new AlbumEntityCollection(true, AlbumOptionsListFilters);

                log.Warn($"Loading {Model?.Albums?.Items?.Count() ?? 0} Albums. Done.");
            }

            catch (Exception ex)
            {
                log.Fatal(ex.Output(), ex);
                MessageBoxs.Fatal(ex, "Loading Albums list. Fail.");
            }

            finally
            {
                MessageBoxs.IsBusy = false;
            }
        }
Exemple #27
0
        /// <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;
            }
        }
Exemple #28
0
        /// <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;
            }
        }
Exemple #29
0
        /// <summary>
        /// Method to ping a server.
        /// </summary>
        public void InitializeWebClient()
        {
            log.Info("Initializing server connection.");

            try
            {
                if (WebClient == null)
                {
                    WebClient = new HttpWebClientApplication(
                        Server.Host,
                        Server.Port,
                        Server.Email,
                        Server.Password,
                        Server.UserName
                        );
                }
            }
            catch (Exception e)
            {
                log.Error("Initializing server connection failed.", e);
                MessageBoxs.Fatal(e, "Initializing server connection failed.");
            }
        }
Exemple #30
0
        /// <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;
            }
        }