public static String ToAppData(IAppData data, MvcContext ctx) { if (data == null) { return(""); } // 1) html if (ctx != null && ctx.IsMock && ctx.GetItem("_makeHtml") != null) { return(HtmlLink.ToAppData(data)); } String controllerPath = getAppDataController(data.GetType().FullName, data.AppId); // 2) link map String x = LinkMap.To(data.OwnerType, data.OwnerUrl, controllerPath, "Show", data.Id, data.AppId); if (x != null) { return(x); } // 3) return(To(data, controllerPath, "Show", data.Id)); }
/// <summary> /// 获取App的网址。最后的效果包括后缀名,比如 /Forum1/Forum/Index.aspx /// </summary> /// <param name="app"></param> /// <param name="ctx"></param> /// <returns></returns> public static String ToApp(IApp app, MvcContext ctx) { // 1) html if (ctx != null && ctx.IsMock && ctx.GetItem("_makeHtml") != null) { return(HtmlLink.ToApp(app)); } String appName = strUtil.TrimEnd(app.GetType().Name, "App"); // 2) link map String controller = appName + "/" + appName; String x = LinkMap.To(app.OwnerType, app.OwnerUrl, controller, "Index", app.Id); if (x != null) { return(x); } // 3) String ret = getAppLink(app.OwnerType, app.OwnerUrl, appName, app.Id); if (MvcConfig.Instance.IsUrlToLower) { return(ret.ToLower()); } return(ret); }
public static String To(IMember member, aActionWithId action, long id, long appId) { String x = LinkMap.To(member, action, id, appId); if (x != null) { return(x); } String ownerPath = LinkHelper.GetMemberPathPrefix(member); return(LinkHelper.AppendApp(appId, LinkHelper.GetController(action.Target.GetType()), action.Method.Name, id, ownerPath)); }
public static String To(IMember member, String controller, String action, long id, long appId) { String x = LinkMap.To(member, controller, action, id, appId); if (x != null) { return(x); } String ownerPath = LinkHelper.GetMemberPathPrefix(member); return(LinkHelper.AppendApp(appId, controller, action, id, ownerPath)); }
//----------------------------------------------------------------------------------------- public static String ToUserAppFull(IMemberApp app) { String strApp = strUtil.TrimEnd(app.AppInfo.TypeName, "App"); // 1) link map String controller = strApp + "/" + strApp; String x = LinkMap.To(app.OwnerType, app.OwnerUrl, controller, "Index", app.Id); if (x != null) { return(x); } // 2) if (MvcConfig.Instance.IsUrlToLower) { strApp = strApp.ToLower(); } return(getAppLink(app.OwnerType, app.OwnerUrl, strApp, app.AppOid)); }