Esempio n. 1
0
        /// <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;
            }
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        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();
                }
            }
        }
Esempio n. 4
0
 public bool IsLoggerEnabled(ELoggerType loggerType)
 {
     return(_dictLoggers[loggerType].IsActive);
 }
Esempio n. 5
0
 public void DisableLogger(ELoggerType loggerType)
 {
     _dictLoggers[loggerType].IsActive = false;
 }
Esempio n. 6
0
 public void EnableLogger(ELoggerType loggerType)
 {
     _dictLoggers[loggerType].IsActive = true;
 }