PurplePen.EventDB.ChangeEvent C# (CSharp) Method

ChangeEvent() public method

public ChangeEvent ( Event e ) : void
e Event
return void
        public void ChangeEvent(Event e)
        {
            if (!eventStore.IsPresent(new Id<Event>(1))) {
                Id<Event> id = eventStore.Add(e);
                Debug.Assert(id.id == 1);
            }
            else {
                eventStore.Replace(new Id<Event>(1), e);
            }
        }

Usage Example

Example #1
0
        // Change the course print area. If "removeParts" is true, and the course is an all parts,
        // then remove print descriptions for each part.
        public static void ChangePrintArea(EventDB eventDB, CourseDesignator courseDesignator, bool removeParts, PrintArea printArea)
        {
            printArea = (PrintArea) printArea.Clone();

            if (courseDesignator.IsAllControls) {
                Event e = eventDB.GetEvent();

                e = (Event) e.Clone();
                e.printArea = printArea;

                eventDB.ChangeEvent(e);
            }
            else {
                Course course = eventDB.GetCourse(courseDesignator.CourseId);

                course = (Course) course.Clone();

                if (courseDesignator.AllParts) {
                    course.printArea = printArea;

                    if (removeParts)
                        course.partPrintAreas = new Dictionary<int, PrintArea>();
                }
                else {
                    course.partPrintAreas[courseDesignator.Part] = printArea;
                }

                eventDB.ReplaceCourse(courseDesignator.CourseId, course);
            }
        }
All Usage Examples Of PurplePen.EventDB::ChangeEvent