private void m_pOk_Click(object sender, EventArgs e)
        {
            if (!CheckSyntax(false))
            {
                return;
            }

            if (m_pTab_General_Description.Text == "")
            {
                MessageBox.Show(this, "Please fill description !", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Add new rule
            if (m_pRule == null)
            {
                m_pRule = m_pVirtualServer.GlobalMessageRules.Add(
                    m_pTab_General_Enabled.Checked,
                    m_pTab_General_Description.Text,
                    m_pTab_General_MatchExpression.Text,
                    (GlobalMessageRule_CheckNextRule_enum)((WComboBoxItem)m_pTab_General_CheckNextRule.SelectedItem).Tag
                    );
            }
            // Edit rule
            else
            {
                m_pRule.Enabled         = m_pTab_General_Enabled.Checked;
                m_pRule.Description     = m_pTab_General_Description.Text;
                m_pRule.MatchExpression = m_pTab_General_MatchExpression.Text;
                m_pRule.CheckNextRule   = (GlobalMessageRule_CheckNextRule_enum)((WComboBoxItem)m_pTab_General_CheckNextRule.SelectedItem).Tag;
                m_pRule.Commit();
            }

            this.DialogResult = DialogResult.OK;
        }
Exemple #2
0
        /// <summary>
        /// Swaps specified rules.
        /// </summary>
        /// <param name="item1">Item 1.</param>
        /// <param name="item2">Item 2.</param>
        private void SwapRules(ListViewItem item1, ListViewItem item2)
        {
            GlobalMessageRule rule_down = (GlobalMessageRule)item1.Tag;
            GlobalMessageRule rule_up   = (GlobalMessageRule)item2.Tag;

            string selectedID = "";

            if (item1.Selected)
            {
                selectedID = rule_down.ID;
            }
            else if (item2.Selected)
            {
                selectedID = rule_up.ID;
            }

            long up_Cost = rule_up.Cost;

            rule_up.Cost = rule_down.Cost;
            rule_up.Commit();

            rule_down.Cost = up_Cost;
            rule_down.Commit();

            m_pVirtualServer.GlobalMessageRules.Refresh();
            LoadRules(selectedID);
        }
Exemple #3
0
        private void SwapRules(ListViewItem item1, ListViewItem item2)
        {
            GlobalMessageRule globalMessageRule  = (GlobalMessageRule)item1.Tag;
            GlobalMessageRule globalMessageRule2 = (GlobalMessageRule)item2.Tag;
            string            selectedRuleID     = "";

            if (item1.Selected)
            {
                selectedRuleID = globalMessageRule.ID;
            }
            else if (item2.Selected)
            {
                selectedRuleID = globalMessageRule2.ID;
            }
            long cost = globalMessageRule2.Cost;

            globalMessageRule2.Cost = globalMessageRule.Cost;
            globalMessageRule2.Commit();
            globalMessageRule.Cost = cost;
            globalMessageRule.Commit();
            this.m_pVirtualServer.GlobalMessageRules.Refresh();
            this.LoadRules(selectedRuleID);
        }