public static TagImg Entity(IEntityCommonInfo entity) { if (entity is Employee) { return(Employee(entity.UrlName).Alt(entity.Name)); } return(Image(entity.GetType().Name + "/" + GetTrueUrlName(entity.UrlName) + ".jpg") .Alt(entity.Name)); }
public JsonSection EntityJson(IEntityCommonInfo x) { var tp = x.GetType(); var type = SiteObject.TypeTableNames[tp]; var id = LinqToSqlUtils.GetPK(x); var count = Counts().GetValueOrDefault(Tuple.Create(type, id.ToString())); var name = GetName(type, id); return(new JsonSection(type, id, x.UrlName, count, name)); }
public static List <string> GetGallaryFiles(IEntityCommonInfo entity, string folder) { var gallaryFolder = Urls.SysRoot + Urls.ImageFolder + entity.GetType().Name + "/" + folder + "/" + entity.UrlName; if (!Directory.Exists(gallaryFolder)) { return(new List <string>()); } var files = Directory.GetFiles(gallaryFolder, "*.jpg", SearchOption.AllDirectories); return(files.ToList()); }
string GetUrl(IEntityCommonInfo entity) { var template = "/{0}/{1}"; if (entity is SiteTerm) { template = "/dictionary/definition/{1}"; } if (entity is Product) { template += "-courses"; } return(template.FormatWith(entity.GetType().Name, entity.UrlName).ToLowerInvariant()); }
public static TagBuilder EntitySmall(IEntityCommonInfo entity) { return(Root(entity.GetType().Name + "/Small/" + GetTrueUrlName(entity.UrlName) + ".gif") .Size(70, 70).Class("ico")); }