public ItemList<FileOperationResult> ExecImportDocs(String login, String password, String token, String source, String parentId, bool 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: throw GenerateException(new ArgumentException(FilesCommonResource.ErrorMassage_UnknownrProvider)); } }
public ItemList<DataToImport> GetImportDocs(String source, AuthData authData) { try { switch (source) { case "boxnet": return DocumentsToDataImport(new BoxDocumentProvider(authData).GetDocuments()); case "google": using (var google = new GoogleDocumentProvider(authData)) { return DocumentsToDataImport(google.GetDocuments()); } case "zoho": var zoho = new ZohoDocumentProvider(authData); return DocumentsToDataImport(zoho.GetDocuments()); } } catch(Exception e) { throw GenerateException(e); } throw GenerateException(new ArgumentException(FilesCommonResource.ErrorMassage_UnknownrProvider)); }