Exemplo n.º 1
0
        /// <summary>
        /// Handles the Executed event of the AddCommand control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
        private void AddCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            e.Handled = true;
            var param = e.Parameter as ItemParams;

            if (param == null)
            {
                return;
            }
            switch (param.Type)
            {
            case ObjectType.Category:
                EditCategoryWindow.CreateCategory(param.IntId);
                break;

            case ObjectType.Knowledge:
                EditKnowledgeWindow.CreateKnowledge(param.IntId);
                categoryInfo.ReloadItems();
                break;

            case ObjectType.User:
                EditUserWindow.CreateUser();
                docUsers.ResetData();
                break;

            default:
                e.Handled = false;
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the category.
        /// </summary>
        /// <param name="parentCategoryId">The parent category id.</param>
        public static void CreateCategory(int parentCategoryId)
        {
            if (!SecurityAgent.HasAdminRights(parentCategoryId))
            {
                return;
            }
            var win = new EditCategoryWindow {
                Owner = Application.Current.MainWindow
            };

            win.listCategories.Value = parentCategoryId;
            win.Show();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Edits the category.
        /// </summary>
        /// <param name="id">The id.</param>
        public static void EditCategory(int id)
        {
            if (!SecurityAgent.HasAdminRights(id))
            {
                return;
            }

            var entity = AppCore.Workspace.Categories.GetById(id);

            if (entity == null)
            {
                return;
            }

            var win = new EditCategoryWindow {
                Owner = Application.Current.MainWindow
            };

            win.ShowCategory(entity);
            win.ShowDialog();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles the Executed event of the EditCommand control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
        private void EditCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var param = (ItemParams)e.Parameter;

            switch (param.Type)
            {
            case ObjectType.Category:
                EditCategoryWindow.EditCategory(param.IntId);

                break;

            case ObjectType.Knowledge:
                EditKnowledgeWindow.EditKnowledge(param.IntId);
                break;

            case ObjectType.User:
                EditUserWindow.EditUser(param.IntId);
                docUsers.ResetData();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }