コード例 #1
0
        public static int Add(string url, string token, bool processClosed, bool disableNotifications)
        {
            lock (Imports.SynchRoot)
            {
                if (Imports.GetItems().Count(x => x.Id == CoreContext.TenantManager.GetCurrentTenant().TenantId) > 0)
                {
                    throw new DuplicateNameException("Import already running");
                }
            }
            lock (Completed)
            {
                Completed.RemoveAll(x => x.Id == CoreContext.TenantManager.GetCurrentTenant().TenantId);
            }

            SecurityContext.DemandPermissions(ASC.Core.Users.Constants.Action_AddRemoveUser);
            ProjectSecurity.DemandCreateProject();

            var importTask = new ImportFromBasecamp(url, token, HttpContext.Current, SecurityContext.CurrentAccount.ID, processClosed, disableNotifications, Global.EngineFactory);//NOTE: engine factory newly created!!!

            lock (Imports.SynchRoot)
            {
                Imports.Add(importTask);
            }
            return(importTask.Id);
        }