Example #1
0
        /// <summary>
        /// Get Calendar Category Details
        /// </summary>
        /// <param name="CategoryId">Category Id</param>
        /// <returns><seealso cref="CalendarDs.CalendarCategoriesRow"/>CalendarDs.CalendarCategoriesRow</returns>
        public CalendarDs.CalendarCategoriesRow GetCategoryDetails(int CategoryId)
        {
            CalendarDs.CalendarCategoriesDataTable categories = GetCategories(string.Format("CategoryId={0}", CategoryId));

            if (categories.Rows.Count > 0)
            {
                return((CalendarDs.CalendarCategoriesRow)categories.Rows[0]);
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Adds a calendar category
        /// </summary>
        /// <param name="CategoryName">Name</param>
        /// <returns>id of the added category</returns>
        public int AddCalendarCategory(string CategoryName)
        {
            CalendarDs ds = new CalendarDs();

            CalendarDsTableAdapters.CalendarCategoriesTableAdapter Adp = new CalendarDsTableAdapters.CalendarCategoriesTableAdapter();
            CalendarDs.CalendarCategoriesDataTable dt  = new CalendarDs.CalendarCategoriesDataTable();
            CalendarDs.CalendarCategoriesRow       row = dt.NewCalendarCategoriesRow();

            row.CategoryName = CategoryName;

            dt.AddCalendarCategoriesRow(row);
            Adp.Update(dt);

            return(row.CategoryId);
        }