Example #1
0
        public static bool GetSysGeneralParameters(IGTDataContext _odc, GTDiagnostics _odiag, ref GTSysGenParam _gp)
        {
            bool bSuccess = false;

            try
            {
                string    sSqlSysGP      = "SELECT ID, SUBSYSTEM_NAME, SUBSYSTEM_COMPONENT, PARAM_NAME, PARAM_VALUE, PARAM_DESC FROM SYS_GENERALPARAMETER WHERE SUBSYSTEM_NAME = 'ASSET_HISTORY_TRACKING'";
                Recordset rsGeneralParam = CommandUtilities.ExecuteQuery(_odc, sSqlSysGP, _odiag);

                if (rsGeneralParam == null)
                {
                    CommandUtilities.LogMessage(_odiag, "GetGeneralParameters", "GeneralParameter", "Nothing returned from SYS_GENERALPARAMETER."); return(bSuccess);
                }

                string sThreshold          = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightMovementThreshold", _odiag);
                string sHistoricalSymbol   = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalSymbol", _odiag);
                string sHistoricalLine     = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalLine", _odiag);
                string sHistoricalStacking = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalStacking", _odiag);
                string sANOx = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGX", _odiag);
                string sANOy = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGY", _odiag);
                string sANOz = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGZ", _odiag);

                if (!string.IsNullOrEmpty(sThreshold))
                {
                    _gp.MovementThreshold = Convert.ToInt32(sThreshold);
                }
                if (!string.IsNullOrEmpty(sHistoricalSymbol))
                {
                    _gp.HistoricalSymbol = Convert.ToInt32(sHistoricalSymbol);
                }
                if (!string.IsNullOrEmpty(sHistoricalSymbol))
                {
                    _gp.HistoricalLine = Convert.ToInt32(sHistoricalLine);
                }
                if (!string.IsNullOrEmpty(sHistoricalStacking))
                {
                    _gp.HistoricalStacking = Convert.ToInt32(sHistoricalStacking);
                }
                if (!string.IsNullOrEmpty(sANOx))
                {
                    _gp.ANO_X = Convert.ToInt32(sANOx);
                }
                else
                {
                    _gp.ANO_X = 108;
                }

                if (!string.IsNullOrEmpty(sANOy))
                {
                    _gp.ANO_Y = Convert.ToInt32(sANOy);
                }
                else
                {
                    _gp.ANO_Y = 109;
                }

                if (!string.IsNullOrEmpty(sANOz))
                {
                    _gp.ANO_Z = Convert.ToInt32(sANOz);
                }
                else
                {
                    _gp.ANO_Z = 110;
                }

                rsGeneralParam.Close();
                rsGeneralParam = null;
                bSuccess       = true;
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(_odiag, "GTAssetTracker.GetSysGeneralParameters", ex);
                throw ex;
            }

            return(bSuccess);
        }