Beispiel #1
0
        /// <summary>
        /// 填充结点以及子内容
        /// </summary>
        /// <param name="dt">缓存表</param>
        /// <param name="tn">结点</param>
        /// <param name="p_fieldid">parentfield列的过滤条件</param>
        private void fillNode(DataTable dt, TreeNode tn, int p_fieldid)
        {
            Font    ft       = new Font("宋体", 9, FontStyle.Bold);
            tagPlus tp       = tn.Tag as tagPlus;
            string  tiaojian = "parentfield=" + p_fieldid.ToString();

            if (p_fieldid == 0)
            {
                tiaojian += " or parentfield is NULL";
            }
            foreach (DataRow row in dt.Select(tiaojian))
            {
                string             text        = row["modelname_cn"].ToString().Trim();
                string             name        = row["name"].ToString().Trim();
                string             fieldname   = row["fieldname"].ToString().Trim();
                string             fieldcnname = row["fieldcnname"].ToString().Trim();
                int                fieldid     = int.Parse(row["fieldid"].ToString().Trim());
                int                parentfield = int.Parse(row["parentfield"].ToString().Trim() == "" ? "0" : row["parentfield"].ToString().Trim());
                int                hasChild    = int.Parse(row["hasChild"].ToString().Trim());
                int                hasScript   = int.Parse(row["hasScript"].ToString().Trim());
                TreeNodeCollection t           = tn.Nodes;
                TreeNode           tn1         = t.Add(fieldcnname + "(" + fieldname + ")");
                this.m_AllScriptTreeNode.Add(tn1);
                tn1.Tag = new tagPlus(tp.nDeep + 1, tn1.FullPath.ToString(), fieldid.ToString(), tp.tabid);
                if (hasScript > 0)
                {
                    tn1.NodeFont = ft;
                }
                if (hasChild > 0)
                {
                    fillNode(dt, tn1, fieldid);
                }
            }
        }
Beispiel #2
0
        private bool GetNodeCode(TreeNode tn, ref string strCodeRet)
        {
            bool bResult = false;

            tagPlus tp = tn.Tag as tagPlus;

            if (tp.nDeep >= 2)
            {
                //模块级代码
                string    sql = "select * from sys_scriptstore where fieldid=" + tp.fieldid + " and modtabid=" + tp.tabid;
                DataTable dt  = sqlDB.ExeSqlDs(sql, "script").Tables[0];

                if (dt.Rows.Count == 1)
                {
                    Byte[] ab = dt.Rows[0]["scriptcode"] as Byte[];
                    if (ab != null)
                    {
                        strCodeRet = Encoding.UTF8.GetString(ab);
                    }
                    else
                    {
                        strCodeRet = string.Empty;
                    }
                    bResult = true;
                }
                else if (dt.Rows.Count > 1)
                {
                    MessageBox.Show("脚本不唯一!请检查数据库");
                }
            }

            return(bResult);
        }
Beispiel #3
0
 public void selectedByIdsNoEvent(string fieldid, string tabid)
 {
     foreach (TreeNode tn in this.m_AllScriptTreeNode)
     {
         tagPlus tp = tn.Tag as tagPlus;
         if (tp.fieldid == fieldid && tp.tabid == tabid)
         {
             //让自己被展开
             expendParent(tn);
             tree.SelectedNode = tn;
             break;
         }
     }
 }
Beispiel #4
0
 public void BoldNode(string fieldid, string tabid, string strcode)
 {
     //让结点变黑
     foreach (TreeNode tn in this.m_AllScriptTreeNode)
     {
         tagPlus tp = tn.Tag as tagPlus;
         if (fieldid == tp.fieldid && tabid == tp.tabid)
         {
             tn.Text     = tn.Text + " ";
             tn.NodeFont = new Font("宋体", 9, FontStyle.Bold);
             tn.Text     = tn.Text.Substring(0, tn.Text.Length - 1);
         }
     }
 }
Beispiel #5
0
        private void raiseEvent(TreeNode tn, object tag)
        {
            treeEventArgs tea     = new treeEventArgs();
            tagPlus       tp      = tn.Tag as tagPlus;
            string        strCode = "";

            if (tp.nDeep >= 2)
            {
                //模块级代码
                string    sql = "select * from sys_scriptstore where fieldid=" + tp.fieldid + " and modtabid=" + tp.tabid;
                DataTable dt  = sqlDB.ExeSqlDs(sql, "script").Tables[0];
                if (dt.Rows.Count > 1)
                {
                    MessageBox.Show("脚本不唯一!请检查数据库");
                    return;
                }
                if (dt.Rows.Count == 0)
                {
                    strCode = "";
                }
                else
                {
                    Byte[] ab = dt.Rows[0]["scriptcode"] as Byte[];
                    if (ab != null)
                    {
                        strCode = Encoding.UTF8.GetString(ab);
                    }
                }
            }
            else
            {
                return;
            }
            tea.scriptCode = strCode;
            tea.scriptPath = tp.stag;
            tea.fieldid    = tp.fieldid;
            tea.tabid      = tp.tabid;
            tea.tag        = tag;
            if (SelectedScriptNode != null)
            {
                SelectedScriptNode(this, tea);
            }
        }