Exemplo n.º 1
0
        public MasterPageObj GetById(string name)
        {
            MasterPageObj result = new MasterPageObj();
            MasterPageObjFilter filter = new MasterPageObjFilter();
            filter.Name = name;
            List<MasterPageObj> list = new MasterPagesObjManager().GetByFilter(filter);
            if (list.Count > 0)
                result = list[0];

            return result;
        }
Exemplo n.º 2
0
        public List<MasterPageObj> GetByFilter(MasterPageObjFilter filter)
        {
            List<MasterPageObj> result = new List<MasterPageObj>();
            string searchString = "*.master";
            string filespath = Config.MasterPagesPath;
            filespath = HttpContext.Current.Request.MapPath(filespath);
            DirectoryInfo dir = new DirectoryInfo(filespath);

            if (!string.IsNullOrEmpty(filter.Name))
                searchString = filter.Name + ".master";

            if (dir.Exists)
            {
                FileInfo[] files = dir.GetFiles(searchString);
                foreach (FileInfo file in files)
                {
                    MasterPageObj item = new MasterPageObj();
                    item.Name = file.Name.Replace(".master", "");
                    result.Add(item);
                }
            }
            return result;
        }