Skip to content

Commit

Permalink
[Calendar] Update recursive meeting (microsoft#419)
Browse files Browse the repository at this point in the history
* add outlook calendar recursive meeting support

* Add recurring meeting update for Google / Outlook Calendar.

* Event id should not be set to null.

* Add multi-language resourse

* Rename RecursiveToken.

* Change the RecurringId to EventModel.

* Remove spaces in resource.
  • Loading branch information
zidaneymar authored Dec 13, 2018
1 parent 4d8384b commit e8a67af
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public CalendarSkillState()
Duration = 0;
MoveTimeSpan = 0;
AskParameterContent = string.Empty;
RecurrencePattern = string.Empty;
}

public User User { get; set; }
Expand Down Expand Up @@ -126,6 +127,8 @@ public CalendarSkillState()

public string AskParameterContent { get; set; }

public string RecurrencePattern { get; set; }

public TimeZoneInfo GetUserTimeZone()
{
if ((UserInfo != null) && (UserInfo.Timezone != null))
Expand Down Expand Up @@ -170,6 +173,7 @@ public void Clear()
Duration = 0;
MoveTimeSpan = 0;
AskParameterContent = string.Empty;
RecurrencePattern = string.Empty;
}

public class UserInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
using CalendarSkill.Common;
using CalendarSkill.Dialogs.Main.Resources;
using CalendarSkill.Dialogs.Shared.Resources;
using CalendarSkill.Dialogs.Shared.Resources.Strings;
using Luis;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.AI.Luis;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Choices;
using Microsoft.Bot.Schema;
Expand All @@ -19,7 +21,6 @@
using Microsoft.Recognizers.Text.DateTime;
using Newtonsoft.Json.Linq;
using static Microsoft.Recognizers.Text.Culture;
using Microsoft.Bot.Builder.AI.Luis;

namespace CalendarSkill
{
Expand Down Expand Up @@ -651,6 +652,17 @@ protected async Task DigestCalendarLuisResult(DialogContext dc, Calendar luisRes
state.MoveTimeSpan = GetMoveTimeSpanFromEntity(entity.MoveLaterTimeSpan[0], dc.Context.Activity.Locale, true);
}

if (entity.datetime != null)
{
var match = entity._instance.datetime.ToList().Find(w => w.Text.ToLower() == CalendarCommonStrings.DailyToken
|| w.Text.ToLower() == CalendarCommonStrings.WeeklyToken
|| w.Text.ToLower() == CalendarCommonStrings.MonthlyToken);
if (match != null)
{
state.RecurrencePattern = match.Text.ToLower();
}
}

break;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
<data name="AllDay" xml:space="preserve">
<value>Den ganzen Tag</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>Täglich</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>Monatliche</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>Wöchentliche</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>Mit einem Thema {0}</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
<data name="AllDay" xml:space="preserve">
<value>Todo el dia</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>Diario</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>Mensual</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>Semanal</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>con un tema de {0}</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
<data name="AllDay" xml:space="preserve">
<value>Toute la journée</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>Quotidienne</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>Mensuel</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>Hebdomadaire</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>avec un sujet de {0}</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
<data name="AllDay" xml:space="preserve">
<value>Tutto il giorno</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>Quotidiana</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>Mensile</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>Settimanale</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>con un soggetto di {0}</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
<data name="AllDay" xml:space="preserve">
<value>All day</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>daily</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>monthly</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>weekly</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>with a subject of {0}</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,16 @@
<data name="AllDay" xml:space="preserve">
<value>全天</value>
</data>
<data name="DailyToken" xml:space="preserve">
<value>每天</value>
</data>
<data name="MonthlyToken" xml:space="preserve">
<value>每月</value>
</data>
<data name="WeeklyToken" xml:space="preserve">
<value>每周</value>
</data>
<data name="WithTheSubject" xml:space="preserve">
<value>以{0}为标题</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public UpdateEventDialog(
updateEvent.TimeZone = TimeZoneInfo.Utc;
updateEvent.Id = origin.Id;

if (!string.IsNullOrEmpty(state.RecurrencePattern) && !string.IsNullOrEmpty(origin.RecurringId))
{
updateEvent.Id = origin.RecurringId;
}

var calendarService = ServiceManager.InitCalendarService(state.APIToken, state.EventSource);
var newEvent = await calendarService.UpdateEventById(updateEvent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,37 @@ public string Id
}
}

public string RecurringId
{
get
{
switch (source)
{
case EventSource.Microsoft:
return msftEventData.SeriesMasterId;
case EventSource.Google:
return gmailEventData.RecurringEventId;
default:
throw new Exception("Event Type not Defined");
}
}

set
{
switch (source)
{
case EventSource.Microsoft:
msftEventData.SeriesMasterId = value;
break;
case EventSource.Google:
gmailEventData.RecurringEventId = value;
break;
default:
throw new Exception("Event Type not Defined");
}
}
}

public string Title
{
get
Expand Down

0 comments on commit e8a67af

Please sign in to comment.