Пример #1
0
        public static RemoveProgressItem StartRemove(HttpContext context, int tenantId, UserInfo user, Guid currentUserId, bool notify)
        {
            lock (Queue.SynchRoot)
            {
                var task = GetProgressItemStatus(tenantId, user.ID, typeof(RemoveProgressItem)) as RemoveProgressItem;

                if (task != null && task.IsCompleted)
                {
                    Queue.Remove(task);
                    task = null;
                }

                if (task == null)
                {
                    task = new RemoveProgressItem(context, tenantId, user, currentUserId, notify);
                    Queue.Add(task);
                }

                if (!Queue.IsStarted)
                {
                    Queue.Start(x => x.RunJob());
                }

                return(task);
            }
        }
Пример #2
0
        public static RemoveProgressItem StartRemove(int tenantId, Guid userId, Guid currentUserId)
        {
            lock (Queue.SynchRoot)
            {
                var task = GetProgressItemStatus(tenantId, userId, typeof(RemoveProgressItem)) as RemoveProgressItem;

                if (task != null && task.IsCompleted)
                {
                    Queue.Remove(task);
                    task = null;
                }

                if (task == null)
                {
                    task = new RemoveProgressItem(tenantId, userId, currentUserId);
                    Queue.Add(task);
                }

                if (!Queue.IsStarted)
                {
                    Queue.Start(x => x.RunJob());
                }

                return(task);
            }
        }