Пример #1
0
 private void BindChType(int chType)
 {
     int ChTypeDicID = 1;
     B_Dictionary dicBll = new B_Dictionary();
     DataTable dt = dicBll.GetDictionary(ChTypeDicID);
     ddlChType.DataTextField = "dicname";
     ddlChType.DataValueField = "id";
     ddlChType.DataSource = dt.DefaultView;
     ddlChType.DataBind();
     ddlChType.Items.Add(new ListItem("其他","0"));
     dt.Dispose();
     try
     {
         ddlChType.SelectedValue = chType.ToString();
     }
     catch { }
 }
Пример #2
0
 private void BindModelList()
 {
     int chType = 1;
     B_Dictionary dictionBll = new B_Dictionary();
     DataTable chTypeDt = dictionBll.GetDictionary(chType);
     repModelList.DataSource = chTypeDt;
     repModelList.DataBind();
     chTypeDt.Dispose();
 }
Пример #3
0
    private void Bind()
    {
        int ChType = 1;
        B_Dictionary dictionBll = new B_Dictionary();
        DataTable chTypeDt = dictionBll.GetDictionary(ChType);

        for (int i = 0; i < chTypeDt.Rows.Count; i++)
        {
            TreeNode chTypeNode = new TreeNode();
            chTypeNode.ToolTip = "分类右键操作$" + chTypeDt.Rows[i]["id"].ToString();
            chTypeNode.Text = chTypeDt.Rows[i]["DicName"].ToString();
            chTypeNode.ImageUrl = "~/system/images/category.gif";
            chTypeNode.NavigateUrl = "~/system/info/ChannelList.aspx?ChType=" + chTypeDt.Rows[i]["id"].ToString();
            chTypeNode.Target = "ContentIframe";
            tvNav.Nodes.Add(chTypeNode);
        }
        TreeNode chTypeOtherNode = new TreeNode();
        chTypeOtherNode.ToolTip = "分类右键操作$0";
        chTypeOtherNode.Text = "其他";
        chTypeOtherNode.ImageUrl = "~/system/images/category.gif";
        chTypeOtherNode.NavigateUrl = "~/system/info/ChannelList.aspx?ChType=0";
        chTypeOtherNode.Target = "ContentIframe";
        tvNav.Nodes.Add(chTypeOtherNode);

        B_Channel channelBll = new B_Channel();
        B_Column columnBll = new B_Column();
        DataView channelDv = channelBll.GetList(false);

        for (int i = 0; i < tvNav.Nodes.Count-1; i++)
        {
            int chType = int.Parse(chTypeDt.Rows[i]["id"].ToString());

            DataTable chDt = channelDv.ToTable();

            DataView chTypeDv = new DataView(chDt);
            chTypeDv.RowFilter=string.Format("[chtype]={0}",chType);
            for (int j = 0; j < chTypeDv.Count; j++)
            {
                TreeNode channelNode = new TreeNode();
                channelNode.ToolTip = "频道右键操作$" + chTypeDv[j]["ChId"].ToString() + "$" + chTypeDv[j]["ChType"].ToString();
                channelNode.Text = chTypeDv[j]["ChName"].ToString();
                channelNode.ImageUrl = "~/system/images/folder.gif";
                channelNode.NavigateUrl = "~/system/info/ColumnList.aspx?ChId=" + chTypeDv[j]["ChId"];
                channelNode.Target = "ContentIframe";
                tvNav.Nodes[i].ChildNodes.Add(channelNode);
            }

            for (int j = 0; j < chTypeDv.Count; j++)
            {
                DataView dv = columnBll.GetColumnListByChannelId((int)chTypeDv[j]["ChId"]);
                DataTable dt = dv.ToTable();
                dv.Dispose();
                BindColumn(0, tvNav.Nodes[i].ChildNodes[j], dt, (int)chTypeDv[j]["ModelType"], (int)chTypeDv[j]["ChId"]);
            }
            chDt.Dispose();
            chTypeDv.Dispose();
        }
        DataTable chDt2 = channelDv.ToTable();
        DataView chTypeDv2 = new DataView(chDt2);
        chTypeDv2.RowFilter = "[chtype]=0 or [chtype] is null";
        for (int j = 0; j < chTypeDv2.Count; j++)
        {
            TreeNode channelNode = new TreeNode();
            channelNode.ToolTip = "频道右键操作$" + chTypeDv2[j]["ChId"].ToString() + "$" + chTypeDv2[j]["ChType"].ToString();
            channelNode.Text = chTypeDv2[j]["ChName"].ToString();
            channelNode.ImageUrl = "~/system/images/folder.gif";
            channelNode.NavigateUrl = "~/system/info/ColumnList.aspx?ChId=" + chTypeDv2[j]["ChId"];
            channelNode.Target = "ContentIframe";
            tvNav.Nodes[tvNav.Nodes.Count - 1].ChildNodes.Add(channelNode);
        }
        for (int j = 0; j < chTypeDv2.Count; j++)
        {
            DataView dv = columnBll.GetColumnListByChannelId((int)chTypeDv2[j]["ChId"]);
            DataTable dt = dv.ToTable();
            dv.Dispose();
            BindColumn(0, tvNav.Nodes[tvNav.Nodes.Count - 1].ChildNodes[j], dt, (int)chTypeDv2[j]["ModelType"], (int)chTypeDv2[j]["ChId"]);
        }
        chDt2.Dispose();
        chTypeDv2.Dispose();
    }