Esempio n. 1
0
        /// <summary>
        /// Adds an event to the calendar
        /// </summary>
        /// <param name="DateFrom">DateFrom Field</param>
        /// <param name="DateTo">DateTo Field</param>
        /// <param name="Time">Time of the Event (just a string could be from 1:00 pm to 2:00 pm or simply 3:00 pm)</param>
        /// <param name="Title">Title of the event</param>
        /// <param name="Location">Location</param>
        /// <param name="Status">Status 1: enabled 0: disabled</param>
        /// <param name="Description">Description of the event</param>
        /// <param name="CategoryId">Category Id for the event</param>
        /// <param name="UserId">the User or Member Id that added this event</param>
        /// <param name="lan">Event Language <seealso cref="Languages"/></param>
        /// <returns>ID of the created event</returns>
        public int AddEvent(DateTime DateFrom, DateTime?DateTo,
                            string Time, string Title, string Location,
                            byte Status, string Description,
                            int CategoryId, int UserId, Languages lan)
        {
            CalendarDs ds = new CalendarDs();

            CalendarDs.CalendarRow row = ds.Calendar.NewCalendarRow();
            CalendarDsTableAdapters.CalendarTableAdapter Adp = new CalendarDsTableAdapters.CalendarTableAdapter();

            row.DateFrom    = DateFrom;
            row.DateTo      = (System.DateTime)DateTo;
            row.Time        = Time;
            row.Title       = Title;
            row.Location    = Location;
            row.Status      = Status;
            row.Description = Description;
            row.CategoryId  = CategoryId;
            row.UserId      = UserId;
            row.Language    = (short)lan;

            ds.Calendar.AddCalendarRow(row);
            Adp.Update(ds);

            return(row.Id);
        }
Esempio n. 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);
        }