Example #1
0
        /// <summary>
        /// 加载数据到树
        /// </summary>
        private void loadData()
        {
            //模块层
            string  sql = @"select distinct modelname_cn from sys_modl_def";
            DataSet ds  = sqlDB.ExeSqlDs(sql, "sys_modl_def");

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                TreeNodeCollection t    = tree.Nodes[0].Nodes;
                string             text = row["modelname_cn"].ToString();
                TreeNode           tn   = t.Add(text, text);
                sql = string.Format(@"SELECT modtabid
                    FROM (SELECT DISTINCT 
                    sys_modl_def.modelname_cn, sys_modl_tab_def.name, 
                    sys_modl_tab_def.modtabid
                    FROM sys_modl_def INNER JOIN
                    sys_modl_tab_def ON sys_modl_tab_def.modid = sys_modl_def.id) 
                    DERIVEDTBL
                    WHERE (modelname_cn = '{0}')", text);
                ds  = sqlDB.ExeSqlDs(sql, "BiteMe");

                string first_modtabid = string.Empty;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    first_modtabid = ds.Tables[0].Rows[0][0].ToString();
                }
                tn.Tag = new tagPlus(2, text, "-1", first_modtabid);
            }

            //Tab页层
            sql = @"select distinct modelname_cn,name,modtabid 
                    from sys_modl_def 
                    inner join sys_modl_tab_def 
                    on sys_modl_tab_def.modid=sys_modl_def.id     
                    ";
            ds  = sqlDB.ExeSqlDs(sql, "scriptview");
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string             text = row["modelname_cn"].ToString();
                TreeNodeCollection t    = tree.Nodes[0].Nodes;
                t = t[text].Nodes;
                string   name = row["name"].ToString();
                TreeNode tn   = t.Add(text + "->" + name, name);
                tn.Tag = new tagPlus(3, tn.FullPath.ToString(), "0", row["modtabid"].ToString());
                this.m_AllScriptTreeNode.Add(tn);
                sql = @"exec queryFieldInfo " + row["modtabid"].ToString();
                DataTable tabtable = sqlDB.ExeSqlDs(sql, "scriptview").Tables[0];
                fillNode(tabtable, tn, 0);
            }
        }
Example #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);
        }
Example #3
0
        private void fillListBox(ListBox lb, string fieldid, string tabid, string curCode)
        {
            if (this.m_conn == null)
            {
                return;
            }
            SqlDb sdb = new SqlDb();

            sdb.SetConnection(this.m_conn);
            string sql = "";

            if (fieldid == "0")
            {
                sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where (fieldid is NULL or fieldid=0) and modtabid={0} order by logtime", tabid);
            }
            else
            {
                sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where fieldid={0} and modtabid={1} order by logtime", fieldid, tabid);
            }
            DataSet ds = sdb.ExeSqlDs(sql, "script");

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                int     id      = int.Parse(r["logid"].ToString().Trim());
                string  logtime = r["logtime"].ToString().Trim();
                string  reason  = r["reason"].ToString().Trim();
                string  author  = r["author"].ToString().Trim();
                Byte[]  ab      = r["scriptcode"] as Byte[];
                string  strCode = ab == null? "" : Encoding.UTF8.GetString(ab);
                hisItem hi      = new hisItem(id, logtime, strCode, reason, author);
                lb.Items.Add(hi);
            }
            hisItem hi1 = new hisItem(curCode);

            lb.Items.Add(hi1);
        }
Example #4
0
 private void fillListBox(ListBox lb, string fieldid, string tabid, string curCode)
 {
     if (this.m_conn == null) return;
     SqlDb sdb = new SqlDb();
     sdb.SetConnection(this.m_conn);
     string sql = "";
     if(fieldid == "0")
     {
         sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where (fieldid is NULL or fieldid=0) and modtabid={0} order by logtime", tabid);
     }
     else
     {
         sql = string.Format("select logid,scriptcode,logtime,reason,author from sys_scriptstore_log where fieldid={0} and modtabid={1} order by logtime", fieldid, tabid);
     }
     DataSet ds = sdb.ExeSqlDs(sql, "script");
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         int id = int.Parse(r["logid"].ToString().Trim());
         string logtime = r["logtime"].ToString().Trim();
         string reason = r["reason"].ToString().Trim();
         string author = r["author"].ToString().Trim();
         Byte[] ab = r["scriptcode"] as Byte[];
         string strCode = ab == null? "" : Encoding.UTF8.GetString(ab);
         hisItem hi = new hisItem(id, logtime, strCode, reason, author);
         lb.Items.Add(hi);
     }
     hisItem hi1 = new hisItem(curCode);
     lb.Items.Add(hi1);
 }