Exemplo n.º 1
0
        protected override void PageLoadWorker(object sender, EventArgs e)
        {
            bool bPopulateAccountNamesListBox = false;

            // Ensure that m_dict is set.
            m_dict = AccountNameToIDDictionary;

            if (m_dict == null)
            {
                MySqlConnection con = GetMySqlConnection();

                m_dict = NamedAndNumberedDatabaseObject.GetNameToIDDictionary(con, Account.SelectIDAndNameCommand);
                AccountNameToIDDictionary    = m_dict;
                bPopulateAccountNamesListBox = true;
            }
            else if (!IsPostBack)
            {
                bPopulateAccountNamesListBox = true;
            }

            if (bPopulateAccountNamesListBox)
            {
                WebUtils.PopulateListItemCollectionFromStringEnumerable(m_dict.Keys, lbAccountNames.Items);
            }
        }
Exemplo n.º 2
0
        protected Dictionary <string, UInt32> GenerateTargetFormFieldNameToIDDictionary(UInt32 unTargetID)
        {
            if (unTargetID == 0)
            {
                return(null);
            }

            MySqlConnection con            = GetMySqlConnection();
            string          strCommandText = string.Format(@"SELECT FieldID, FieldName FROM TargetFormFields WHERE TargetID={0};", unTargetID);

            return(NamedAndNumberedDatabaseObject.GetNameToIDDictionary(con, strCommandText));
        }
Exemplo n.º 3
0
        protected override void PageLoadWorker(object sender, EventArgs e)
        {
            bool bPopulateTargetNamesListBox = false;

            // Ensure that m_dict is set.
            m_dict = TargetNameToIDDictionary;

            if (m_dict == null)
            {
                MySqlConnection con = GetMySqlConnection();

                m_dict = NamedAndNumberedDatabaseObject.GetNameToIDDictionary(con, Target.SelectIDAndNameCommand);
                TargetNameToIDDictionary    = m_dict;
                bPopulateTargetNamesListBox = true;
            }
            else if (!IsPostBack)
            {
                bPopulateTargetNamesListBox = true;
            }

            if (bPopulateTargetNamesListBox)
            {
                WebUtils.PopulateListItemCollectionFromStringEnumerable(m_dict.Keys, lbTargetNames.Items);
            }

            m_dictTargetFormFields = TargetFormFieldNameToIDDictionary;

            if (m_dictTargetFormFields == null)
            {
                UInt32 unTargetID = GetTargetIDBasedOnUI();

                m_dictTargetFormFields            = GenerateTargetFormFieldNameToIDDictionary(unTargetID);
                TargetFormFieldNameToIDDictionary = m_dictTargetFormFields;
            }

            if (!IsPostBack)
            {
                ddlMonitorType.Items.Clear();

                foreach (MonitorTypeCollectionMember mtcm in MonitorTypeCollection.GetEnumerable())
                {
                    ddlMonitorType.Items.Add(mtcm.UIString);
                }

                SetMonitorTypeDDLToDefault();
            }
        }
Exemplo n.º 4
0
        protected override void PageLoadWorker(object sender, EventArgs e)
        {
            bool bPopulateTargetNamesListBox = false;

            // Ensure that m_dictTargets is set.
            m_dictTargets         = TargetNameToIDDictionary;
            m_dictTargetsIDToName = TargetIDToNameDictionary;

            if (m_dictTargets == null)
            {
                MySqlConnection con = GetMySqlConnection();

                m_dictTargets               = NamedAndNumberedDatabaseObject.GetNameToIDDictionary(con, Target.SelectIDAndNameCommand);
                TargetNameToIDDictionary    = m_dictTargets;
                m_dictTargetsIDToName       = null; // Force a rebuild of the Targets ID To Name dictionary.
                bPopulateTargetNamesListBox = true;
            }
            else if (!IsPostBack)
            {
                bPopulateTargetNamesListBox = true;
            }

            if (bPopulateTargetNamesListBox)
            {
                WebUtils.PopulateListItemCollectionFromStringEnumerable(m_dictTargets.Keys, lbTargetNames.Items);
            }

            if (m_dictTargetsIDToName == null)
            {
                /*
                 * m_dictTargetsIDToName = new Dictionary<uint, string>();
                 *
                 * foreach (KeyValuePair<string, uint> kvp in m_dictTargets)
                 * {
                 *  m_dictTargetsIDToName.Add(kvp.Value, kvp.Key);
                 * }
                 */
                m_dictTargetsIDToName = NamedAndNumberedDatabaseObject.GetIDToNameDictionary(m_dictTargets);

                TargetIDToNameDictionary = m_dictTargetsIDToName;
            }

            bool bPopulateAccountNamesListBox = false;

            // Ensure that m_dictAccounts is set.
            m_dictAccounts = AccountNameToIDDictionary;

            if (m_dictAccounts == null)
            {
                MySqlConnection con = GetMySqlConnection();

                m_dictAccounts               = NamedAndNumberedDatabaseObject.GetNameToIDDictionary(con, Account.SelectIDAndNameCommand);
                AccountNameToIDDictionary    = m_dictAccounts;
                bPopulateAccountNamesListBox = true;
            }
            else if (!IsPostBack)
            {
                bPopulateAccountNamesListBox = true;
            }

            if (bPopulateAccountNamesListBox)
            {
                WebUtils.PopulateListItemCollectionFromStringEnumerable(m_dictAccounts.Keys, lbAccountNames.Items);
            }

            if (!IsPostBack)
            {
                string strNow = MySqlUtils.DateTimeToString(DateTime.UtcNow); //dtNow.ToString(@"yyyy-MM-dd HH:mm:ss");

                rbAny.Checked          = true;
                lbTargetNames.Enabled  = false;
                lbAccountNames.Enabled = false;

                tbStartTimeStamp.Enabled = false;
                tbStartTimeStamp.Text    = strNow;
                tbEndTimeStamp.Enabled   = false;
                tbEndTimeStamp.Text      = strNow;
            }

            if (SearchResults == null)
            {
                ClearSelectedSearchResultFields();
            }
        }