コード例 #1
0
        protected Target GetTargetObjectBasedOnUI()   // Do not get the Target object (except for the TargetFormFields) from the database.
        {
            Target target = new Target();

            target.TargetID             = GetTargetIDBasedOnUI();
            target.AccountID            = Convert.ToUInt32(tbAccountID.Text);
            target.Enabled              = cbEnabled.Checked;
            target.Name                 = tbName.Text;
            target.URL                  = tbURL.Text;
            target.MonitorIntervalAsInt = Convert.ToInt32(tbMonitorInterval.Text);
            //target.LastMonitoredAt = ;

            MonitorTypeCollectionMember mtcm = MonitorTypeCollection.FindUsingUIString(ddlMonitorType.SelectedValue);

            if (mtcm != null)
            {
                target.MonitorType = mtcm.MonitorType;
            }
            else
            {
                target.MonitorType = Target.DefaultMonitorType;
            }

            target.LastTargetLogID = Convert.ToUInt32(tbLastTargetLogID.Text);
            //target.TargetAddedAt = ;
            //target.LastFailedAt = ;

            MySqlConnection con = GetMySqlConnection();

            target.FinishConstruction(con);

            return(target);
        }
コード例 #2
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();
            }
        }
コード例 #3
0
        protected void SetMonitorTypeDDL(MonitorType mt)
        {
            MonitorTypeCollectionMember mtcm = MonitorTypeCollection.FindUsingMonitorType(mt);

            ddlMonitorType.SelectedValue = mtcm.UIString;
        }