Example #1
0
        public ItemList<FileOperationResult> ExecImportDocs(string login, string password, string token, string source, string parentId, string ignoreCoincidenceFiles, List<DataToImport> dataToImport)
        {
            var authData = new AuthData(login, password, token);

            IDocumentProvider provider;
            String folderName;

            switch (source)
            {
                case "boxnet":
                    provider = new BoxDocumentProvider(authData);
                    folderName = FilesCommonResource.ImportFromBoxNet;
                    return ImportDocuments(provider, dataToImport, parentId, ignoreCoincidenceFiles, folderName);
                case "google":
                    folderName = FilesCommonResource.ImportFromGoogle;
                    using (var google = new GoogleDocumentProvider(authData))
                    {
                        return ImportDocuments(google, dataToImport, parentId, ignoreCoincidenceFiles, folderName);
                    }
                case "zoho":
                    provider = new ZohoDocumentProvider(authData);
                    folderName = FilesCommonResource.ImportFromZoho;
                    return ImportDocuments(provider, dataToImport, parentId, ignoreCoincidenceFiles, folderName);
                default:
                    ErrorIf(true, "Unknown provider");
                    return null;
            }
        }
Example #2
0
 public ItemList<DataToImport> GetImportDocs(string source, AuthData authData)
 {
     switch (source)
     {
         case "boxnet":
             return DocumentsToDataImport(new BoxDocumentProvider(authData).GetDocuments());
         case "google":
             using (var google = new GoogleDocumentProvider(authData))
             {
                 return DocumentsToDataImport(google.GetDocuments());
             }
         case "zoho":
             try
             {
                 var zoho = new ZohoDocumentProvider(authData);
                 return DocumentsToDataImport(zoho.GetDocuments());
             }
             catch (Exception e)
             {
                 ErrorIf(true, e.Message);
                 return null;
             }
         default:
             ErrorIf(true, "Unknown provider");
             return null;
     }
 }