Пример #1
0
        /// <summary>
        /// 返回映射中的指定字段名称值
        /// </summary>
        /// <param name="hepler"></param>
        /// <param name="itype"></param>
        /// <param name="ReturnKey"></param>
        /// <returns></returns>
        public static string Comm_Map_Name(this HtmlHelper hepler, string ModuleCode, string itype, string ReturnKey)
        {
            string  name  = "";
            Sys_Map model = new Sys_Map();

            if (!string.IsNullOrEmpty(itype))
            {
                //开启Session缓存映射数据
                //if (SessionConfig.GetSession("ITYPE") == null)
                //{
                ADOSys_Map MapInstance = new ADOSys_Map();
                var        result      = MapInstance.GetAll();
                SessionConfig.SetSession("ITYPE", result);
                //}
                List <Sys_Map> list = (List <Sys_Map>)SessionConfig.GetSession("ITYPE");
                PropertyDescriptorCollection pList = TypeDescriptor.GetProperties(typeof(Sys_Map));
                var filterList = list.Where(o => o.Map_Source == itype &&
                                            o.Map_Module == ModuleCode);

                if (list != null && filterList != null && filterList.Count() > 0)
                {
                    model = filterList.FirstOrDefault();
                    name  = pList[ReturnKey] != null ? pList[ReturnKey].GetValue(model).ToString() : "";
                }
            }
            return(name);
        }
Пример #2
0
        /// <summary>
        /// 获取所有的信息
        /// </summary>
        /// <returns>list</returns>
        public List <Sys_Map> GetAll()
        {
            List <Sys_Map> list = instance.GetAll();

            return(list);
        }