Example #1
0
        /// <summary>
        /// Remove an assigned category from one of the sheet categories.
        /// </summary>
        /// <param name="categoryName"></param>
        public static Boolean RemoveSheetCategory(Sheet sheet, String categoryName)
        {
            Boolean      returnValue  = default(Boolean);
            CategoryItem categoryItem = default(CategoryItem);

            try
            {
                //User must select a Category Item.
                categoryItem = SelectCategoryItem(sheet, categoryName, "Select a Category Item to Remove from existing Sheet Cells. Note: Cells without selected Item will be permanently deleted.", 0, false);

                if (categoryItem != null)
                {
                    _ValueChanging = true;

                    //move it
                    sheet.AssignCategory(categoryName, Category.SheetCategoryType.None, categoryItem);

                    _ValueChanging = false;

                    //refresh
                    //Refresh();

                    returnValue = true;
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                _ValueChanging = false;
                throw;
            }
            return(returnValue);
        }
Example #2
0
        /// <summary>
        /// Changed an assigned category to another sheet category.
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="category"></param>
        /// <param name="categoryType"></param>
        public static Boolean MoveSheetCategory(Sheet sheet, String categoryName, Category.SheetCategoryType categoryType)
        {
            Boolean returnValue = default(Boolean);

            try
            {
                _ValueChanging = true;

                //move it
                sheet.AssignCategory(categoryName, categoryType, (CategoryItem)null);

                _ValueChanging = false;

                //refresh
                //Refresh();

                returnValue = true;
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                _ValueChanging = false;
                throw;
            }
            return(returnValue);
        }