예제 #1
0
        private void GetHierarchicalChildItem(DataTable _RptsDepartList, ClsMenuInfo clsMenuInfos)
        {
            ClsMenuInfo clsMenuInfo;

            foreach (DataRow dr in _RptsDepartList.Select("MENU_ID_UPPER ='" + clsMenuInfos.id + "'"))
            {
                clsMenuInfo              = new ClsMenuInfo();
                clsMenuInfo.SYS_CODE     = dr["SYS_CODE"].ToString();
                clsMenuInfo.id           = dr["MENU_ID"].ToString();
                clsMenuInfo.MENU_NAME    = dr["MENU_NAME"].ToString();
                clsMenuInfo.parentId     = dr["MENU_ID_UPPER"].ToString();
                clsMenuInfo.MENU_ICON    = dr["MENU_ICON"].ToString();
                clsMenuInfo.MODULE_URL   = dr["MODULE_URL"].ToString();
                clsMenuInfo.MODULE_ROUTE = dr["MODULE_ROUTE"].ToString();
                clsMenuInfo.MODULE_OBJ   = dr["MODULE_OBJ"].ToString();
                clsMenuInfo.MENU_PROP    = dr["MENU_PROP"].ToString();
                clsMenuInfo.MENU_ORDER   = int.Parse(dr["MENU_ORDER"] == null ? "0" : dr["MENU_ORDER"].ToString());
                if (dr["MENU_PROP"].ToString() == "0")
                {
                    clsMenuInfo.disabled = true;
                }
                else
                {
                    clsMenuInfo.disabled = false;
                }
                clsMenuInfo.children = new List <ClsMenuInfo>();
                GetHierarchicalChildItem(_RptsDepartList, clsMenuInfo);
                clsMenuInfo.children = clsMenuInfo.children.OrderBy(o => o.MENU_ORDER).ToList();
                clsMenuInfos.children.Add(clsMenuInfo);
            }
        }
예제 #2
0
 public void GetHierarchicalItem(DataTable _RptsDepartList, List <ClsMenuInfo> clsMenuInfos)
 {
     try
     {
         ClsMenuInfo clsMenuInfo;
         foreach (DataRow dr in _RptsDepartList.Select("MENU_ID_UPPER is null or MENU_ID_UPPER='' "))
         {
             clsMenuInfo              = new ClsMenuInfo();
             clsMenuInfo.SYS_CODE     = dr["SYS_CODE"].ToString();
             clsMenuInfo.id           = dr["MENU_ID"].ToString();
             clsMenuInfo.MENU_NAME    = dr["MENU_NAME"].ToString();
             clsMenuInfo.parentId     = dr["MENU_ID_UPPER"].ToString();
             clsMenuInfo.MENU_ICON    = dr["MENU_ICON"].ToString();
             clsMenuInfo.MODULE_URL   = dr["MODULE_URL"].ToString();
             clsMenuInfo.MODULE_ROUTE = dr["MODULE_ROUTE"].ToString();
             clsMenuInfo.MODULE_OBJ   = dr["MODULE_OBJ"].ToString();
             clsMenuInfo.MENU_PROP    = dr["MENU_PROP"].ToString().Trim();
             clsMenuInfo.MENU_ORDER   = int.Parse(dr["MENU_ORDER"] == null ? "0" : dr["MENU_ORDER"].ToString());
             if (dr["MENU_PROP"].ToString() == "0")
             {
                 clsMenuInfo.disabled = true;
             }
             else
             {
                 clsMenuInfo.disabled = false;
             }
             clsMenuInfo.children = new List <ClsMenuInfo>();
             GetHierarchicalChildItem(_RptsDepartList, clsMenuInfo);
             clsMenuInfo.children = clsMenuInfo.children.OrderBy(o => o.MENU_ORDER).ToList();
             clsMenuInfos.Add(clsMenuInfo);
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }