Ejemplo n.º 1
0
        public static IList <SchedulableField> GetSchedulableFields(Document document, Category category)
        {
            var transaction = new Transaction(document, "Create Key Schedule");

            transaction.Start();

            ViewSchedule schedule = null;

            try
            {
                schedule = ViewSchedule.CreateKeySchedule(document, category.Id);
            }
            catch (ArgumentException)
            {
            }

            if (schedule == null)
            {
                transaction.RollBack();
                return(null);
            }

            var schedFields = schedule.Definition.GetSchedulableFields();

            transaction.RollBack();

            return(schedFields);
        }
Ejemplo n.º 2
0
        public static ViewSchedule GetNewSchedule(Document document, ElementId category)
        {
            var transaction = new Transaction(document, "Create Key Schedule");

            transaction.Start();

            var schedule = ViewSchedule.CreateKeySchedule(document, category);

            transaction.Commit();

            return(schedule);
        }