Example #1
0
        private static async Task <LeaveRequestModel> LeaveRequestDialogCompleted(IBotContext context, LeaveRequestModel model)
        {
            LeaveRequest request = new LeaveRequest()
            {
                StartTime = model.StartTime,
                EndTime   = model.EndTime,
                Title     = model.Title
            };

            string token = await context.GetADALAccessToken(_resourceUriSharePoint);

            await SharePointConnector.CreateLeaveRequest(request, token, SharePointSettings.GetFromEnvironment());

            var message = "I've saved your leave request in SharePoint! An approval request will be sent out automatically. Enjoy!";
            await context.PostAsync(message);

            return(model);
        }
Example #2
0
        private static async Task <SickLeaveModel> SickLeaveDialogCompleted(IBotContext context, SickLeaveModel model)
        {
            LeaveRequest request = new LeaveRequest()
            {
                StartTime = model.StartTime,
                EndTime   = model.EndTime,
                Title     = $"Leave Request"
            };

            string token = await context.GetADALAccessToken(_resourceUriSharePoint);

            await SharePointConnector.CreateLeaveRequest(request, token, SharePointSettings.GetFromEnvironment());

            var message = "Done! I've saved your sick leave in SharePoint.";

            if (model.StillSick)
            {
                message += " Get well soon!";
            }

            await context.PostAsync(message);

            return(model);
        }