示例#1
0
        public bool Run(int computerId)
        {
            ComputerId = computerId;
            try
            {
                var res = MQueryCommand.TryInsertNewOperationByShedulerStep(computerId, OperationType, OperationAttributes);
                if (!res.IsComplete)
                {
                    MLogger.Error($"1 - {res.Message}");
                    MQueryCommand.TryInsertShedulerHistory(TaskId, Id, computerId, false, res.Message);
                    return(false);
                }

                OperationID = res.ReturnedId;
                MLogger.Debug($"\"Step Run\", ThreadId: {Thread.CurrentThread.ManagedThreadId}, AddedOperationId: {OperationID}");
                MQueryCommand.TryInsertShedulerHistory(TaskId, Id, computerId, true, $"Выполнено. Операция {OperationID} добавлена.");
                return(true);
            }
            catch (Exception ex)
            {
                MLogger.Error($"2 - {ex.ToString()}");
                MQueryCommand.TryInsertShedulerHistory(TaskId, Id, computerId, true, ex.Message);
                return(false);
            }
        }