Exemple #1
0
 public static void Factorial(List <TS_MENUDTO> dtos, List <MENUDTO> newDtos)
 {
     foreach (var o in dtos)
     {
         MENUDTO newDto = new MENUDTO();
         newDto.id   = o.C_ID;
         newDto.text = o.C_NAME;
         newDto.url  = o.C_URL;
         newDto.icon = o.C_ICON;
         newDtos.Add(newDto);
         if (o.Menus.Count > 0)
         {
             Factorial(o.Menus, newDto.menus);
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 前台菜单格式
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="t"></param>
        /// <param name="tt"></param>
        /// <returns></returns>
        public static List <MENUDTO> ConvertMenu(List <TS_MENUDTO> old)
        {
            List <MENUDTO> newDtos = new List <MENUDTO>();

            if (old.Count > 0)
            {
                foreach (var o in old)
                {
                    MENUDTO newDto = new MENUDTO();
                    newDto.id   = o.C_ID;
                    newDto.text = o.C_NAME;
                    newDto.url  = o.C_URL;
                    newDto.icon = o.C_ICON;
                    newDtos.Add(newDto);
                    if (o.Menus.Count > 0)
                    {
                        Factorial(o.Menus, newDto.menus);
                    }
                }
            }
            return(newDtos);
        }