Example #1
0
        public dlgParam(Query aQuery)
        {
            _query = aQuery;

              //
              // Required for Windows Form Designer support
              //
              InitializeComponent();

              _uc = new ucParamDef(true);
              _uc.SetData(_query.Params);
              _uc.Location = new Point(5, 5);
              _uc.Size = new Size(this.ClientSize.Width - 10, _cmdOk.Top - 10);
              _uc.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
              this.Controls.Add(_uc);

              this.Text = "Параметр(ы) запроса - " + _query.Name;
        }
Example #2
0
        public frmQuery(WorkDB aDB, CommandAS.QueryLib.ucTreeQuery aTVQuery)
        {
            _task = new Task(aDB);
              //aDB.pQP = _task;

              _lockModified = false;
              _sesFont = new Font(this.Font.FontFamily.Name, this.Font.Size);
              _currProc = null;
              _ofArr = new ArrayList(16);
              pLoadDefaultSession = string.Empty;

              //
              // Required for Windows Form Designer support
              //
              InitializeComponent();

              _tc.TabPages.Remove(_tcpParam);
              _tc.TabPages.Remove(_tcpXSLTInc);

              _txtConnection.AcceptsReturn = true;

              #region MANUAL DESIGN
              this._param = new ucParameters();
              this._splitQ = new System.Windows.Forms.Splitter();
              if (aTVQuery == null)
            this._tvQueries = new CommandAS.QueryLib.ucTreeQuery();
              else
            this._tvQueries = aTVQuery;
              //
              // _param
              //
              this._param.Dock = System.Windows.Forms.DockStyle.Fill;
              this._param.Location = new System.Drawing.Point(0, 144);
              this._param.Name = "_param";
              this._param.Size = new System.Drawing.Size(768, 156);
              this._param.TabIndex = 4;
              //
              // _splitQ
              //
              this._splitQ.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
              this._splitQ.Dock = System.Windows.Forms.DockStyle.Top;
              this._splitQ.Location = new System.Drawing.Point(0, 136);
              this._splitQ.Name = "_splitQ";
              this._splitQ.Size = new System.Drawing.Size(768, 8);
              this._splitQ.TabIndex = 3;
              this._splitQ.TabStop = false;
              //
              // _tvQueries
              //
              this._tvQueries.Dock = System.Windows.Forms.DockStyle.Top;
              this._tvQueries.ImageIndex = -1;
              this._tvQueries.Location = new System.Drawing.Point(0, 0);
              this._tvQueries.Name = "_tvQueries";
              this._tvQueries.SelectedImageIndex = -1;
              this._tvQueries.Size = new System.Drawing.Size(768, 136);
              this._tvQueries.TabIndex = 0;

              this._tcpQuery.Controls.Add(this._param);
              this._tcpQuery.Controls.Add(this._splitQ);
              this._tcpQuery.Controls.Add(this._tvQueries);
              #endregion

              _commParamDef = new ucParamDef(false);
              _commParamDef.Location = new Point(5, 5);
              _commParamDef.Size = new Size(_tcpXSLTInc.Width - 10, _tcpXSLTInc.Height - 10);
              _commParamDef.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
              _tcpXSLTInc.Controls.Add(_commParamDef);

              NewSession();
              _param.pPerf = _task;
              _commParamDef.SetData(_task.pCommonParamCollection);

              int iconSize = 0;
              try
              {
            iconSize = Convert.ToInt32(Registry.CurrentUser.OpenSubKey(AppConst.REG_APP_PATH).GetValue("IconSize"));
              }
              catch { }
              if (iconSize < 16)
            iconSize = 32;
              _iconColl = new QueryIconCollection(iconSize);

              _tb.ImageList = _iconColl.pImageList;
              _tbbExecRTab.ImageIndex = _iconColl.Index(QueryIconCollection.ExecRTab);
              _tbbExecRExcel.ImageIndex = _iconColl.Index(QueryIconCollection.ExecRExcel);
              _tbbExecRHTML.ImageIndex = _iconColl.Index(QueryIconCollection.ExecRHTML);
              _tbbNewQuery.ImageIndex = _iconColl.Index(QueryIconCollection.New);
              _tbbDelQuery.ImageIndex = _iconColl.Index(QueryIconCollection.Delete);
              _tbbSaveSession.ImageIndex = _iconColl.Index(QueryIconCollection.Save);
              _tbbLoadSession.ImageIndex = _iconColl.Index(QueryIconCollection.DocOpen);
              _tbbEditSQL.ImageIndex = _iconColl.Index(QueryIconCollection.TextSQL);
              _tbbEditParam.ImageIndex = _iconColl.Index(QueryIconCollection.TextParam);
              _tbbEditXSLT.ImageIndex = _iconColl.Index(QueryIconCollection.TextXSLT);
              _tbbAbout.ImageIndex = _iconColl.Index(QueryIconCollection.About);

              _tbbExecRTab.Tag = _mnuExecRTab;
              _tbbExecRExcel.Tag = _mnuExecRExcel;
              _tbbExecRHTML.Tag = _mnuExecRHTML;
              _tbbEditSQL.Tag = _mnuEditSQL;
              _tbbEditParam.Tag = _mnuEditParam;
              _tbbEditXSLT.Tag = _mnuEditXSLT;

              _tvQueries.HideSelection = false;
              _lcmTV = new ContextMenu();
              _miExecute = new MenuItem("Выполнить", new EventHandler(_mnuExecRTab_Click), Shortcut.F5);
              _lcmTV.MenuItems.Add(_miExecute);
              _lcmTV.MenuItems.Add(new MenuItem("-"));
              _lcmTV.MenuItems.Add(new MenuItem("Новый", new EventHandler(DoCommandNewQuery)));
              _miDeleteQuery = new MenuItem("Удалить", new EventHandler(DoCommandDeleteQuery));
              _lcmTV.MenuItems.Add(_miDeleteQuery);
              _miEditQuery = new MenuItem(this._mnuEdit.Text);
              MenuItem miEditSQL = new MenuItem(this._mnuEditSQL.Text, new EventHandler(DoCommandEditQuery));
              MenuItem miEditParam = new MenuItem(this._mnuEditParam.Text, new EventHandler(DoCommandEditQueryParam));
              MenuItem miEditXSLT = new MenuItem(this._mnuEditXSLT.Text, new EventHandler(DoCommandEditQuery));
              _miEditQuery.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { miEditSQL, miEditParam, miEditXSLT });
              _lcmTV.MenuItems.Add(_miEditQuery);
              _lcmTV.MenuItems.Add(new MenuItem("-"));
              _miPropertyQuery = new MenuItem("Свойства", new EventHandler(DoCommandPropertyQuery), Shortcut.F2);
              _lcmTV.MenuItems.Add(_miPropertyQuery);
              _lcmTV.Popup += new EventHandler(DoCommandTVQContextMenuPopup);

              _tvQueries.AfterSelect += new TreeViewEventHandler(DoCommandTVQAfterSelect);
              _tvQueries.DoubleClick += new EventHandler(DoCommandTVQDoubleClick);

              _cmdPassword.Click += new EventHandler(_cmdPassword_Click);

              _tc.SelectedIndexChanged += new EventHandler(_tc_SelectedIndexChanged);

              Load += new EventHandler(DoLoad);
              Closing += new CancelEventHandler(DoClosing);
              Activated += new EventHandler(DoActivated);

              TitleText();
              _txtFont.Text = _sesFont.ToString();
              _modified = false;
              _mnuExec.Enabled = false;
              _tbbExecRTab.Enabled = false;
              _tbbExecRExcel.Enabled = false;
              _tbbExecRHTML.Enabled = false;
              _mnuDeleteQuery.Enabled = false;
              _tbbDelQuery.Enabled = false;

              Icon = new Icon(GetType(), "Images.Icons.Query.ico");

              _img = null;
              _pnlImg.Paint += new PaintEventHandler(_pnlImg_Paint);
        }