Example #1
0
        public static object GetDisplay(object item, BaseMetaData metaData)
        {
            if (item == null)
            {
                return(string.Empty);
            }
            if (metaData == null)
            {
                if (item.GetType() == typeof(string))
                {
                    return(EntityDisplayName.CutLong((string)item));
                }
                else
                {
                    return(item);
                }
            }
            var property = metaData.GetDisplayPropertyMetaData();

            if (property == null || property.ForeignType() == null)
            {
                return(metaData.DisplayProperty().GetOrDefault(x => EntityDisplayName.CutLong(
                                                                   item.GetValue(x.Name).ToString())));
            }

            var obj = property.Info.GetValue(item);

            return(GetDisplay(obj));
        }
Example #2
0
        public override string ToString()
        {
            var str = "Pos: {0} - Name: {1}, IsNew: {2}, IsTransient: {3}".FormatCurrent(
                Position,
                EntityDisplayName.EmptyNull(),
                _initialized ? IsNew.ToString() : "-",
                _initialized ? IsTransient.ToString() : "-");

            return(str);
        }
Example #3
0
 public override string ToString()
 {
     if (Entity == null)
     {
         return(string.Empty);
     }
     return(HtmlControls.Anchor(
                _urlHelper.Action("Edit", Entity.GetType().Name
                                  + Const.Common.ControlPosfix,
                                  new { id = LinqToSqlUtils.GetPK(Entity) }),
                EntityDisplayName
                .CutLong(MetaData.DisplayProperty().GetValue(Entity).ToString())
                ).ToString());
 }