Example #1
0
        public virtual void InitializeComboBoxTecComponent(FormChangeMode.MODE_TECCOMPONENT mode)
        {
            m_listTECComponentIndex = m_admin.GetListIndexTECComponent(mode);

            //m_admin.m_typeFields = AdminTS.TYPE_FIELDS.DYNAMIC;

            comboBoxTecComponent.Items.Clear();
        }
Example #2
0
        //SortedList<DateTime, OneField> HourlyFieldValues;

        /// <summary>
        /// Конструктор открывает коннект к базе. Закрывает деструктор.
        /// </summary>
        public MySQLtechsite(bool bCalculatedHalfHourValues)
        {
            int iRes = -1;

            m_bCalculatedHalfHourValues = bCalculatedHalfHourValues;

            int iConfigDB = -1;
            ConnectionSettings connSett = Program.ReadConnSettFromFileINI(out iConfigDB);

            connSett.id = ConnectionSettings.UN_ENUMERABLE_ID;

            Console.WriteLine("DB parametrs: IP=" + connSett.server + ", port=" + connSett.port + ", DBName=" + connSett.dbName + ", UID=" + connSett.userName + Environment.NewLine);

            //Соединение дл я БД конфигурации
            m_idListener = DbSources.Sources().Register(connSett, false, @"CONFIG_DB");
            m_connection = DbSources.Sources().GetConnection(m_idListener, out iRes);

            //TYPE_DATABASE_CFG typeConfigDB = TYPE_DATABASE_CFG.UNKNOWN;
            //for (TYPE_DATABASE_CFG t = TYPE_DATABASE_CFG.CFG_190; t < TYPE_DATABASE_CFG.UNKNOWN; t ++) {
            //    if (t.ToString().Contains(iConfigDB.ToString()) == true)
            //    {
            //        typeConfigDB = t;
            //        break;
            //    }
            //    else
            //        ;
            //}

            if (iRes == 0)
            {
                m_admin = new AdminTS(new bool [] { false, true });

                HMark markQueries = new HMark(new int[] { (int)StatisticCommon.CONN_SETT_TYPE.ADMIN, (int)StatisticCommon.CONN_SETT_TYPE.PBR });
                //markQueries.Marked ((int)StatisticCommon.CONN_SETT_TYPE.ADMIN);
                //markQueries.Marked((int)StatisticCommon.CONN_SETT_TYPE.PBR);

                m_admin.InitTEC(m_idListener, FormChangeMode.MODE_TECCOMPONENT.GTP, /*typeConfigDB, */ markQueries, true, new int [] { 0, (int)TECComponent.ID.LK });
                m_listIndexTECComponent = m_admin.GetListIndexTECComponent(FormChangeMode.MODE_TECCOMPONENT.GTP, true);

                m_listIdMCTECComponent = new List <int>();

                int i = -1, j = -1;
                for (i = 0; i < m_listIndexTECComponent.Count; i++)
                {
                    for (j = 0; j < m_admin.allTECComponents[m_listIndexTECComponent[i]].m_listMCentreId.Count; j++)
                    {
                        m_listIdMCTECComponent.Add(m_admin.allTECComponents[m_listIndexTECComponent[i]].m_listMCentreId[j]);
                    }
                }

                //Пересоединение для таблиц ПБР
                if ((DbTSQLInterface.IsConnected(ref m_connection) == true) && (m_listIdMCTECComponent.Count > 0))
                {
                    DbSources.Sources().UnRegister(m_idListener);

                    m_idListener       = DbSources.Sources().Register(m_admin.allTECComponents[m_listIndexTECComponent[0]].tec.connSetts[(int)StatisticCommon.CONN_SETT_TYPE.PBR], false, @"PBR");
                    m_connection       = DbSources.Sources().GetConnection(m_idListener, out iRes);
                    m_strTableNamePPBR = m_admin.allTECComponents[m_listIndexTECComponent[0]].tec.m_strNameTableUsedPPBRvsPBR /*[(int)AdminTS.TYPE_FIELDS.STATIC]*/;
                }
                else
                {
                }
            }
            else
            {
                ;
            }

            {
                //itssAUX.PrintErrorMessage("Ошибка! MySQLtechsite::MySQLtechsite () - чтение файла с шифрованными параметрами соединения (" + m_strFileNameConnSett + ")...");
                itssAUX.PrintErrorMessage("Проверте параметры соединения (" + Program.m_fileINI.m_NameFileINI + "). Затем запустите программу с аргументом /setmysqlpassword..." + Environment.NewLine);
            }
        }