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); }
/// <summary> /// Add the start of the Kiroku logging Instance. /// </summary> /// <param name="instanceHeader"></param> /// <returns></returns> public static SQLResponseModel AddInstanceStart(InstanceModel instanceHeader) { SQLResponseModel response = new SQLResponseModel(); try { using (var connection = new SqlConnection(Configuration.SqlConnetionString)) { var cmd = new SqlCommand("usp_Kiroku_KInstances_InsertStart", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("ui_instanceid", instanceHeader.InstanceID); cmd.Parameters.AddWithValue("dt_instancestart", instanceHeader.EventTime); cmd.Parameters.AddWithValue("ui_applicationid", instanceHeader.ApplicationID); cmd.Parameters.AddWithValue("nvc_trackid", instanceHeader.TrackID); cmd.Parameters.AddWithValue("nvc_regionid", instanceHeader.RegionID); cmd.Parameters.AddWithValue("nvc_clusterid", instanceHeader.ClusterID); cmd.Parameters.AddWithValue("nvc_deviceid", instanceHeader.DeviceID); cmd.Parameters.AddWithValue("nvc_klogversion", instanceHeader.Version); connection.Open(); var reader = cmd.ExecuteReader(); response.Successful(); return(response); } } catch (Exception ex) { response.Failure(ex.ToString()); return(response); } }