public override void Save(RowData rowData) { Save(new List <RowData> { rowData }); }
public LogDataElement(InformationSystemsBase system, RowData item) { Id = $"[{system.Name}][{item.Period:yyyyMMddhhmmss}][{item.RowId}]"; Application = item.Application.Name; Comment = item.Comment; Computer = item.Computer?.Name; ConnectionId = item.ConnectId; Data = item.Data; DataPresentation = item.DataPresentation; DataUUID = item.DataUuid; Event = item.Event?.Name; RowId = item.RowId; InformationSystem = system.Name; Metadata = item.Metadata?.Name; MetadataUUID = item.Metadata?.Uuid.ToString(); Period = item.Period; PrimaryPort = item.PrimaryPort?.Name; SecondaryPort = item.SecondaryPort?.Name; Session = item.Session; Severity = item.Severity.ToString(); TransactionDate = item.TransactionDate; TransactionId = item.TransactionId; TransactionStatus = item.TransactionStatus.ToString(); User = item.User?.Name; UserUUID = item.User?.Uuid.ToString(); WorkServer = item.WorkServer?.Name; }
public override void Save(RowData rowData) { IList <RowData> rowsData = new List <RowData> { rowData }; Save(rowsData); }
public long?GetReferenceDatabaseId <T>(YY.EventLogReaderAssistant.Models.RowData itemRow) { long?id; if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Applications)) { id = GetApplicationId(itemRow.Application); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Computers)) { id = GetComputerId(itemRow.Computer); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Events)) { id = GetEventId(itemRow.Event); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Metadata)) { id = GetMetadataId(itemRow.Metadata); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.PrimaryPorts)) { id = GetPrimaryPortId(itemRow.PrimaryPort); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.SecondaryPorts)) { id = GetSecondaryPortId(itemRow.SecondaryPort); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Severity)) { id = GetSeverityId(itemRow.Severity); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.TransactionStatus)) { id = GetTransactionStatusId(itemRow.TransactionStatus); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.Users)) { id = GetUserId(itemRow.User); } else if (typeof(T) == typeof(YY.EventLogReaderAssistant.Models.WorkServers)) { id = GetWorkServerId(itemRow.WorkServer); } else { throw new Exception("Неизвестный тип ссылочного объекта"); } return(id); }
public bool RowDataExistOnDatabase(InformationSystemsBase system, RowData rowData) { bool output = false; using (var command = _connection.CreateCommand()) { command.CommandText = @"SELECT InformationSystem, Id, Period FROM RowsData AS RD WHERE InformationSystem = {existInfSysId:String} AND Id = {existId:Int64} AND Period = {existPeriod:DateTime}"; command.Parameters.Add(new ClickHouseDbParameter { ParameterName = "existInfSysId", DbType = DbType.AnsiString, Value = system.Name }); command.Parameters.Add(new ClickHouseDbParameter { ParameterName = "existId", DbType = DbType.Int64, Value = rowData.RowId }); command.Parameters.Add(new ClickHouseDbParameter { ParameterName = "existPeriod", DbType = DbType.DateTime, Value = rowData.Period.DateTime }); using (var cmdReader = command.ExecuteReader()) { if (cmdReader.Read()) { output = true; } } } return(output); }
public static bool RowDataExistOnDatabase(this EventLogContext context, InformationSystemsBase system, YY.EventLogReaderAssistant.Models.RowData itemRow) { var checkExist = context.RowsData .FirstOrDefault(e => e.InformationSystemId == system.Id && e.Period == itemRow.Period && e.Id == itemRow.RowId); return(checkExist != null); }