Exemplo n.º 1
0
        protected override TreeNode AddNodeItem(TreeNode aTn, OleDbDataReader aReader, ref int aSI)
        {
            /// В pSQLString должен быть определен примерно такой select:
              /// ...
              /// SELECT
              ///		refCode, refBName, 1, ...
              /// FROM
              ///		rbRef
              /// ...

              TreeNode ntn = new TreeNode(aReader.GetString(1));
              PCTVItemData tid = new PCTVItemData();
              ntn.Tag = tid;
              tid.pPC.code = aReader.GetInt32(0);
              /// Added M.Tor 25.06.2008:
              tid.pText = aReader.GetString(1);
              if (aReader.GetInt32(2) > 0)
            ntn.Nodes.Add(new TreeNode());

              if (aTn == null)
              {
            Nodes.Add(ntn);
            tid.pPath = tid.pCode.ToString();
              }
              else
              {
            aTn.Nodes.Add(ntn);
            tid.pPath = ((PCTVItemData)aTn.Tag).pPath + pPathDelim + tid.pCode;
              }

              aSI = 3;

              return ntn;
        }
Exemplo n.º 2
0
 public override void SetParam(PCTVItemData aTID, Param aPrm)
 {
     //if (aTID != null)
       //  aPrm.CurrentValue = aTID.pPC.code.ToString();
       //else
       //  aPrm.CurrentValue = "0";
       /// Modified by M.Tor 25.06.2008:
       if (aTID != null)
     aPrm.CurrentValue = aTID.pPC.code.ToString() + PlaceCode.DELIM.ToString() + aTID.pText;
       else
     aPrm.CurrentValue = "0:";
 }
Exemplo n.º 3
0
        public void ShowParam2()
        {
            if (pPerf == null || pPerf.pCurrentQuery == null)
              {
            Refresh();
            return;
              }

              this.SuspendLayout();
              //_tlp.SuspendLayout();
              //_tlp.Controls.Clear();
              while (_tlp.Controls.Count > 0)
            _tlp.Controls.RemoveAt(0);
              _tlp.RowCount = 0;

              #region Добавлено DSY 29.11.2007
              _tlp.Height = 0;
              _tlp.Controls.Add(_lblFilter, 0, 0);
              _tlp.SetColumnSpan(_lblFilter, 2);
              int row = 1;
              #endregion

            //      int row = 0;
              foreach (Param prm in pPerf.pCurrentQuery.Params)
              {
            Control ctr = null;
            #region Create control
            switch (prm.Type)
            {
              case eQueryParamType.Boolean:
            {
              CheckBox chk = new CheckBox();
              chk.Checked = prm.ValBool;
              ctr = chk;
            }
            break;
              case eQueryParamType.Date:
            {
              DateTimePicker dtp = new DateTimePicker();
              dtp.Value = prm.ValDate;
              ctr = dtp;
            }
            break;
              case eQueryParamType.Integer:
              case eQueryParamType.String:
              case eQueryParamType.PlaceCode:
            {
              TextBox txt = new TextBox();
              txt.Text = prm.ValStr;
              ctr = txt;
            }
            break;
              /// --------------------- LIST ---------------------
              case eQueryParamType.IntSelectList:
            {
              ucParamCboInt cbo = new ucParamCboInt(pPerf);
              if (prm.CurrentValue.Length > 0)
              {
                cbo.Items.Add(new _ListBoxItem(prm.CurrentValue));
                cbo.SelectedIndex = 0;
              }
              cbo.BeforeFill += new EventHandler(cbo_BeforeFill);
              ctr = cbo;
            }
            break;
              case eQueryParamType.PCSelectList:
            {
              ucParamCboPC cbo = new ucParamCboPC(pPerf);
              if (prm.CurrentValue.Length > 0)
              {
                cbo.Items.Add(new _ListBoxPCItem(prm.CurrentValue));
                cbo.SelectedIndex = 0;
              }
              cbo.BeforeFill += new EventHandler(cbo_BeforeFill);
              ctr = cbo;
            }
            break;
              case eQueryParamType.StrSelectList:
            {
              ucParamCboStr cbo = new ucParamCboStr(pPerf);
              if (prm.CurrentValue.Length > 0)
              {
                cbo.Items.Add(new _ListBoxTextItem(prm.CurrentValue));
                cbo.SelectedIndex = 0;
              }
              cbo.BeforeFill += new EventHandler(cbo_BeforeFill);
              ctr = cbo;
            }
            break;
              /// --------------------- TREE ---------------------
              case eQueryParamType.IntSelectTree:
            {
              CASSelectFromTV sft = new CASSelectFromTV();
              ucIntParamTV tv = new ucIntParamTV(pPerf);
              tv.pSQLString = prm.SelectValue; // ReplaceCommonParameter(prm.SelectValue);
              sft.pTreeView = tv;
              /// Added M.Tor 25.06.2008:
              if (prm.CurrentValue.Length > 0)
              {
                PCTVItemData tid = new PCTVItemData();
                _ListBoxItem lbi = new _ListBoxItem(prm.CurrentValue);
                tid.pCode = lbi.code;
                tid.pText = lbi.text;
                sft.SetItem(0, 0, tid.pText);
                sft.pItemTreeNodeTag = tid;
              }
              sft.OnBeforeShowTV += new EventHandler(sft_OnBeforeShowTV);
              ctr = sft;
            }
            break;
              case eQueryParamType.StrSelectTree:
            {
              CASSelectFromTV sft = new CASSelectFromTV();
              sft.pIsMayBeWithoutRefbook = true;
              ucStringParamTV tv = new ucStringParamTV(pPerf);
              tv.pSQLString = prm.SelectValue; // ReplaceCommonParameter(prm.SelectValue);
              sft.pTreeView = tv;
              /// Added M.Tor 25.06.2008:
              if (prm.CurrentValue.Length > 0)
              {
                PCTVItemData tid = new PCTVItemData();
                _ListBoxTextItem lbi = new _ListBoxTextItem(prm.CurrentValue);
                tid.pPath = lbi.text1;
                tid.pText = lbi.text2;
                sft.SetItem(0, 0, tid.pText);
                sft.pItemTreeNodeTag = tid;
              }
              sft.OnBeforeShowTV += new EventHandler(sft_OnBeforeShowTV);
              ctr = sft;
            }
            break;
              case eQueryParamType.PCSelectTree:
            {
              CASSelectFromTV sft = new CASSelectFromTV();
              ucPCParamTV tv = new ucPCParamTV(pPerf);
              tv.pSQLString = prm.SelectValue; // ReplaceCommonParameter(prm.SelectValue);
              sft.pTreeView = tv;
              /// Added M.Tor 25.06.2008:
              if (prm.CurrentValue.Length > 0)
              {
                PCTVItemData tid = new PCTVItemData();
                _ListBoxPCItem lbi = new _ListBoxPCItem(prm.CurrentValue);
                tid.pPC = lbi.pPC;
                tid.pText = lbi.pText;
                sft.SetItem(0, 0, tid.pText);
                sft.pItemTreeNodeTag = tid;
              }
              sft.OnBeforeShowTV += new EventHandler(sft_OnBeforeShowTV);
              ctr = sft;
            }
            break;
            }
            #endregion
            if (ctr != null)
            {
              Label lbl = new Label();
              lbl.Text = prm.Title;
              lbl.TextAlign = ContentAlignment.MiddleRight;
              lbl.Tag = prm;
              //lbl.Dock = DockStyle.Fill;
              lbl.AutoSize = true;
              ctr.Tag = lbl;

              if ((ctr as DateTimePicker) == null)
            ctr.Dock = DockStyle.Fill;

              _tlp.Controls.Add(lbl, 0, row);
              _tlp.Controls.Add(ctr, 1, row++);

              if (ctr is CASSelectFromTV)
            (ctr as CASSelectFromTV).OnValueChanged += new EventHandler(ctr_TextChanged);
              else
            ctr.TextChanged += new EventHandler(ctr_TextChanged);
            }
              }
              _tlp.RowCount = row;

              if (_autoHeight)
              {
            #region Добавлено DSY 29.11.2007
            int startRowN = 0;
            if (pShowWordFilter && _tlp.RowCount <= 1)
              startRowN++;
            #endregion

            int rh = 0;
            for (int ii = startRowN; ii < _tlp.RowCount; ii++)
              rh += _tlp.GetRowHeights()[ii];
            _tlp.Visible = rh > 0;
            this.Height = rh;
              }

              //_tlp.ResumeLayout(true);
              this.ResumeLayout();
              this.PerformLayout();
        }
Exemplo n.º 4
0
        protected override TreeNode AddNodeItem(TreeNode aTn, OleDbDataReader aReader, ref int aSI)
        {
            /// В pSQLString должен быть определен примерно такой select:
              /// ...
              /// SELECT
              ///		objPlace, objCode, objName, CASE WHEN objTypeR=1420 THEN 0 ELSE 1 END, ...
              /// FROM
              ///		iNode INNER JOIN iObj ON nodPObj=objPlace AND nodCObj=objCode
              /// ...

              TreeNode ntn = new TreeNode(aReader.GetString(2));
              PCTVItemData tid = new PCTVItemData();
              ntn.Tag = tid;
              tid.pPC.place = aReader.GetInt32(0);
              tid.pPC.code = aReader.GetInt32(1);
              /// Added M.Tor 25.06.2008:
              tid.pText = aReader.GetString(2);
              if (aReader.GetInt32(3) > 0)
            ntn.Nodes.Add(new TreeNode());

              if (aTn == null)
              {
            Nodes.Add(ntn);
            tid.pPath = tid.pCode.ToString();
              }
              else
              {
            aTn.Nodes.Add(ntn);
            tid.pPath = ((PCTVItemData)aTn.Tag).pPath + pPathDelim + tid.pCode;
              }

              aSI = 4;

              return ntn;
        }
Exemplo n.º 5
0
 public abstract void SetParam(PCTVItemData aTID, Param aPrm);