Esempio n. 1
0
        async virtual protected Task Initialize(DateTimeOffset referenceNow, DateTimeOffset StartOfDay, TilerElements.Location requestLocation, HashSet <string> calendarIds = null)
        {
            if (!myAccount.Status)
            {
                throw new Exception("Using non verified tiler Account, try logging into account first.");
            }

            _Now = new ReferenceNow(referenceNow, StartOfDay, myAccount.getTilerUser().TimeZoneDifference);
            this.RangeOfLookup = this.RangeOfLookup ?? new TimeLine(_Now.constNow.AddDays(Schedule.TimeLookUpDayStart), _Now.constNow.AddDays(Schedule.TimeLookUpDayEnd));
            Tuple <Dictionary <string, CalendarEvent>, DateTimeOffset, Dictionary <string, Location>, Analysis> profileData = await myAccount.ScheduleData.getProfileInfo(RangeOfLookup, _Now, this.retrievalOptions, requestLocation, calendarIds : calendarIds).ConfigureAwait(false);

            myAccount.Now = _Now;
            TravelCache travelCache = await myAccount.ScheduleData.getTravelCache(myAccount.UserID).ConfigureAwait(false);

            updateTravelCache(travelCache);
            if (profileData != null)
            {
                this.setAnalysis(profileData.Item4);
                DateTimeOffset referenceDayTimeNow = new DateTimeOffset(Now.calculationNow.Year, Now.calculationNow.Month, Now.calculationNow.Day, profileData.Item2.Hour, profileData.Item2.Minute, profileData.Item2.Second, new TimeSpan());// profileData.Item2;
                ReferenceDayTIime = Now.calculationNow < referenceDayTimeNow?referenceDayTimeNow.AddDays(-1) : referenceDayTimeNow;

                initializeAllEventDictionary(profileData.Item1.Values);
                if (getAllEventDictionary != null)
                {
                    EventID.Initialize((uint)(myAccount.LastEventTopNodeID));
                    initializeThirdPartyCalendars();
                    updateThirdPartyCalendars(ThirdPartyControl.CalendarTool.outlook, new List <CalendarEvent>()
                    {
                    });
                    CompleteSchedule = getTimeLine();
                }
                Locations = profileData.Item3;
            }
            TilerUser = myAccount.getTilerUser();
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a schedule dump and then persists it to the DB
        /// </summary>
        /// <returns></returns>
        virtual async public Task <ScheduleDump> CreateAndPersistScheduleDump(TilerElements.Location requestLocation = null, ScheduleDump scheduleDump = null, ReferenceNow now = null)
        {
            if (requestLocation == null)
            {
                requestLocation = TilerElements.Location.getDefaultLocation();
            }
            ReferenceNow refNow = now ?? this.Now;

            scheduleDump = scheduleDump ?? await this.CreateScheduleDump(requestLocation, refNow).ConfigureAwait(false);

            scheduleDump.ReferenceNow = this.Now.constNow;
            scheduleDump.StartOfDay   = this.Now.EndOfDay;

            myAccount.ScheduleLogControl.Database.ScheduleDumps.Add(scheduleDump);
            await persistToDB().ConfigureAwait(false);

            return(scheduleDump);
        }
Esempio n. 3
0
 public DB_CalendarEventRestricted(CalendarEvent CalendarEventData, RestrictionProfile restrictionData, ReferenceNow now)
 {
     //CalendarEventRestricted MyCalendarEventCopy = CalendarEventData.new CalendarEventRestricted();
     this._EventDuration    = CalendarEventData.getActiveDuration;
     this._Name             = CalendarEventData.getName;
     this._EventPreDeadline = CalendarEventData.getPreDeadline;
     this._PrepTime         = CalendarEventData.getPreparation;
     this._Priority         = CalendarEventData.getEventPriority;
     //this.RepetitionFlag = CalendarEventData.RepetitionStatus;
     this._EventRepetition          = (CalendarEventData).Repeat; // EventRepetition != CalendarEventData.null ? EventRepetition.CreateCopy() : EventRepetition;
     this._Complete                 = CalendarEventData.getIsComplete;
     this._RigidSchedule            = CalendarEventData.isRigid;  //hack
     this._Splits                   = CalendarEventData.NumberOfSplit;
     this._AverageTimePerSplit      = CalendarEventData.AverageTimeSpanPerSubEvent;
     this.UniqueID                  = CalendarEventData.Calendar_EventID;//hack
     this._SubEvents                = new SubEventDictionary <string, SubCalendarEvent>();
     this._UiParams                 = CalendarEventData.getUIParam;
     this._DataBlob                 = CalendarEventData.Notes;
     this._Enabled                  = CalendarEventData.isEnabled;
     this._LocationInfo             = CalendarEventData.Location;//hack you might need to make copy
     this._ProfileOfProcrastination = CalendarEventData.getProcrastinationInfo;
     this._AutoDeleted              = CalendarEventData.getIsUserDeleted;
     this._CompletedCount           = CalendarEventData.CompletionCount;
     this._DeletedCount             = CalendarEventData.DeletionCount;
     this._ProfileOfRestriction     = restrictionData;
     this._isEventRestricted        = true;
     this._Now = now;
     this.updateStartTime(CalendarEventData.Start);
     this.updateEndTime(CalendarEventData.End);
     if (this._EventRepetition != null && !this._EventRepetition.EnableRepeat)
     {
         foreach (SubCalendarEventRestricted eachSubCalendarEvent in CalendarEventData.AllSubEvents)
         {
             this._SubEvents.Add(eachSubCalendarEvent.Id, eachSubCalendarEvent);
             eachSubCalendarEvent.ParentCalendarEvent = this;
         }
     }
     else if (this._EventRepetition == null)
     {
         isRepeatLoaded_DB = false;
     }
     this._otherPartyID = CalendarEventData.ThirdPartyID;// == CalendarEventData.null ? null : otherPartyID.ToString();
     this._Users        = CalendarEventData.getAllUsers();
     this._Creator      = CalendarEventData.getCreator;
     this._TimeZone     = CalendarEventData.getTimeZone;
     this._ProfileOfNow = CalendarEventData.getNowInfo;
     //return MyCalendarEventCopy;
 }
Esempio n. 4
0
 /// <summary>
 /// Function creates a schedule dump that is equivalent to schedule from RDBMS
 /// </summary>
 /// <returns></returns>
 virtual async public Task <ScheduleDump> CreateScheduleDump(TilerElements.Location requestLocation = null, ReferenceNow referenceNow = null, string notes = "")
 {
     referenceNow = referenceNow ?? this.Now;
     if (requestLocation == null)
     {
         requestLocation = TilerElements.Location.getDefaultLocation();
     }
     return(await myAccount.ScheduleLogControl.CreateScheduleDump(this.getAllCalendarEvents(), myAccount.getTilerUser(), referenceNow, notes, requestLocation).ConfigureAwait(false));
 }
Esempio n. 5
0
        public DB_SubCalendarEventRestricted(SubCalendarEvent mySubCalEvent, DB_RestrictionProfile restrictionData, CalendarEventRestricted parentCalendarEvent, ReferenceNow now)
        {
            this.BusyFrame = mySubCalEvent.ActiveSlot;
            this.HardCalendarEventRange = mySubCalEvent.getCalendarEventRange;
            this._ProfileOfRestriction  = restrictionData;
            this.OldPreferredIndex      = mySubCalEvent.UniversalDayIndex;
            this._otherPartyID          = mySubCalEvent.ThirdPartyID;
            this.updateStartTime(mySubCalEvent.Start);
            this.updateEndTime(mySubCalEvent.End);



            //this.CalendarEventRange = CalendarEventRange.CreateCopy();
            this._Complete                 = mySubCalEvent.getIsComplete;
            this._ConflictingEvents        = mySubCalEvent.Conflicts;
            this._DataBlob                 = mySubCalEvent.Notes;
            this._Enabled                  = mySubCalEvent.isEnabled;
            this._ProfileOfProcrastination = mySubCalEvent.getProcrastinationInfo;
            this._EventDuration            = mySubCalEvent.getActiveDuration;
            this._Name             = mySubCalEvent.getName;
            this._EventPreDeadline = mySubCalEvent.getPreDeadline;
            //this.EventScore = mySubCalEvent.Score;
            //this.EventSequence = mySubCalEvent.EventSequence.CreateCopy();
            //this.HumaneTimeLine = mySubCalEvent.hum HumaneTimeLine.CreateCopy();
            //this.InterferringEvents = mySubCalEvent.inter
            this._isEventRestricted = true;
            this.Vestige            = mySubCalEvent.isVestige;
            this._LocationInfo      = mySubCalEvent.LocationObj;
            this.MiscIntData        = mySubCalEvent.IntData;
            //this.NonHumaneTimeLine = mySubCalEvent.NonHumaneTimeLine.CreateCopy();
            this._PrepTime      = mySubCalEvent.getPreparation;
            this._Priority      = mySubCalEvent.getEventPriority;
            this._RigidSchedule = mySubCalEvent.isRigid;

            this._UiParams      = mySubCalEvent.getUIParam;
            this.UniqueID       = mySubCalEvent.SubEvent_ID;
            this.UnUsableIndex  = 0;
            this._AutoDeleted   = mySubCalEvent.getIsUserDeleted;
            this._Name          = mySubCalEvent.getName;
            this._Creator       = mySubCalEvent.getCreator;
            this._Users         = mySubCalEvent.getAllUsers();
            this._TimeZone      = mySubCalEvent.getTimeZone;
            this._Now           = now;
            this._calendarEvent = parentCalendarEvent;
            initializeCalendarEventRange(restrictionData, this.HardCalendarEventRange);
        }
Esempio n. 6
0
 public DB_UserActivity(ReferenceNow referenceNow, ActivityType type, IEnumerable <String> ids = null) : base(referenceNow.constNow, type, ids)
 {
 }
Esempio n. 7
0
 public DB_UserActivity(ReferenceNow triggerTime, ActivityType type) : base(triggerTime, type)
 {
 }
Esempio n. 8
0
 virtual async public Task Commit(IEnumerable <CalendarEvent> AllEvents, CalendarEvent calendarEvent, String LatestID, ReferenceNow now, TravelCache travelCache, TilerElements.Location requestLocation)
 {
     await UserLog.Commit(AllEvents, calendarEvent, LatestID, now, travelCache, requestLocation).ConfigureAwait(false);
 }