コード例 #1
0
 private async Task<HyperLink[]> GetOneNotePagesAsync(OneNoteService service, string notebookId, string propertyName, int incidentId)
 {
     var sectionId = await service.GetSectionIdAsync(notebookId, propertyName);
     if (string.IsNullOrEmpty(sectionId)) return new HyperLink[0];
     return await service.GetPagesAsync(sectionId, incidentId);
 }
コード例 #2
0
        //public async Task CreateTaskAsync(Graph.GraphService graphService, CreateTaskViewModel model)
        //{
        //    var inspection = await GetInspectionById(model.InspectionId);
        //    var property = inspection.sl_propertyID;

        //    var unifiedGroupFetcher = graphService.groups.GetById(property.sl_group);
        //    var unifiedGroup = await unifiedGroupFetcher.ExecuteAsync();

        //    var task = new Graph.Task
        //    {
        //        title = model.Title,
        //        percentComplete = 0,
        //        startDate = inspection.sl_datetime,
        //        dueDate = inspection.sl_datetime,
        //        // TODO: description = model.Description,
        //    };
        //    await unifiedGroupFetcher.tasks.AddTaskAsync(task);
        //}

        public async Task<string> AnnotateImagesAsync(Graph.GraphService graphService, OneNoteService oneNoteService, string siteRootDirectory, int incidentId)
        {
            var getIncident = GetIncidentByIdAsync(incidentId);
            var incidentVideos = GetVideosAsync(AppSettings.VideoPortalIncidentsChannelName, incidentId);

            var incident = await getIncident;
            var property = incident.sl_propertyID;

            var sectionId = await GetOrCreateNoteBook(oneNoteService, notebookName)
                .ContinueWith(async task =>
                {
                    var _notebookId = task.Result.Id;
                    var _sectionId = await oneNoteService.GetSectionIdAsync(_notebookId, property.Title);
                    if (_sectionId == null)
                        _sectionId = await oneNoteService.CreateSectionAsync(_notebookId, property.Title);
                    return _sectionId;
                });

            var inspectionPhotos = GetInspectionOrRepairPhotosAsync("Room Inspection Photos", incident.sl_inspectionIDId.Value, incident.sl_roomID.Id);

            var pageUrl = await oneNoteService.CreatePageForIncidentAsync(siteRootDirectory, await sectionId, incident, await inspectionPhotos, await incidentVideos);

            return pageUrl;
        }