Exemple #1
0
        private static Collection <AdminSideMenu> ReadChildNodes(XElement root)
        {
            Collection <AdminSideMenu> childNodes = new Collection <AdminSideMenu>();

            foreach (var p in root.Elements("Menu").Where(p => string.IsNullOrWhiteSpace(p.Attribute("Country")?.Value) ||
                                                          p.Attribute("Country")?.Value == Codehelper.DefaultCountry))
            {
                AdminSideMenu menu = new AdminSideMenu
                {
                    Code            = p.Attribute("Code")?.Value,
                    Name            = p.Attribute("Name")?.Value,
                    Icon            = p.Attribute("Icon")?.Value,
                    Action          = p.Attribute("Action")?.Value,
                    Controller      = p.Attribute("Controller")?.Value,
                    Area            = p.Attribute("Area")?.Value,
                    AppendWarehouse = bool.Parse(p.Attribute("AppendWarehouse")?.Value ?? "false"),
                    DropSwitch      = bool.Parse(p.Attribute("DropSwitch")?.Value ?? "false"),
                    Inframe         = bool.Parse(p.Attribute("Inframe")?.Value ?? "false"),
                    FullScreen      = bool.Parse(p.Attribute("FullScreen")?.Value ?? "false"),
                    ChildNodes      = ReadChildNodes(p),
                    Type            = SideItemType.Page
                };
                childNodes.Add(menu);
            }
            return(childNodes);
        }
 public static AdminSideMenuInfo CreateFrom(AdminSideMenu sm)
 {
     return(new AdminSideMenuInfo
     {
         Type = sm.Type,
         Inframe = sm.Inframe,
         DropSwitch = sm.DropSwitch,
         Area = sm.Area,
         Code = sm.Code,
         Name = sm.Name,
         Icon = sm.Icon,
         Action = sm.Action,
         Controller = sm.Controller,
         AppendWarehouse = sm.AppendWarehouse,
         FullScreen = sm.FullScreen
     });
 }