/// <summary> /// Fill ELoggerType object by reading SqlDataReader returned by stored procedure /// </summary> /// <param name="oReader"></param> /// <returns></returns> static private ELoggerType ReadData(SqlDataReader oReader) { try { ELoggerType oData = new ELoggerType(); //ELoggerType oData.ID = oReader.GetOrdinal("ID"); if (!oReader.IsDBNull(oReader.GetOrdinal("Name"))) { oData.Name = oReader.GetString(oReader.GetOrdinal("Name")); } return(oData); } catch (SqlException e) { throw e; } catch (System.Exception e) { throw e; } }
public Logger(MyGridProgram gridProgram, ELoggerType loggerType) { if (gridProgram != null) { appID = gridProgram.Me.EntityId; string logger_name = loggerType.ToString(); gridProgram.GridTerminalSystem.GetBlocksOfType(outputProgrammableBlocks, (outputProgrammableBlock) => outputProgrammableBlock.CustomName.Trim() == logger_name); } }
public static ECollectionLoggerType GetList() { SqlDataReader oReader = null; try { //Initialize the return object ECollectionLoggerType oCollData = new ECollectionLoggerType(); //Call the request using (DBEngine DBInstance = CCstData.GetInstance("").DatabaseEngine) { oReader = DBInstance.ExecuteReader(CommandType.StoredProcedure, CCstDatabase.SP_LoggerType_GetList); } //If there is a result (not null) if (oReader != null) { while (oReader.Read()) { ELoggerType oData = new ELoggerType(); //Read the data and convert the SqlDataReader in the waiting object oData = ReadData(oReader); //Add the data to the return list oCollData.Add(oData); } } return(oCollData); } catch (Exception e) { throw e; } finally { if (oReader != null && !oReader.IsClosed) { oReader.Close(); } } }
public bool IsLoggerEnabled(ELoggerType loggerType) { return(_dictLoggers[loggerType].IsActive); }
public void DisableLogger(ELoggerType loggerType) { _dictLoggers[loggerType].IsActive = false; }
public void EnableLogger(ELoggerType loggerType) { _dictLoggers[loggerType].IsActive = true; }