Exemplo n.º 1
0
        private void GetHierarchicalChildItem(DataTable _RptsDepartList, ClsOrgInfo clsOrgInfos)
        {
            ClsOrgInfo clsOrgInfo;

            foreach (DataRow dr in _RptsDepartList.Select("ORG_ID_UPPER ='" + clsOrgInfos.id + "'"))
            {
                clsOrgInfo                = new ClsOrgInfo();
                clsOrgInfo.ORG_CODE       = dr["ORG_CODE"].ToString();
                clsOrgInfo.id             = dr["ORG_ID"].ToString();
                clsOrgInfo.ORG_NAME       = dr["ORG_NAME"].ToString();
                clsOrgInfo.parentId       = dr["ORG_ID_UPPER"].ToString();
                clsOrgInfo.ORG_SHORT_NAME = dr["ORG_SHORT_NAME"].ToString();
                clsOrgInfo.ORG_CODE_UPPER = dr["ORG_CODE_UPPER"].ToString();
                clsOrgInfo.PHONE          = dr["PHONE"].ToString();
                clsOrgInfo.ISINVALID      = dr["ISINVALID"].ToString();

                clsOrgInfo.children = new List <ClsOrgInfo>();
                GetHierarchicalChildItem(_RptsDepartList, clsOrgInfo);
                clsOrgInfo.children = clsOrgInfo.children.OrderBy(o => o.ORG_CODE).ToList();
                clsOrgInfos.children.Add(clsOrgInfo);
                if (clsOrgInfo.children.Count == 0)
                {
                    clsOrgInfo.children = null;
                }
            }
        }
Exemplo n.º 2
0
 public void GetHierarchicalItem(DataTable _RptsDepartList, List <ClsOrgInfo> clsOrgInfos)
 {
     try
     {
         ClsOrgInfo clsOrgInfo;
         foreach (DataRow dr in _RptsDepartList.Select("  ISINVALID='1' and ( ORG_ID_UPPER is null or ORG_ID_UPPER='') "))
         {
             clsOrgInfo                = new ClsOrgInfo();
             clsOrgInfo.ORG_CODE       = dr["ORG_CODE"].ToString();
             clsOrgInfo.id             = dr["ORG_ID"].ToString();
             clsOrgInfo.ORG_NAME       = dr["ORG_NAME"].ToString();
             clsOrgInfo.parentId       = dr["ORG_ID_UPPER"].ToString();
             clsOrgInfo.ORG_SHORT_NAME = dr["ORG_SHORT_NAME"].ToString();
             clsOrgInfo.ORG_CODE_UPPER = dr["ORG_CODE_UPPER"].ToString();
             clsOrgInfo.PHONE          = dr["PHONE"].ToString();
             clsOrgInfo.ISINVALID      = dr["ISINVALID"].ToString();
             clsOrgInfo.children       = new List <ClsOrgInfo>();
             GetHierarchicalChildItem(_RptsDepartList, clsOrgInfo);
             clsOrgInfo.children = clsOrgInfo.children.OrderBy(o => o.ORG_CODE).ToList();
             clsOrgInfos.Add(clsOrgInfo);
             if (clsOrgInfo.children.Count == 0)
             {
                 clsOrgInfo.children = null;
             }
         }
     }
     catch
     {
     }
 }