Ejemplo n.º 1
0
        private void ExecuteAction()
        {
            using (var documentAttachmentService = new WebClientDocumentAttachmentService(OAuthClient.Authorization))
                using (var dropboxService = new DropboxClientService())
                {
                    switch (Action.Value)
                    {
                    case "Load":
                        LoadAttachments(documentAttachmentService);
                        LoadDropboxItenns(dropboxService);
                        break;

                    case "Transfer":
                        if (String.IsNullOrWhiteSpace(DocumentID.Value))
                        {
                            NavigateToDocumentList();
                        }
                        else
                        {
                            TransferFile(dropboxService, documentAttachmentService);
                        }
                        break;
                    }
                }
        }
Ejemplo n.º 2
0
        private void InitializeGrid()
        {
            using (var documentService = new WebClientDocumentService(OAuthClient.Authorization))
            {
                var documents = documentService.GetDisplayList();

                var dataList = new List <DispalyDocument>();

                using (var attachmentService = new WebClientDocumentAttachmentService(OAuthClient.Authorization))
                {
                    foreach (var document in documents)
                    {
                        var attachmentsCount = attachmentService.Count(document.ID);

                        dataList.Add(new DispalyDocument
                        {
                            ID               = document.ID,
                            Subject          = document.Subject,
                            Created          = document.Created,
                            AttachmentsCount = attachmentsCount
                        });
                    }
                }

                documentsGrid.DataSource = dataList;
            }

            documentsGrid.DataBind();
        }
Ejemplo n.º 3
0
        private void LoadAttachments(WebClientDocumentAttachmentService service)
        {
            var documentId = new Guid(DocumentID.Value);
            var list       = service.Get(documentId);

            documentAttachmentsGrid.DataSource = list;
            documentAttachmentsGrid.DataBind();
        }
Ejemplo n.º 4
0
        private void TransferFile(DropboxClientService dropboxService, WebClientDocumentAttachmentService documentAttachmentService)
        {
            var dropboxFile = dropboxService.GetFileContent(DropboxItems.SelectedValue).Result;

            documentAttachmentService.Add(new Guid(DocumentID.Value), dropboxFile.FileName, dropboxFile.Content);

            NavigateToDocumentList();
        }