Inheritance: ATMLCommonLibrary.forms.ATMLForm
Example #1
0
 private void btnLimit1_Click(object sender, EventArgs e)
 {
     //Datum.SetDatumValue(edtDatumType.Value, datum);
     datum = edtDatumType.DatumType;
     ControlsToData(); //Load the limit item
     if (_limitControlType == ControlType.SimpleLimit)
     {
         _singleLimit.Item = datum;
         if (cmbLimitComparitor.SelectedValue != null)
         {
             _singleLimit.comparator = (ComparisonOperator)Enum.Parse(typeof(ComparisonOperator),
                                                                      (String)cmbLimitComparitor.SelectedValue);
         }
         var form = new SingleLimitForm(_singleLimit);
         RegisterForm(form);
         form.Closed += delegate(object sndr, EventArgs ee)
         {
             UnRegisterForm((Form)sndr);
             if (ee is FormClosedEventArgs)
             {
                 var f = (Form)sndr;
                 if (DialogResult.OK == f.DialogResult)
                 {
                     try
                     {
                         SingleLimit = form.SingleLimit;
                         if (OnSelectLimit != null)
                         {
                             OnSelectLimit(_singleLimit);
                         }
                         if (LimitChanged != null)
                         {
                             LimitChanged(_singleLimit);
                         }
                     }
                     catch (Exception err)
                     {
                         MessageBox.Show(@"Error: " + err.Message, @"E R R O R");
                     }
                 }
             }
         };
         form.Show();
     }
     else if (_limitControlType == ControlType.ExpectedLimit)
     {
         _expectedLimit.Item       = datum;
         _expectedLimit.comparator =
             (EqualityComparisonOperator)
             Enum.Parse(typeof(EqualityComparisonOperator), (String)cmbLimitComparitor.SelectedValue);
         var form = new ExpectedLimitForm(_expectedLimit);
         RegisterForm(form);
         form.Closed += delegate(object sndr, EventArgs ee)
         {
             UnRegisterForm((Form)sndr);
             if (ee is FormClosedEventArgs)
             {
                 var f = (Form)sndr;
                 if (DialogResult.OK == f.DialogResult)
                 {
                     try
                     {
                         ExpectedLimit = form.LimitExpected;
                     }
                     catch (Exception err)
                     {
                         MessageBox.Show(@"Error: " + err.Message, @"E R R O R");
                     }
                 }
             }
         };
         form.Show();
     }
 }
 private void btnLimit1_Click(object sender, EventArgs e)
 {
     //Datum.SetDatumValue(edtDatumType.Value, datum);
     datum = edtDatumType.DatumType;
     ControlsToData(); //Load the limit item
     if (_limitControlType == ControlType.SimpleLimit)
     {
         _singleLimit.Item = datum;
         if (cmbLimitComparitor.SelectedValue != null )
             _singleLimit.comparator = (ComparisonOperator)Enum.Parse( typeof (ComparisonOperator),
                                                                      (String) cmbLimitComparitor.SelectedValue);
         var form = new SingleLimitForm(_singleLimit);
         RegisterForm( form );
         form.Closed += delegate(object sndr, EventArgs ee)
         {
             UnRegisterForm((Form)sndr);
             if (ee is FormClosedEventArgs)
             {
                 var f = (Form)sndr;
                 if (DialogResult.OK == f.DialogResult)
                 {
                     try
                     {
                         SingleLimit = form.SingleLimit;
                         if (OnSelectLimit != null)
                             OnSelectLimit(_singleLimit);
                         if (LimitChanged != null)
                             LimitChanged(_singleLimit);
                     }
                     catch (Exception err)
                     {
                         MessageBox.Show(@"Error: " + err.Message, @"E R R O R");
                     }
                 }
             }
         };
         form.Show();
     }
     else if (_limitControlType == ControlType.ExpectedLimit)
     {
         _expectedLimit.Item = datum;
         _expectedLimit.comparator =
             (EqualityComparisonOperator)
                 Enum.Parse(typeof(EqualityComparisonOperator), (String)cmbLimitComparitor.SelectedValue);
         var form = new ExpectedLimitForm(_expectedLimit);
         RegisterForm( form );
         form.Closed += delegate(object sndr, EventArgs ee)
         {
             UnRegisterForm((Form)sndr);
             if (ee is FormClosedEventArgs)
             {
                 var f = (Form)sndr;
                 if (DialogResult.OK == f.DialogResult)
                 {
                     try
                     {
                         ExpectedLimit = form.LimitExpected;
                     }
                     catch (Exception err)
                     {
                         MessageBox.Show(@"Error: " + err.Message, @"E R R O R");
                     }
                 }
             }
         };
         form.Show();
     }
 }