/// <summary>
 ///     Load Constructor
 /// </summary>
 /// <param name="ctx">context</param>
 /// <param name="idr"></param>
 /// <param name="trxName"></param>
 public MSystem(Ctx ctx, IDataReader idr, Trx trxName)
     : base(ctx, idr, trxName)
 {
     if (_system == null)
     {
         _system = this;
     }
 }
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="ignored">id - if < 0 not loaded</param>
        /// <param name="mtrxName">transaction</param>
        public MSystem(Ctx ctx, int ignored, Trx mtrxName)
            : base(ctx, 0, mtrxName)
        {
            Trx trxName = null;

            if (ignored >= 0)
            {
                Load(trxName);  //	load ID=0
            }
            if (_system == null)
            {
                _system = this;
            }
        }
예제 #3
0
        }       //	MIssue

        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="ctx">context</param>
        private void Init(Ctx ctx)
        {
            MSystem system = MSystem.Get(ctx);

            SetName(system.GetName());
            SetUserName(system.GetUserName());
            SetDBAddress(system.GetDBAddress(true));
            SetSystemStatus(system.GetSystemStatus());
            SetReleaseNo(system.GetReleaseNo());        //	DB

            //setDatabaseInfo(DataBase.getDatabaseInfo());

            if (system.IsAllowStatistics())
            {
                SetStatisticsInfo(system.GetStatisticsInfo(true));
                SetProfileInfo(system.GetProfileInfo(true));
            }
        }       //	init
예제 #4
0
        /// <summary>
        /// Create and report issue SessionEndAll
        /// </summary>
        /// <param name="record">log record</param>
        /// <returns>reported issue or null</returns>
        public static MIssue Create(LogRecord record)
        {
            _log.Config(record.message);
            MSystem system = MSystem.Get(Env.GetCtx());

            if (!DataBase.DB.IsConnected() ||
                system == null ||
                !system.IsAutoErrorReport())
            {
                return(null);
            }
            //
            MIssue issue = new MIssue(record);
            String error = issue.Report();

            issue.Save();
            if (error != null)
            {
                return(null);
            }
            return(issue);
        }       //	create
        /// <summary>
        /// Load System Record
        /// </summary>
        /// <param name="ctx">context</param>
        /// <returns>System</returns>
        public static MSystem Get(Ctx ctx)
        {
            _system = (MSystem)cache[101];

            if (_system == null)
            {
                String      sql = "SELECT * FROM AD_System ORDER BY AD_System_ID"; //	0 first
                IDataReader idr = null;
                try
                {
                    idr = DataBase.DB.ExecuteReader(sql, null, null);
                    if (idr.Read())
                    {
                        _system = new MSystem(ctx, idr, null);
                    }
                    idr.Close();
                }
                catch (Exception ex)
                {
                    if (idr != null)
                    {
                        idr.Close();
                        idr = null;
                    }
                    //String info = "No System - " + DataBase.getDatabaseInfo() + " - " + ex.getLocalizedMessage();
                    String info = "No System - " + DataBase.DB.GetConnection().ToString() + " - " + ex.Message;
                    //System.err.println(info);
                }
                cache.Add(101, _system);
                if (!Ini.IsClient() && _system.SetInfo())
                {
                    _system.Save();
                }
            }

            return(_system);
        }