Example #1
0
        public DB_CalendarEventFly(string EventIDData, string Name, DateTimeOffset StartData, DateTimeOffset EndData, int PriorityData, Repetition RepetitionData, Location_Elements LocationData, TimeSpan TImePerSplitData, DateTimeOffset OriginalStartData, TimeSpan EventPrepTimeData, TimeSpan Event_PreDeadlineData, bool EventRigidFlagData, int SplitData, EventDisplay UiData, MiscData NoteData, bool CompletionFlagData, long RepeatIndexData, Procrastination ProcrastinationData, NowProfile NowProfileData, int CompleteCountData, int DeletionCountData, List <string> AllUserIDs)
        {
            EventName                = Name;
            StartDateTime            = StartData;
            EndDateTime              = EndData;
            EventRepetition          = RepetitionData;
            LocationInfo             = LocationData;
            TimePerSplit             = TImePerSplitData;
            OriginalStart            = OriginalStartData;
            PrepTime                 = EventPrepTimeData;
            EventPreDeadline         = Event_PreDeadlineData;
            ProfileOfNow             = NowProfileData;
            RigidSchedule            = EventRigidFlagData;
            Complete                 = CompletionFlagData;
            CompletedCount           = CompleteCountData;
            DeletedCount             = DeletionCountData;
            ProfileOfProcrastination = ProcrastinationData;
            SubEvents                = new Dictionary <EventID, SubCalendarEvent>();
            Priority                 = PriorityData;
            isRestricted             = false;
            RepetitionSequence       = 0;
            Splits   = SplitData;
            UniqueID = new EventID(EventIDData);
            UserIDs  = AllUserIDs;

            if (EventRepetition.Enable)
            {
                EventRepetition.PopulateRepetitionParameters(this);
            }
            else
            {
                DateTimeOffset SubEventEndData   = EndData;
                DateTimeOffset SubEventStartData = SubEventEndData - TimePerSplit;
                int            i             = 0;
                int            SubEventCount = Splits - (CompletedCount + DeletedCount);
                for (int j = 0; j < SubEventCount; i++, j++)
                {
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, false, true, AllUserIDs.ToList(), i);
                    SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }

                /*
                 * for (int j = 0; j < CompletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, true, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 *
                 * for (int j = 0; j < DeletedCount; i++, j++)
                 * {
                 *  EventID SubEventID = EventID.GenerateSubCalendarEvent(UniqueID.ToString(), i + 1);
                 *  SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, Name, SubEventStartData, SubEventEndData, PriorityData, LocationInfo.CreateCopy(), OriginalStart, EventPrepTimeData, Event_PreDeadlineData, EventRigidFlagData, UiData.createCopy(), NoteData.createCopy(), Complete, ProcrastinationData, NowProfileData, this.RangeTimeLine, EventRepetition.Enable, true, false, AllUserIDs.ToList(), 0);
                 *  SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                 * }
                 */
            }
            UpdateLocationMatrix(myLocation);
        }
Example #2
0
        internal DB_SubCalendarEventFly(EventID EventIDData, string Name, DateTimeOffset StartData, DateTimeOffset EndData, int PriorityData, Location_Elements LocationData, DateTimeOffset OriginalStartData, TimeSpan EventPrepTimeData, TimeSpan Event_PreDeadlineData, bool EventRigidFlagData, EventDisplay UiData, MiscData NoteData, bool CompletionFlagData, Procrastination ProcrastinationData, NowProfile NowProfileData, TimeLine CalendarEventRangeData, bool FromRepeatFlagData, bool ElapsedFlagData, bool EnabledFlagData, List <string> UserIDData, long Sequence)
        {
            this.BusyFrame          = new BusyTimeLine(EventIDData.ToString(), StartData, EndData);
            this.CalendarEventRange = CalendarEventRangeData;
            this.FromRepeatEvent    = FromRepeatFlagData;
            this.EventName          = Name;
            this.EventDuration      = BusyFrame.BusyTimeSpan;
            this.Complete           = CompletionFlagData;
            this.ConflictingEvents  = new ConflictProfile();
            this.DataBlob           = NoteData;
            this.DeadlineElapsed    = ElapsedFlagData;
            this.Enabled            = EnabledFlagData;
            this.StartDateTime      = StartData;
            this.EndDateTime        = EndData;
            this.EventPreDeadline   = Event_PreDeadlineData;
            this.RepetitionSequence = Sequence;
            this.LocationInfo       = LocationData;
            //this.OldPreferredIndex = mySubCalEvent.OldUniversalIndex;
            //this.otherPartyID = mySubCalEvent.ThirdPartyID;
            //this.preferredDayIndex = mySubCalEvent.UniversalDayIndex;
            this.PrepTime                 = EventPrepTimeData;
            this.Priority                 = PriorityData;
            this.ProfileOfNow             = NowProfileData;
            this.ProfileOfProcrastination = ProcrastinationData;
            //this.RepetitionFlag = mySubCalEvent.FromRepeat;
            this.RigidSchedule = EventRigidFlagData;

            this.UiParams = UiData;
            this.UniqueID = EventIDData;

            this.UserIDs       = UserIDData;
            this.OriginalStart = OriginalStartData;
        }
Example #3
0
        static public CalendarEvent InstantiateRepeatedCandidate(EventID EventIDEntry, string EventName, TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, DateTimeOffset OriginalStartData, TimeSpan EventPrepTime, TimeSpan Event_PreDeadline, bool EventRigidFlag, Repetition EventRepetitionEntry, int EventSplit, Location_Elements EventLocation, bool enabledFlag, EventDisplay UiData, MiscData NoteData, bool CompletionFlag, long RepeatIndex, ConcurrentDictionary <DateTimeOffset, CalendarEvent> OrginalStartToCalendarEvent, CalendarEvent RepeatRootData)
        {
            DB_CalendarEventFly RetValue = new DB_CalendarEventFly();

            RetValue.EventName          = EventName;
            RetValue.StartDateTime      = EventStart;
            RetValue.EndDateTime        = EventDeadline;
            RetValue.EventDuration      = Event_Duration;
            RetValue.Enabled            = enabledFlag;
            RetValue.EventRepetition    = EventRepetitionEntry;
            RetValue.PrepTime           = EventPrepTime;
            RetValue.EventPreDeadline   = Event_PreDeadline;
            RetValue.RigidSchedule      = EventRigidFlag;
            RetValue.LocationInfo       = EventLocation;
            RetValue.UniqueID           = EventIDEntry;
            RetValue.UiParams           = UiData;
            RetValue.DataBlob           = NoteData;
            RetValue.Complete           = CompletionFlag;
            RetValue.RepetitionSequence = RepeatIndex;
            RetValue.OriginalStart      = OriginalStartData;
            RetValue.Splits             = EventSplit;
            RetValue.TimePerSplit       = TimeSpan.FromTicks(((RetValue.EventDuration.Ticks / RetValue.Splits)));
            RetValue.FromRepeatEvent    = true;

            /*
             * if (RetValue.EventRepetition.Enable)
             * {
             *  RetValue.Splits = EventSplit;
             *  RetValue.TimePerSplit = new TimeSpan();
             * }
             * else
             * {
             *  RetValue.Splits = EventSplit;
             * }
             */
            RetValue.SubEvents = new Dictionary <EventID, SubCalendarEvent>();

            if (!RetValue.EventRepetition.Enable)
            {
                for (int i = 0; i < RetValue.Splits; i++)
                {
                    //(TimeSpan Event_Duration, DateTimeOffset EventStart, DateTimeOffset EventDeadline, TimeSpan EventPrepTime, string myParentID, bool Rigid, Location EventLocation =null, TimeLine RangeOfSubCalEvent = null)
                    EventID          SubEventID     = EventID.GenerateSubCalendarEvent(RetValue.UniqueID.ToString(), i + 1);
                    SubCalendarEvent newSubCalEvent = new DB_SubCalendarEventFly(SubEventID, RetValue.EventName, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.EndDateTime, RetValue.Priority, RetValue.myLocation, RetValue.OriginalStart, RetValue.Preparation, RetValue.PreDeadline, RetValue.Rigid, RetValue.UIParam.createCopy(), RetValue.Notes.createCopy(), false, RetValue.ProcrastinationInfo, RetValue.NowInfo, RetValue.RangeTimeLine, true, false, true, RetValue.UserIDs, i);

                    //SubCalendarEvent newSubCalEvent = new SubCalendarEvent(RetValue.TimePerSplit, (RetValue.EndDateTime - RetValue.TimePerSplit), RetValue.End, new TimeSpan(), OriginalStartData, RetValue.UniqueID.ToString(), RetValue.RigidSchedule, RetValue.isEnabled, RetValue.UiParams, RetValue.Notes, RetValue.Complete, i+1, EventLocation, RetValue.RangeTimeLine);
                    RetValue.SubEvents.Add(newSubCalEvent.SubEvent_ID, newSubCalEvent);
                }
            }
            RetValue.EventSequence = new TimeLine(RetValue.StartDateTime, RetValue.EndDateTime);
            RetValue.RepeatRoot    = RepeatRootData;
            RetValue.UpdateLocationMatrix(RetValue.LocationInfo);


            while (!OrginalStartToCalendarEvent.TryAdd(OriginalStartData, RetValue))
            {
                Thread.Sleep(10);
            }


            return(RetValue);
        }