コード例 #1
0
        public static bool Execute(string line, KLog uploaderLog)
        {
            var cleanLine = line.Replace("#KLOG_INSTANCE_STATUS#", "");

            InstanceModel instanceHeader = null;

            try
            {
                instanceHeader = JsonConvert.DeserializeObject <InstanceModel>(cleanLine);
            }
            catch (Exception ex)
            {
                uploaderLog.Error($"Expection on [UploadLastLine].[DeserializeInstanceFooter] - Message: {ex.ToString()}");
                return(false);
            }

            var checkUpdateInstanceStop = DataAccessor.UpdateInstanceStop(instanceHeader);

            if (!checkUpdateInstanceStop.Success)
            {
                uploaderLog.Error($"SQL Expection on [UploadLastLine].[UpdateInstanceStop] - Message: {checkUpdateInstanceStop.Message}");
                return(false);
            }

            return(true);
        }
コード例 #2
0
        public static bool Execute(string line, Guid fileGuid, KLog uploaderLog)
        {
            uploaderLog.Warning($"Uploader => Footer Check Failed - Guid: {fileGuid.ToString()}");

            BlobFileCollection.GetFiles().First(d => d.FileGuid == fileGuid).FooterStatus = false;

            LogRecordModel record = null;

            try
            {
                record = JsonConvert.DeserializeObject <LogRecordModel>(line);
            }
            catch (Exception ex)
            {
                uploaderLog.Error($" [UploadInstanceStop] Log Record Deserialize Exception: {ex.ToString()}");
                return(false);
            }

            var newEndTime = record.EventTime;

            InstanceModel newInstanceCloser = new InstanceModel();

            newInstanceCloser.InstanceID = fileGuid;
            newInstanceCloser.EventTime  = newEndTime;

            var checkUpdateInstaceClose = DataAccessor.UpdateInstanceStop(newInstanceCloser);

            if (!checkUpdateInstaceClose.Success)
            {
                uploaderLog.Error($"SQL Expection on [UploadInstanceStop].[UpdateInstaceClose] - Message: {checkUpdateInstaceClose.Message}");
                return(false);
            }

            var checkUpdateBlockStop = DataAccessor.UpdateBlockEmptyStop(record, fileGuid);

            if (!checkUpdateBlockStop.Success)
            {
                uploaderLog.Error($"SQL Expection on [UploadInstanceStop].[UpdateBlockStop] - Message: {checkUpdateBlockStop.Message}");
                return(false);
            }

            return(true);
        }