zoukankan      html  css  js  c++  java
  • DrpList

     private void ShowFolderList()
        {
            drpLegalType1.Items.Clear();
            string LegalTypeName=string.Empty;   

            DataSet ds = FieldType.GetList("t0025");//案件性质类别
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                LegalTypeName = ds.Tables[0].Rows[i]["TypeName"].ToString();
                this.drpLegalType1.Items.Add(new ListItem(LegalTypeName, LegalTypeName));
                addChildFolder(LegalTypeName);
            }
        }

        private void addChildFolder(string parentID)
        {
            string folder = string.Empty;
            string LegalTypeName = string.Empty;
            DataSet ds = FieldType.GetList2(parentID);

            if (ds.Tables[0].Rows.Count != 0)
            {          
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    LegalTypeName = ds.Tables[0].Rows[i]["TypeName"].ToString();
                    folder = "   ├" + LegalTypeName;            
                    this.drpLegalType1.Items.Add(new ListItem(folder, LegalTypeName));
                }
            }
        }
    ---------------------------------------------------------------------------------

    private void ShowFolderList()
      { 
       drpDep.Items.Clear();
       this.drpDep.Items.Add(new ListItem("--选择学院名称--","00"));
       string str="";
        str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID=0";
       DataSet ds=sql.GetDataSet(str);
       for(int i=0;i<ds.Tables[0].Rows.Count;i++)
       {    
        int intSRSID = (int)ds.Tables[0].Rows[i]["SD_ID"];
        string folder = ds.Tables[0].Rows[i]["SD_NAME"].ToString();
        this.drpDep.Items.Add(new ListItem(folder,intSRSID.ToString()));               
        addChildFolder(intSRSID,1);
       }
      }

      private void addChildFolder(int parentID,int layer)
      {   
       string str="";   
       str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID='"+parentID+"'order by SD_PARENTID asc";   
       DataSet ds=sql.GetDataSet(str);   
       if(ds.Tables[0].Rows.Count!=0)
       {
        layer++;
        for(int i=0;i<ds.Tables[0].Rows.Count;i++)
        {
         int intSRSID = (int)ds.Tables[0].Rows[i]["SD_ID"];
         string folder = "├"+ds.Tables[0].Rows[i]["SD_NAME"].ToString();
         for(int j=0;j<layer-1;j++)
         {
          folder =" "+folder;
         }
         this.drpDep.Items.Add(new ListItem(folder,intSRSID.ToString()));    
         if(IsParentID(intSRSID))
          addChildFolder(intSRSID,layer);   
         
        } 
       }
      }
      private bool IsParentID(int ParentID)
      {
       string str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID='"+ParentID+"'";
       DataSet ds=sql.GetDataSet(str);
       if(ds!=null)
       {
        if(ds.Tables[0].Rows.Count!=0)
         return true;
        else
         return false;
       }
       else
        return false;
      }

  • 相关阅读:
    POJ2778 DNA Sequence AC自动机上dp
    codeforces732F Tourist Reform 边双联通分量
    codeforces786B Legacy 线段树优化建图
    洛谷P3588 PUS 线段树优化建图
    codeforces1301D Time to Run 模拟
    codeforces1303B National Project 二分或直接计算
    codeforces1303C Perfect Keyboard 模拟或判断欧拉路
    codeforces1303D Fill The Bag 二进制应用+贪心
    python之路——使用python操作mysql数据库
    python之路——mysql索引原理
  • 原文地址:https://www.cnblogs.com/meiproject/p/928773.html
Copyright © 2011-2022 走看看