Пример #1
0
        /// <summary>
        /// Intializes the combox box containing the searchable properties available.
        /// </summary>
        private void InitializePropertyComboBox(ComboBox thisBox)
        {
            thisBox.SelectedItem = null;

            EntityClass entityClass = m_entityClassComboBox.SelectedItem as EntityClass;

            if (entityClass == null)
            {
                thisBox.Items.Clear();
                return;
            }

            //get the entire extended list of properties
            PropDef[] defs = m_conn.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(entityClass.EntityClassId);

            if (defs != null && defs.Length > 0)
            {
                //wait to draw the combo box until we've added all of the properties
                thisBox.BeginUpdate();

                thisBox.Items.Clear();

                foreach (PropDef def in defs.OrderBy(n => n.DispName))
                {
                    //create a list item type that will hold the property
                    PropDefItem item = new PropDefItem(def);

                    thisBox.Items.Add(item);
                }

                //indicate that we've finished updated the combobox and it can now be re-drawn
                thisBox.EndUpdate();
            }
        }
Пример #2
0
        private void m_addCriteriaButton_Click(object sender, EventArgs e)
        {
            //get a local reference of the currently selected PropertyDefinition object
            PropDefItem propertyItem = m_propertyComboBox.SelectedItem as PropDefItem;
            PropDef     property;

            property = (propertyItem == null) ? null : propertyItem.PropDef;

            //get local reference of the condition combo boxes currently selected item
            Condition condition = m_conditionComboBox.SelectedItem as Condition;

            if (property == null || condition == null)
            {
                return;
            }

            SearchRuleType rule     = SearchRuleType.Must;
            RuleItem       ruleItem = m_ruleComboBox.SelectedItem as RuleItem;

            if (ruleItem != null)
            {
                rule = ruleItem.Rule;
            }


            //create a SearchCondition object
            SrchCond searchCondition = new SrchCond();

            searchCondition.PropDefId = property.Id;
            searchCondition.PropTyp   = PropertySearchType.SingleProperty;
            searchCondition.SrchOper  = condition.Code;
            if (checkBox1.Checked)
            {
                //here we would effectively need to perform a search for everything and then search those results.
                searchCondition.SrchTxt = m_valueComboBox.SelectedItem.ToString();
            }
            else
            {
                searchCondition.SrchTxt = m_valueTextBox.Text;
            }

            searchCondition.SrchRule = rule;


            //create the list item to contain the condition
            SrchCondItem searchItem = new SrchCondItem(searchCondition, property);

            //add the SearchCondition object to the search criteria list box
            m_criteriaListBox.Items.Add(searchItem);
        }
Пример #3
0
        private void InitializeConditionComboBox()
        {
            //wait to draw the combo box until we've populated it with conditions
            m_conditionComboBox.BeginUpdate();

            m_conditionComboBox.Items.Clear();
            m_conditionComboBox.SelectedItem = null;
            m_conditionComboBox.Text         = String.Empty;

            PropDefItem propDefItem = m_propertyComboBox.SelectedItem as PropDefItem;

            Condition[] allowedConditions = null;

            if (propDefItem == null)
            {
            }   // leave the combo box empty
            else if (propDefItem.PropDef.Typ == DataType.Bool)
            {
                allowedConditions = new Condition[]
                {
                    Condition.EQUALS,
                    Condition.NOT_EQUAL
                };
            }
            else if (propDefItem.PropDef.Typ == DataType.DateTime ||
                     propDefItem.PropDef.Typ == DataType.Numeric)
            {
                allowedConditions = new Condition[]
                {
                    Condition.EQUALS,
                    Condition.NOT_EQUAL,
                    Condition.LESS_THAN_OR_EQUAL,
                    Condition.LESS_THAN,
                    Condition.GREATER_THAN_OR_EQUAL,
                    Condition.GREATER_THAN
                };
            }
            else if (propDefItem.PropDef.Typ == DataType.Bool)
            {
                allowedConditions = new Condition[]
                {
                    Condition.IS_EMPTY,
                    Condition.IS_NOT_EMPTY
                };
            }
            else if (propDefItem.PropDef.Typ == DataType.String)
            {
                //populate the combo box with the conditions
                allowedConditions = new Condition[]
                {
                    Condition.CONTAINS,
                    Condition.EQUALS,
                    Condition.DOES_NOT_CONTAIN,
                    Condition.IS_EMPTY,
                    Condition.IS_NOT_EMPTY,
                    Condition.LESS_THAN_OR_EQUAL,
                    Condition.LESS_THAN,
                    Condition.GREATER_THAN_OR_EQUAL,
                    Condition.GREATER_THAN,
                    Condition.NOT_EQUAL
                };
            }

            if (allowedConditions != null)
            {
                m_conditionComboBox.Items.AddRange(allowedConditions);
            }

            //indicated that we're finished populating the combobox and that it can be re-drawn
            m_conditionComboBox.EndUpdate();
        }