public void DigestState(CalendarSkillState state)
        {
            state.MeetingInfo.Title = Title;
            if (!string.IsNullOrEmpty(Timezone))
            {
                state.UserInfo.Timezone = DateTimeHelper.ConvertTimeZoneInfo(Timezone);
            }

            if (!string.IsNullOrEmpty(StartDate))
            {
                state.MeetingInfo.StartDate = DateTimeHelper.GetDateFromDateTimeString(StartDate, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(StartTime))
            {
                state.MeetingInfo.StartTime = DateTimeHelper.GetDateFromDateTimeString(StartTime, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(NewStartDate))
            {
                state.UpdateMeetingInfo.NewStartDate = DateTimeHelper.GetDateFromDateTimeString(NewStartDate, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(NewStartTime))
            {
                state.UpdateMeetingInfo.NewStartTime = DateTimeHelper.GetDateFromDateTimeString(NewStartTime, null, state.GetUserTimeZone(), true, false);
            }

            if (MoveTimeSpan.GetValueOrDefault() != 0)
            {
                state.UpdateMeetingInfo.MoveTimeSpan = MoveTimeSpan.GetValueOrDefault() * 60;
            }
        }
Esempio n. 2
0
 private void InitializeConfig(CalendarSkillState state)
 {
     // Initialize PageSize when the first input comes.
     if (state.PageSize <= 0)
     {
         var pageSize = _settings.DisplaySize;
         state.PageSize = pageSize <= 0 || pageSize > CalendarCommonUtil.MaxDisplaySize ? CalendarCommonUtil.MaxDisplaySize : pageSize;
     }
 }
Esempio n. 3
0
        public void DigestState(CalendarSkillState state)
        {
            if (!string.IsNullOrEmpty(Date))
            {
                state.MeetingInfo.StartDate = DateTimeHelper.GetDateFromDateTimeString(Date, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(Timezone))
            {
                state.UserInfo.Timezone = DateTimeHelper.ConvertTimeZoneInfo(Timezone);
            }
        }
Esempio n. 4
0
        private void InitializeConfig(CalendarSkillState state)
        {
            // Initialize PageSize when the first input comes.
            if (state.PageSize <= 0)
            {
                int pageSize = 0;
                if (_services.Properties.TryGetValue("DisplaySize", out object displaySizeObj))
                {
                    int.TryParse(displaySizeObj.ToString(), out pageSize);
                }

                state.PageSize = pageSize <= 0 || pageSize > CalendarCommonUtil.MaxDisplaySize ? CalendarCommonUtil.MaxDisplaySize : pageSize;
            }
        }
Esempio n. 5
0
        private bool SearchesTodayMeeting(CalendarSkillState state)
        {
            var userNow    = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, state.GetUserTimeZone());
            var searchDate = userNow;

            if (state.StartDate.Any())
            {
                searchDate = state.StartDate.Last();
            }

            return(!state.StartTime.Any() &&
                   !state.EndDate.Any() &&
                   !state.EndTime.Any() &&
                   EventModel.IsSameDate(searchDate, userNow));
        }
        private bool IsOnlySearchByTime(CalendarSkillState state)
        {
            if (!string.IsNullOrEmpty(state.MeetingInfor.Title))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(state.MeetingInfor.Location))
            {
                return(false);
            }

            if (state.MeetingInfor.ContactInfor.ContactsNameList.Any())
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        public void DigestState(CalendarSkillState state)
        {
            state.MeetingInfo.Title   = Title;
            state.MeetingInfo.Content = Content;
            if (!string.IsNullOrEmpty(Attendees))
            {
                state.MeetingInfo.ContactInfor.ContactsNameList = new List <string>(Attendees.Split(","));
            }

            if (!string.IsNullOrEmpty(Timezone))
            {
                state.UserInfo.Timezone = DateTimeHelper.ConvertTimeZoneInfo(Timezone);
            }

            if (!string.IsNullOrEmpty(StartDate))
            {
                state.MeetingInfo.StartDate = DateTimeHelper.GetDateFromDateTimeString(StartDate, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(EndDate))
            {
                state.MeetingInfo.EndDate = DateTimeHelper.GetDateFromDateTimeString(EndDate, null, state.GetUserTimeZone(), false, false);
            }

            if (!string.IsNullOrEmpty(StartTime))
            {
                state.MeetingInfo.StartTime = DateTimeHelper.GetDateFromDateTimeString(StartTime, null, state.GetUserTimeZone(), true, false);
            }

            if (!string.IsNullOrEmpty(EndTime))
            {
                state.MeetingInfo.EndTime = DateTimeHelper.GetDateFromDateTimeString(EndTime, null, state.GetUserTimeZone(), false, false);
            }

            state.MeetingInfo.Duration        = Duration * 60;
            state.MeetingInfo.Location        = Location;
            state.MeetingInfo.MeetingRoomName = MeetingRoom;
            state.MeetingInfo.Building        = Building;
            state.MeetingInfo.FloorNumber     = FloorNumber;
        }
Esempio n. 8
0
        public void DigestState(CalendarSkillState state)
        {
            state.MeetingInfo.Title = Title;
            if (!string.IsNullOrEmpty(Timezone))
            {
                state.UserInfo.Timezone = DateTimeHelper.ConvertTimeZoneInfo(Timezone);
            }

            if (NextEvent == true)
            {
                state.MeetingInfo.OrderReference = CalendarCommonStrings.Next;
            }

            if (!string.IsNullOrEmpty(StartDate))
            {
                state.MeetingInfo.StartDate       = DateTimeHelper.GetDateFromDateTimeString(StartDate, null, state.GetUserTimeZone(), true, false);
                state.MeetingInfo.StartDateString = StartDate;
            }

            if (!string.IsNullOrEmpty(StartTime))
            {
                state.MeetingInfo.StartTime = DateTimeHelper.GetDateFromDateTimeString(StartTime, null, state.GetUserTimeZone(), true, false);
            }
        }
Esempio n. 9
0
 private List <EventModel> GetCurrentPageMeetings(List <EventModel> allMeetings, CalendarSkillState state)
 {
     return(allMeetings.GetRange(state.ShowEventIndex * state.PageSize, Math.Min(state.PageSize, allMeetings.Count - (state.ShowEventIndex * state.PageSize))));
 }
Esempio n. 10
0
 private List <EventModel> GetCurrentPageMeetings(List <EventModel> allMeetings, CalendarSkillState state, out int firstIndex, out int lastIndex)
 {
     firstIndex = state.ShowEventIndex * state.PageSize;
     lastIndex  = Math.Min(state.PageSize, allMeetings.Count - (state.ShowEventIndex * state.PageSize));
     return(allMeetings.GetRange(firstIndex, lastIndex));
 }
Esempio n. 11
0
 private List <EventModel> GetCurrentPageMeetings(List <EventModel> allMeetings, CalendarSkillState state)
 {
     return(GetCurrentPageMeetings(allMeetings, state, out var firstIndex, out var lastIndex));
 }
        private async Task <DialogTurnResult> GetIntentSwitchingResult(WaterfallStepContext sc, CalendarLuis.Intent topIntent, CalendarSkillState state)
        {
            var newFlowOptions = new CalendarSkillDialogOptions()
            {
                SubFlowMode = false
            };

            if (topIntent == CalendarLuis.Intent.DeleteCalendarEntry || topIntent == CalendarLuis.Intent.AcceptEventEntry)
            {
                return(await sc.BeginDialogAsync(Actions.ChangeEventStatus));
            }
            else if (topIntent == CalendarLuis.Intent.ChangeCalendarEntry)
            {
                return(await sc.BeginDialogAsync(Actions.UpdateEvent));
            }
            else if (topIntent == CalendarLuis.Intent.CheckAvailability)
            {
                state.Clear();
                return(await sc.ReplaceDialogAsync(nameof(CheckPersonAvailableDialog), newFlowOptions));
            }
            else if (topIntent == CalendarLuis.Intent.ConnectToMeeting)
            {
                return(await sc.BeginDialogAsync(Actions.ConnectToMeeting));
            }
            else if (topIntent == CalendarLuis.Intent.CreateCalendarEntry)
            {
                state.Clear();
                return(await sc.ReplaceDialogAsync(nameof(CreateEventDialog), newFlowOptions));
            }
            else if (topIntent == CalendarLuis.Intent.FindCalendarDetail ||
                     topIntent == CalendarLuis.Intent.FindCalendarEntry ||
                     topIntent == CalendarLuis.Intent.FindCalendarWhen ||
                     topIntent == CalendarLuis.Intent.FindCalendarWhere ||
                     topIntent == CalendarLuis.Intent.FindCalendarWho ||
                     topIntent == CalendarLuis.Intent.FindDuration ||
                     topIntent == CalendarLuis.Intent.FindMeetingRoom)
            {
                state.Clear();
                return(await sc.ReplaceDialogAsync(nameof(ShowEventsDialog), new ShowMeetingsDialogOptions(ShowMeetingsDialogOptions.ShowMeetingReason.FirstShowOverview, newFlowOptions)));
            }
            else if (topIntent == CalendarLuis.Intent.TimeRemaining)
            {
                state.Clear();
                return(await sc.ReplaceDialogAsync(nameof(TimeRemainingDialog), newFlowOptions));
            }

            return(null);
        }