示例#1
0
        public List <Model.MenuNavInfo> GetList(string file)
        {
            List <Model.MenuNavInfo> list = null;

            XElement root = XElement.Load(file);
            var      q    = from r in root.Descendants("Add")
                            where r.Parent.Attribute("ID").Value == "Tabs"
                            orderby DateTime.Parse(r.Attribute("CreateDate").Value)
                            select r;

            if (q.Count() > 0)
            {
                list = new List <Model.MenuNavInfo>();
                DateTime maxDt = q.Max(x => DateTime.Parse(x.Attribute("UpdateDate").Value));
                foreach (var item in q)
                {
                    Model.MenuNavInfo model = new Model.MenuNavInfo();
                    model.Href       = item.Attribute("Href").Value;
                    model.Url        = item.Attribute("Url").Value;
                    model.Title      = item.Attribute("Title").Value;
                    model.CreateDate = DateTime.Parse(item.Attribute("CreateDate").Value);
                    model.UpdateDate = DateTime.Parse(item.Attribute("UpdateDate").Value);
                    model.Selected   = maxDt.Equals(model.UpdateDate);
                    list.Add(model);
                }
            }

            return(list);
        }
示例#2
0
        public string TabsClose(string url)
        {
            BLL.MenuNav mnBll = new BLL.MenuNav();
            mnBll.Delete(url, GetMenuNavFile());

            List <Model.MenuNavInfo> list = GetTabs();

            if (list != null && list.Count > 0)
            {
                Model.MenuNavInfo model = list.Find(m => m.UpdateDate == list.Max(mx => mx.UpdateDate));
                if (model != null)
                {
                    return(model.Url);
                }
            }

            return(string.Empty);
        }