Ejemplo n.º 1
0
        public string GetTitle()
        {
            TEntity entity = TType.GetCustomAttribute <TEntity>();
            string  title  = entity != null ? entity.Value : null;

            return(THelper.Lang(title, TType.Name));
        }
Ejemplo n.º 2
0
        public List <SCompare> Class2Search(string tNamespaceClass)
        {
            var list = new List <SCompare>();

            while (true)
            {
                if (string.IsNullOrEmpty(tNamespaceClass))
                {
                    break;
                }

                Type type = Type.GetType(tNamespaceClass);
                if (type == null)
                {
                    break;
                }

                var propertyList = type.GetProperties();
                foreach (PropertyInfo pro in propertyList)
                {
                    if (PropertyHelper.HasAttribute <TListSearch>(pro))
                    {
                        var title = PropertyHelper.GetTFieldValue(pro, TF.title);
                        title = THelper.Lang(title, pro.Name);
                        SCompare compare = new SCompare(pro.Name, null, null, title);
                        list.Add(compare);
                    }
                }

                break;
            }
            return(list);
        }
Ejemplo n.º 3
0
        protected TFDictionary field2UI(PropertyInfo pro, object value)
        {
            if (PropertyHelper.IsVirtual(pro))
            {
                return(null);
            }

            TFDictionary dict = pro.GetCustomAttributes <TField>()
                                .ToDictionary(p => p.Key, p => p.Value);

            // Reserved return
            if (dict.ContainsKey(TF.reserved))
            {
                return(null);
            }

            // begin fill dictionary
            PropertyHelper.FillTFDictionary(ref dict);

            // tsuper
            var super = dict[TF.super];

            if (super != null && m_super > (TS)super)
            {
                return(null);
            }

            // element
            TElement element = pro.GetCustomAttribute <TElement>();

            if (element == null)
            {
                TE te = PropertyHelper.IsKey(pro) ? TE.hidden : TE.text;
                element = new TElement(te);
            }
            dict[TF.element] = element.Key;

            // dataSource
            dict[TF.dataSource] = element.Value;

            // widget
            string widget;

            switch (element.Key)
            {
            case TE.text:
            case TE.password:
            case TE.url:
            case TE.tel:
                widget = TE.text.ToString();
                break;

            case TE.picture:
                widget = TE.hidden.ToString();
                break;

            default:
                widget = element.Key.ToString();
                break;
            }
            dict[TF.widget] = widget;

            // title
            dict[TF.title] = THelper.Lang(dict[TF.title] as string, pro.Name);

            // name
            dict[TF.name] = pro.Name;

            // value
            THelper.ConvertToUI(element.Key, ref value);
            dict[TF.value] = value;

            return(dict);
        }