Пример #1
0
        private void buttonAddIntermediateForeignRelationship_Click(object sender, EventArgs e)
        {
            if (comboBoxIntermediatePrimaryRelationship.SelectedItem == null)
            {
                errorProvider.SetError(comboBoxIntermediatePrimaryRelationship, "Must Select Intermediate Primary Script Object.");
                return;
            }

            ScriptObject     intermediateForeignScriptObject = ((Relationship)comboBoxIntermediatePrimaryRelationship.SelectedItem).ForeignScriptObject;
            FormRelationship form = new FormRelationship(typeof(ManyToOneRelationship), intermediateForeignScriptObject, intermediateForeignScriptObject.Database.EnabledScriptObjects);

            // Offset new form
            form.StartPosition = FormStartPosition.Manual;
            form.Left          = this.Left + 20;
            form.Top           = this.Top + 20;
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent;
                primaryScriptObject.AddRelationship(form.PrimaryRelationship);

                ScriptObject foreignScriptObject = form.ForeignRelationship.Parent;
                foreignScriptObject.AddRelationship(form.ForeignRelationship);

                comboBoxIntermediatePrimaryRelationship_SelectedIndexChanged(null, null);
                comboBoxIntermediateForeignRelationship.SelectedItem = form.PrimaryRelationship;
            }
        }
Пример #2
0
        private void buttonAddIntermediatePrimaryRelationship_Click(object sender, EventArgs e)
        {
            FormRelationship form = new FormRelationship(typeof(OneToManyRelationship), _parent, _parent.Database.EnabledScriptObjects);

            // Offset new form
            form.StartPosition = FormStartPosition.Manual;
            form.Left          = this.Left + 20;
            form.Top           = this.Top + 20;
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent;
                primaryScriptObject.AddRelationship(form.PrimaryRelationship);

                ScriptObject foreignScriptObject = form.ForeignRelationship.Parent;
                foreignScriptObject.AddRelationship(form.ForeignRelationship);

                foreach (OneToManyRelationship oneToManyRelationship in _parent.OneToManyRelationships)
                {
                    comboBoxIntermediatePrimaryRelationship.Items.Add(oneToManyRelationship);
                }
                comboBoxIntermediatePrimaryRelationship.DisplayMember = "Alias";
                comboBoxIntermediatePrimaryRelationship.ValueMember   = "Name";

                comboBoxIntermediatePrimaryRelationship.SelectedItem = form.PrimaryRelationship;
            }
        }
Пример #3
0
        private void buttonAddIntermediatePrimaryRelationship_Click(object sender, EventArgs e)
        {
            FormRelationship form = new FormRelationship(typeof(OneToManyRelationship), _parent, _parent.Database.EnabledScriptObjects);
            // Offset new form
            form.StartPosition = FormStartPosition.Manual;
            form.Left = this.Left + 20;
            form.Top = this.Top + 20;
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent;
                primaryScriptObject.AddRelationship(form.PrimaryRelationship);

                ScriptObject foreignScriptObject = form.ForeignRelationship.Parent;
                foreignScriptObject.AddRelationship(form.ForeignRelationship);

                foreach (OneToManyRelationship oneToManyRelationship in _parent.OneToManyRelationships)
                {
                    comboBoxIntermediatePrimaryRelationship.Items.Add(oneToManyRelationship);
                }
                comboBoxIntermediatePrimaryRelationship.DisplayMember = "Alias";
                comboBoxIntermediatePrimaryRelationship.ValueMember = "Name";

                comboBoxIntermediatePrimaryRelationship.SelectedItem = form.PrimaryRelationship;
            }
        }
Пример #4
0
        private void buttonAddIntermediateForeignRelationship_Click(object sender, EventArgs e)
        {
            if (comboBoxIntermediatePrimaryRelationship.SelectedItem == null)
            {
                errorProvider.SetError(comboBoxIntermediatePrimaryRelationship, "Must Select Intermediate Primary Script Object.");
                return;
            }

            ScriptObject intermediateForeignScriptObject = ((Relationship)comboBoxIntermediatePrimaryRelationship.SelectedItem).ForeignScriptObject;
            FormRelationship form = new FormRelationship(typeof(ManyToOneRelationship), intermediateForeignScriptObject, intermediateForeignScriptObject.Database.EnabledScriptObjects);
            // Offset new form
            form.StartPosition = FormStartPosition.Manual;
            form.Left = this.Left + 20;
            form.Top = this.Top + 20;
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ScriptObject primaryScriptObject = form.PrimaryRelationship.Parent;
                primaryScriptObject.AddRelationship(form.PrimaryRelationship);

                ScriptObject foreignScriptObject = form.ForeignRelationship.Parent;
                foreignScriptObject.AddRelationship(form.ForeignRelationship);

                comboBoxIntermediatePrimaryRelationship_SelectedIndexChanged(null, null);
                comboBoxIntermediateForeignRelationship.SelectedItem = form.PrimaryRelationship;
            }
        }