Example #1
0
        private void buttonAddForeignFilter_Click(object sender, EventArgs e)
        {
            FormFilter2.ReturnTypes returnType = FormFilter2.ReturnTypes.Single;

            List <Column> columns = new List <Column>();

            for (int i = 0; i < listViewForeignColumn.Items.Count; i++)
            {
                columns.Add((Column)listViewForeignColumn.Items[i].Tag);
            }
            if (TypeOfRelationship == typeof(ManyToManyRelationship) ||
                TypeOfRelationship == typeof(OneToManyRelationship))
            {
                returnType = FormFilter2.ReturnTypes.Collection;
            }

            FormFilter2 form2 = new FormFilter2(this, (ScriptObject)comboBoxForeignScriptObject.SelectedItem, returnType, columns);

            if (form2.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            form2.TheFilter.Parent.AddFilter(form2.TheFilter);
            comboBoxForeignScriptObject_SelectedIndexChanged(null, null);
            comboBoxForeignFilter.SelectedItem = form2.TheFilter;
        }
        private void buttonAddPrimaryFilter_Click(object sender, EventArgs e)
        {
            FormFilter2.ReturnTypes returnType = FormFilter2.ReturnTypes.Single;
            List<Column> columns = new List<Column>();

            for (int i = 0; i < listViewPrimaryColumn.Items.Count; i++)
            {
                columns.Add((Column)listViewPrimaryColumn.Items[i].Tag);
            }
            if (TypeOfRelationship == typeof(ManyToManyRelationship) ||
                TypeOfRelationship == typeof(ManyToOneRelationship))
            {
                returnType = FormFilter2.ReturnTypes.Collection;
            }
            FormFilter2 form2 = new FormFilter2(this, (ScriptObject)comboBoxPrimaryScriptObject.SelectedItem, returnType, columns);

            if (form2.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            FilterWasCreated = true;
            form2.TheFilter.Parent.AddFilter(form2.TheFilter);
            comboBoxPrimaryScriptObject_SelectedIndexChanged(null, null);
            comboBoxPrimaryFilter.SelectedItem = form2.TheFilter;
        }