예제 #1
0
 /// <summary>
 /// Gives the user an option to save the changes to the filter (if they have unsaved changes) call things for example when closing the host form.
 /// </summary>
 public override void ConsultAboutClosing(object sender, FormClosingEventArgs e)
 {
     if (_extractionFilter != null && _extractionFilter.HasLocalChanges().Evaluation == ChangeDescription.DatabaseCopyDifferent)
     {
         if (Activator.YesNo(
                 "You have unsaved changes to Filter \"" + _extractionFilter.Name +
                 "\", would you like to save these now?", "Save Changes to Filter?"))
         {
             ObjectSaverButton1.Save();
         }
         else
         {
             try
             {
                 //So there are local changes to the filter but the user doesnt want to save them.  We need to undo the local changes to the
                 //object that we have a reference to.  This is important because other classes might still have references to that object too
                 //so we fetch a fresh copy out of the database (RevertChanges) and set each of the properties to the original (last saved) values
                 _extractionFilter.RevertToDatabaseState();
             }
             catch (Exception ex)
             {
                 ExceptionViewer.Show("Failed to revert changes on filter, did you delete it?", ex);
             }
         }
     }
 }
예제 #2
0
        private void SecondaryConstraintRequestDelete(object sender)
        {
            var toDelete = (sender as SecondaryConstraintUI).SecondaryConstriant;

            SelectedColumnItemValidator.SecondaryConstraints.Remove(toDelete);
            tableLayoutPanel1.Controls.Remove(sender as Control);
            ObjectSaverButton1.Enable(true);
        }
예제 #3
0
        private void ScintillaOnSavePointLeft(object sender, EventArgs eventArgs)
        {
            if (_bLoading)
            {
                return;
            }

            ObjectSaverButton1.Enable(true);
        }
예제 #4
0
        private void btnAddSecondaryConstraint_Click(object sender, EventArgs e)
        {
            if (SelectedColumnItemValidator == null)
            {
                MessageBox.Show("You must select a column on the left first");
                return;
            }

            if (ddSecondaryConstraints.SelectedItem != null)
            {
                var secondaryConstriant =
                    Validator.CreateConstraint(ddSecondaryConstraints.Text, Consequence.Missing) as SecondaryConstraint;

                SelectedColumnItemValidator.SecondaryConstraints.Add(secondaryConstriant);
                AddSecondaryConstraintControl(secondaryConstriant);
                ObjectSaverButton1.Enable(true);
            }
        }
예제 #5
0
        private void ddPrimaryConstraints_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bSuppressChangeEvents)
            {
                return;
            }

            if (SelectedColumnItemValidator == null)
            {
                return;
            }

            bSuppressChangeEvents = true;

            if (ddPrimaryConstraints.Text == _noPrimaryConstraintText)
            {
                SelectedColumnItemValidator.PrimaryConstraint = null;
                ddConsequence.SelectedItem = Consequence.Missing;
            }
            else
            {
                try
                {
                    SelectedColumnItemValidator.PrimaryConstraint =
                        Validator.CreateConstraint(ddPrimaryConstraints.Text, (Consequence)ddConsequence.SelectedValue) as PrimaryConstraint;
                }
                catch (Exception ex)
                {
                    ExceptionViewer.Show("Failed to create PrimaryConstraint '" + ddPrimaryConstraints.Text + "'", ex);
                }
            }

            //Make consequence selection only possible if there is a priary constraint selected
            ddConsequence.Enabled = ddPrimaryConstraints.Text != _noPrimaryConstraintText;


            bSuppressChangeEvents = false;
            ObjectSaverButton1.Enable(true);
        }
예제 #6
0
        private void ddConsequence_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bSuppressChangeEvents)
            {
                return;
            }

            if (SelectedColumnItemValidator != null)
            {
                if (SelectedColumnItemValidator.PrimaryConstraint != null)
                {
                    SelectedColumnItemValidator.PrimaryConstraint.Consequence = (Consequence)ddConsequence.SelectedValue;
                    ObjectSaverButton1.Enable(true);
                }
                else
                {
                    MessageBox.Show("you must select a primary constraint first");

                    bSuppressChangeEvents      = true;
                    ddConsequence.SelectedItem = Consequence.Missing;
                    bSuppressChangeEvents      = false;
                }
            }
        }