コード例 #1
0
        /// <summary>
        /// 公司组织树
        /// </summary>
        private void BindTree()
        {
            string strSql = "select '0' as ftype, c.com_id as id,c.parent_id,'' as ocom_id,c.com_code as code,c.com_name as name from tb_company c where c.enable_flag ='1' union all "
                            + "select '1' as ftype, o.org_id as id,o.parent_id,o.com_id as ocom_id,o.org_code as code,o.org_name as name from tb_company c,tb_organization o where  "
                            + " c.enable_flag ='1' and o.enable_flag='1' and c.com_id=o.com_id ";

            SYSModel.SQLObj sqlobj = new SYSModel.SQLObj();
            sqlobj.cmdType   = CommandType.Text;
            sqlobj.Param     = new Dictionary <string, SYSModel.ParamObj>();
            sqlobj.sqlString = strSql;
            DataSet ds = DBHelper.GetDataSet("查询公司组织树", sqlobj);

            tvCompany.Nodes.Clear();
            //节点加上去
            if (ds.Tables[0].Rows.Count > 0)
            {
                //clsGetTree cls = new clsGetTree();
                CommonCtrl.InitTree(this.tvCompany.Nodes, "-1", ds.Tables[0].DefaultView);
                if (tvCompany.Nodes.Count > 0)
                {
                    tvCompany.Nodes[0].Expand();
                    tvCompany.SelectedNode = tvCompany.Nodes[0];
                }
            }
        }
コード例 #2
0
        /// <summary> 公司组织树
        /// </summary>
        private void BindTree()
        {
            tvCompany.Nodes.Clear();
            string strSql = "select '0' as ftype, c.com_id as id,c.parent_id,'' as ocom_id,c.com_code as code,c.com_name as name from tb_company c where c.enable_flag ='1' and (c.data_source is null or c.data_source!=" + DataSources.EnumDataSources.YUTONG.ToString("d") + ") union all "
                            + "select '1' as ftype, o.org_id as id,o.parent_id,o.com_id as ocom_id,o.org_code as code,o.org_name as name from tb_company c,tb_organization o where  "
                            + " c.enable_flag ='1' and o.enable_flag='1' and c.com_id=o.com_id ";

            SYSModel.SQLObj sqlobj = new SYSModel.SQLObj();
            sqlobj.cmdType   = CommandType.Text;
            sqlobj.Param     = new Dictionary <string, SYSModel.ParamObj>();
            sqlobj.sqlString = strSql;
            DataSet ds = DBHelper.GetDataSet("查询公司组织树", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj);
            //DataTable dt = DBHelper.GetTable("获取根公司", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "tb_company", "*", "data_source=" + DataSources.EnumDataSources.YUTONG.ToString("d"), "", "");
            string rootid = "-1";

            tvCompany.Nodes.Add(rootid, "所有");
            //节点加上去
            if (ds.Tables[0].Rows.Count > 0)
            {
                CommonCtrl.InitTree(tvCompany.Nodes[0].Nodes, rootid, ds.Tables[0].DefaultView);
            }
            if (tvCompany.Nodes.Count > 0)
            {
                tvCompany.Nodes[0].Expand();
                tvCompany.SelectedNode = tvCompany.Nodes[0];

                tvCompany.SelectedNode.Expand();
            }
        }
コード例 #3
0
        /// <summary> 绑定功能菜单树tree 
        /// </summary>
        private void bindTree()
        {
            string    fileds = "fun_id as id,fun_name as name,parent_id,fun_idx,fun_run,fun_level";
            DataTable dt     = DBHelper.GetTable("查询功能菜单", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_function", fileds, "enable_flag='1' and fun_flag='1' and fun_cbs='1'", "", "order by fun_idx");//fun_level<=3 and

            CommonCtrl.InitTree(tvFunction.Nodes, "-1", dt.DefaultView);
            tvFunction.ExpandAll();
        }
コード例 #4
0
        private void bindTree()
        {
            string    fileds = "fun_id as id,fun_name as name,parent_id,fun_idx,fun_run,fun_level";
            DataTable dt     = DBHelper.GetTable("查询功能菜单", "sys_function", fileds, "enable_flag='1' and fun_flag='1' and fun_cbs='2'", "", "order by fun_idx");//fun_level<=3 and

            CommonCtrl.InitTree(tvFunction.Nodes, "-1", dt.DefaultView);
            if (this.tvFunction.Nodes.Count > 0)
            {
                this.tvFunction.Nodes[0].Expand();
            }
        }
コード例 #5
0
        /// <summary>
        /// 公司组织树
        /// </summary>
        private void BindTree()
        {
            string strSql = "select '0' as ftype, c.com_id as id,c.parent_id,'' as ocom_id,c.com_code as code,c.com_name as name from tb_company c where c.enable_flag ='1' union all "
                            + "select '1' as ftype, o.org_id as id,o.parent_id,o.com_id as ocom_id,o.org_code as code,o.org_name as name from tb_company c,tb_organization o where  "
                            + " c.enable_flag ='1' and o.enable_flag='1' and c.com_id=o.com_id ";

            SYSModel.SQLObj sqlobj = new SYSModel.SQLObj();
            sqlobj.cmdType   = CommandType.Text;
            sqlobj.Param     = new Dictionary <string, SYSModel.ParamObj>();
            sqlobj.sqlString = strSql;
            dscom            = DBHelper.GetDataSet("查询公司组织树", sqlobj);

            tvCompany.Nodes.Clear();
            TreeNode tmpNd = new TreeNode();

            //获取根公司信息
            DataTable comDT = DBHelper.GetTable("获取根公司", GlobalStaticObj.CommAccCode, "tb_company", "*", " data_source='" + DataSources.EnumDataSources.YUTONG.ToString("d") + "'", string.Empty, string.Empty);

            if (comDT != null && comDT.Rows.Count > 0)
            {
                tmpNd.Text = comDT.Rows[0]["com_name"].ToString(); //name
                tmpNd.Name = comDT.Rows[0]["com_id"].ToString();   //id
            }
            else
            {
                tmpNd.Text = "全部";   //name
                tmpNd.Name = "Root"; //id
            }
            tvCompany.Nodes.Add(tmpNd);
            //节点加上去
            if (dscom != null && dscom.Tables[0].Rows.Count > 0)
            {
                //clsGetTree cls = new clsGetTree();
                //CL_ROOT
                //CommonCtrl.InitTree(this.tvCompany.Nodes, "-1", ds.Tables[0].DefaultView);
                CommonCtrl.InitTree(tmpNd.Nodes, "-1", dscom.Tables[0].DefaultView);
                if (tvCompany.Nodes.Count > 0)
                {
                    tvCompany.Nodes[0].Expand();
                    tvCompany.SelectedNode = tvCompany.Nodes[0];
                }
            }
        }