Esempio n. 1
0
        public async Task <IHttpActionResult> GetCalEvent(string id, [FromUri] AuthorizedUser myUser)
        {
            UserAccount retrievedUser = await myUser.getUserAccount(db);

            await retrievedUser.Login();

            TilerElements.CalendarEvent retrievedCalendarEvent = await retrievedUser.ScheduleLogControl.getCalendarEventWithID(id);

            PostBackData retValue = new PostBackData(retrievedCalendarEvent.ToCalEvent(), 0);


            return(Ok(retValue.getPostBack));
        }
Esempio n. 2
0
        public static SubCalEvent ToSubCalEvent(this TilerElements.PausedTimeLineEntry pausedTimeline, TilerElements.CalendarEvent CalendarEventEntry, bool includeCalendarEvent = true)
        {
            SubCalendarEvent pausedSubEvent = CalendarEventEntry.getSubEvent(pausedTimeline.getSubEventId());
            DateTimeOffset   CurrentTime    = DateTimeOffset.UtcNow;
            SubCalEvent      retValue       = new SubCalEvent();

            retValue.ThirdPartyUserID  = CalendarEventEntry.getCreator.Id;
            retValue.ThirdPartyType    = CalendarEventEntry.ThirdpartyType.ToString();
            retValue.ThirdPartyEventID = CalendarEventEntry.ThirdPartyID;
            retValue.ID         = pausedTimeline.Id;
            retValue.CalendarID = CalendarEventEntry.Calendar_EventID.getRepeatCalendarEventID();

            retValue.SubCalStartDate          = (long)(pausedTimeline.Start - JSStartTime).TotalMilliseconds;
            retValue.SubCalEndDate            = (long)(pausedTimeline.End - JSStartTime).TotalMilliseconds;
            retValue.SubCalTotalDuration      = pausedTimeline.TimelineSpan;
            retValue.SubCalRigid              = CalendarEventEntry.isRigid;
            retValue.SubCalAddressDescription = pausedSubEvent.Location.Description;
            retValue.SubCalAddress            = pausedSubEvent.Location.Address;
            retValue.ThirdPartyEventID        = pausedSubEvent.ThirdPartyID;
            retValue.SubCalCalendarName       = pausedSubEvent.Name?.NameValue;
            retValue.Notes = pausedSubEvent?.Notes?.UserNote;

            if (CalendarEventEntry != null)
            {
                retValue.CalRigid               = CalendarEventEntry.isRigid;
                retValue.SubCalCalEventStart    = (long)(CalendarEventEntry.Start - JSStartTime).TotalMilliseconds;
                retValue.SubCalCalEventEnd      = (long)(CalendarEventEntry.End - JSStartTime).TotalMilliseconds;
                retValue.SuggestedDeadline      = CalendarEventEntry.DeadlineSuggestion.ToUnixTimeMilliseconds();
                retValue.SleepSuggestedDeadline = CalendarEventEntry.SleepDeadlineSuggestion.ToUnixTimeMilliseconds();
                if (string.IsNullOrEmpty(CalendarEventEntry.ThirdPartyID))
                {
                }
                else
                {
                    retValue.ID = retValue.ThirdPartyEventID;
                }
            }

            retValue.SubCalEventLong    = pausedSubEvent.Location.Longitude;
            retValue.SubCalEventLat     = pausedSubEvent.Location.Latitude;
            retValue.SubCalCalendarName = pausedSubEvent.getName?.NameValue;
            TilerColor uiColor = TilerColor.pausedUIColor();

            if (uiColor != null)
            {
                retValue.RColor         = uiColor.R;
                retValue.GColor         = uiColor.G;
                retValue.BColor         = uiColor.B;
                retValue.OColor         = uiColor.O;
                retValue.ColorSelection = uiColor.User;
            }
            retValue.isComplete         = false;
            retValue.isEnabled          = true;
            retValue.Duration           = (long)pausedTimeline.TimelineSpan.TotalMilliseconds;
            retValue.ThirdPartyEventID  = pausedSubEvent.ThirdPartyID;
            retValue.EventPreDeadline   = (long)pausedSubEvent.getPreDeadline.TotalMilliseconds;
            retValue.Priority           = pausedSubEvent.getEventPriority;
            retValue.Conflict           = String.Join(",", pausedSubEvent.Conflicts.getConflictingEventIDs());
            retValue.isPaused           = false;
            retValue.isPauseAble        = false;
            retValue.PauseStart         = (long)(pausedTimeline.Start - JSStartTime).TotalMilliseconds;
            retValue.PauseEnd           = (long)(pausedTimeline.End - JSStartTime).TotalMilliseconds;
            retValue.IsLocked           = true;
            retValue.UserLocked         = false;
            retValue.isThirdParty       = pausedSubEvent.isThirdParty;
            retValue.isReadOnly         = true;
            retValue.isTardy            = false;
            retValue.isProcrastinateAll = false;
            retValue.isAllDay           = pausedSubEvent.getActiveDuration >= Utility.LeastAllDaySubeventDuration;

            if (CalendarEventEntry != null && includeCalendarEvent)
            {
                retValue.CalEvent = CalendarEventEntry.ToCalEvent(includeSubevents: false);
            }

            return(retValue);
        }