Пример #1
0
        private static void TransferFromFileCabinetToFileCabinet(Organization organization)
        {
            Console.WriteLine("TransferFromFileCabinetToFileCabinet");

            string     fileCabinetId = "00000000-0000-0000-0000-000000000000";
            List <int> documentIds   = new List <int>()
            {
                8
            };
            string sourceFileCabinetId = "00000000-0000-0000-0000-000000000000";

            FileCabinet fileCabinet = organization.GetFileCabinetsFromFilecabinetsRelation().FileCabinet
                                      .FirstOrDefault(fc => fc.Id == fileCabinetId);

            if (fileCabinet == null)
            {
                Console.WriteLine("FileCabinet is null!");
            }
            else
            {
                FileCabinetTransferInfo fileCabinetTransferInfo = new FileCabinetTransferInfo()
                {
                    KeepSource          = true,
                    SourceDocId         = documentIds,
                    SourceFileCabinetId = sourceFileCabinetId
                };

                DocumentsQueryResult documentsQueryResult =
                    fileCabinet.PostToTransferRelationForDocumentsQueryResult(fileCabinetTransferInfo);
            }
        }
Пример #2
0
        private static void TransferFromFileCabinetToFileCabinetWithFields(Organization organization)
        {
            Console.WriteLine("TransferFromFileCabinetToFileCabinetWithFields");
            string destinationFileCabinetId = "00000000-0000-0000-0000-000000000000";
            string sourceFileCabinetId      = "00000000-0000-0000-0000-000000000000";
            int    sourceDocId = 6;

            FileCabinet destinationFileCabinet = organization.GetFileCabinetsFromFilecabinetsRelation().FileCabinet
                                                 .FirstOrDefault(fc => fc.Id == destinationFileCabinetId);

            if (destinationFileCabinet == null)
            {
                Console.WriteLine("FileCabinet is null!");
            }
            else
            {
                Platform.ServerClient.Document sourceDocument = new Platform.ServerClient.Document
                {
                    Id     = sourceDocId,
                    Fields = new List <DocumentIndexField>()
                    {
                        DocumentIndexField.Create("NAME", "TestName"),
                        DocumentIndexField.Create("COLOR", "White/Red")
                    }
                };

                DocumentsTransferInfo documentsTransferInfo = new DocumentsTransferInfo()
                {
                    Documents = new List <Platform.ServerClient.Document>()
                    {
                        sourceDocument
                    },
                    KeepSource          = true,
                    SourceFileCabinetId = sourceFileCabinetId
                };

                DocumentsQueryResult documentsQueryResult =
                    destinationFileCabinet.PostToTransferRelationForDocumentsQueryResult(documentsTransferInfo);
            }
        }