예제 #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.ISINVALID      = dr["ISINVALID"].ToString();
                clsOrgInfo.DW_CODE        = dr["DW_CODE"].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;
                }
            }
        }
예제 #2
0
 public void GetHierarchicalItem(DataTable _RptsDepartList, List <ClsOrgInfo> clsOrgInfos, string S_OrgCode)
 {
     try
     {
         ClsOrgInfo clsOrgInfo;
         //foreach (DataRow dr in _RptsDepartList.Select("  ISINVALID='1' and ( ORG_ID_UPPER is null or ORG_ID_UPPER='') "))
         foreach (DataRow dr in _RptsDepartList.Select("ORG_CODE = '" + S_OrgCode + "'"))
         {
             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.ISINVALID      = dr["ISINVALID"].ToString();
             clsOrgInfo.DW_CODE        = dr["DW_CODE"].ToString();
             clsOrgInfo.children       = new List <ClsOrgInfo>();
             GetHierarchicalChildItem(_RptsDepartList, clsOrgInfo);
             clsOrgInfo.children = clsOrgInfo.children.OrderBy(o => o.ORG_CODE).Distinct().ToList();
             clsOrgInfos.Add(clsOrgInfo);
             if (clsOrgInfo.children.Count == 0)
             {
                 clsOrgInfo.children = null;
             }
         }
     }
     catch
     {
     }
 }