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; }
public Dictionary<string, string> GetList() { Dictionary<string, string> res = new Dictionary<string, string>(); MasterPageObjFilter filter = new MasterPageObjFilter(); List<MasterPageObj> list = GetByFilter(filter); foreach (MasterPageObj item in list) { res.Add(item.Name, item.Name); } return res; }
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; }