Example #1
0
 internal bool HasEqualCount(TransactionCodeInfo code)
 {
     return
         (code != null &&
          BeginCount == code.BeginCount &&
          SaveCount == code.SaveCount &&
          CommitCount == code.CommitCount &&
          RollbackCount == code.RollbackCount);
 }
Example #2
0
        internal TestingForm(Connectable connectable, TestingOption option, string title)
        {
            try
            {
                _connectable = connectable;                     // store connectable object which may be used after the testing, for the execution
                _body        = connectable.Executable.Body;     // store body
                InitializeComponent();

                _offToolTip = new ToolTip();
                _offToolTip.SetToolTip(_off, "Close and set Testing Environment OFF.");
                _interruptToolTip = new ToolTip();
                _interruptToolTip.SetToolTip(_interrupt, "Interrupt the execution of the Testing Environment");

                _params = new Dictionary <string, TVP>();

                this.ShowIcon    = false;
                Text             = String.Format("{0} | {1}", Wall.Text.Free.QtTesting, ParseConnString());
                _statusRows.Text = null;

                var name = ((IName)_connectable).Name;
                if (title != null)
                {
                    _name.Text       = title;
                    _statusName.Text = title;
                }
                else if (name != null)
                {
                    _name.Text       = name;
                    _statusName.Text = (name == Wall.Text.NotAvailable) ? null : name;
                }
                else
                {
                    _name.Text       = Wall.Text.NotAvailable;
                    _statusName.Text = null;
                }

                _sql.Text = _connectable.Body;

                _tranCodeInfo = new TransactionCodeInfo(_connectable.Body);

                // if compilable object is a stored procedure, show extra message
                if (_connectable.Executable.Compilable.CompilableType == Compilable.ObjectType.StoredProc)
                {
                    ShowMessage(Wall.Text.Free.StoredProcTestMessage);
                }

                _sqlContextMenu = new ContextMenuStrip();
                ToolStripMenuItem menuItem = new ToolStripMenuItem(Wall.Text.Free.RestoreSQL,
                                                                   Properties.Resources.restore,
                                                                   (o, e) =>
                {
                    _sql.ThreadSafeInvoke(new Action(() => _sql.Text = _body));
                });
                _sqlContextMenu.Items.Add(menuItem);
                _sql.ContextMenuStrip = _sqlContextMenu;

                AddEventHandlers();
                ShowParameterGrid();

                // clear loader cache
                //   note:
                //     We clear cache in order to remove all mapped loaders that contain graph objects (associations)
                //     that cannot be shown in the grid. Otherwise the grid does not show the correct data.
                Cache.Loaders.Clear();

                this.Load += (o, e) =>
                {
                    try
                    {
                        if (option == TestingOption.OpenAndExecute)
                        {
                            Run();
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex);
                    }
                };
            }
            catch (System.Exception ex)
            {
                throw ClrException(ex);
            }
        }