public FileStreamResult?DownloadFilePathEmbedded(string rootType, string id, string route, string?rowId) { var type = TypeLogic.GetType(rootType); var propertyRoute = PropertyRoute.Parse(type, route); var primaryKey = PrimaryKey.Parse(id, type); var makeQuery = queryBuilderCache.GetOrAdd(propertyRoute, pr => { if (propertyRoute.Type != typeof(FilePathEmbedded)) { throw new InvalidOperationException($"Route {route} doesn't point to a FilePathEmbedded"); } var mlistRoute = propertyRoute.GetMListItemsRoute() !; if (mlistRoute == null) { return(giGetSimpleQuery.GetInvoker(type)(propertyRoute)); } else { return(giGetMListQuery.GetInvoker(type, mlistRoute.Type)(propertyRoute, mlistRoute)); } }); var fpe = makeQuery(primaryKey, rowId); if (fpe == null) { return(null); } return(GetFileStreamResult(fpe.OpenRead(), fpe.FileName)); }
public ActionResult PropertyRoutes() { string[] routes = JsonConvert.DeserializeObject <string[]>(this.Request["routes"]); var parsed = routes.Select(r => PropertyRoute.Parse(r)).Distinct().ToList(); return(this.JsonNet(HelpLogic.GetPropertyRoutesService(parsed).ToDictionary(a => a.Key.ToString(), a => a.Value))); }
public JsonNetResult Validate(string rootType = null, string propertyRoute = null) { ModifiableEntity mod = this.UntypedExtractEntity(); PropertyRoute route = (rootType.HasText() || propertyRoute.HasText()) ? PropertyRoute.Parse(TypeLogic.GetType(rootType), propertyRoute) : PropertyRoute.Root(mod.GetType()); MappingContext context = mod.UntypedApplyChanges(this, route: route).UntypedValidate(); IEntity ident = context.UntypedValue as IEntity; string newToStr = context.UntypedValue.ToString(); return(context.ToJsonModelState(newToStr)); }
public ActionResult AddNewPart(string rootType, string propertyRoute, string newPartType, string partialViewName) { var type = Navigator.ResolveType(newPartType); PanelPartEmbedded part = new PanelPartEmbedded { StartColumn = 0, Columns = 12, Content = (IPartEntity)Activator.CreateInstance(type), }; PropertyRoute route = PropertyRoute.Parse(TypeLogic.GetType(rootType), propertyRoute); ViewData[GridRepeaterHelper.LastEnd] = 0; return(Navigator.PartialView(this, new TypeContext <PanelPartEmbedded>(part, null, this.Prefix(), route), partialViewName)); }
private List <TranslationRecord> GetTranslationRecords(Type type) { var list = (from k in Request.Form.AllKeys let m = regexRecord.Match(k) where m.Success let route = m.Groups["route"].Value select new TranslationRecord { Culture = CultureInfo.GetCultureInfo(m.Groups["lang"].Value), Key = new LocalizedInstanceKey( PropertyRoute.Parse(type, regexIndexer.Replace(route, "/")), Lite.Parse(m.Groups["instance"].Value), regexIndexer.Match(route).Let(mi => mi.Success ? PrimaryKey.Parse(mi.Groups["num"].Value, type) : (PrimaryKey?)null) ), TranslatedText = Request.Form[k].DefaultText(null), }).ToList(); var master = list.Extract(a => a.Culture.Name == TranslatedInstanceLogic.DefaultCulture.Name).ToDictionary(a => a.Key); list.ForEach(r => r.OriginalText = master.GetOrThrow(r.Key).TranslatedText); return(list); }
public static void Start(string imageFolder, string baseUrl) { if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod())) { HelpUrls.BaseUrl = baseUrl; HelpUrls.ImagesFolder = imageFolder; Navigator.RegisterArea(typeof(HelpClient)); Navigator.AddSettings(new List <EntitySettings> { new EntitySettings <EntityHelpEntity>(), new EntitySettings <QueryHelpEntity>(), new EntitySettings <AppendixHelpEntity>(), new EntitySettings <NamespaceHelpEntity>(), new EmbeddedEntitySettings <PropertyRouteHelpEmbedded>(), new EntitySettings <OperationHelpEntity>(), new EmbeddedEntitySettings <QueryColumnHelpEmbedded>(), }); Navigator.EmbeddedEntitySettings <PropertyRouteHelpEmbedded>().MappingDefault.AsEntityMapping() .SetProperty(a => a.Property, ctx => { var type = ctx.FindParent <EntityHelpEntity>().Value.Type.ToType(); return(PropertyRoute.Parse(type, ctx.Input).ToPropertyRouteEntity()); }); RegisterHelpRoutes(); Common.CommonTask += Common_CommonTask; WidgetsHelper.GetWidget += WidgetsHelper_GetWidget; ButtonBarQueryHelper.RegisterGlobalButtons(ButtonBarQueryHelper_RegisterGlobalButtons); } }
static PropertyRoute ToPropertyRouteImplementation(PropertyRouteEntity route) { return(PropertyRoute.Parse(TypeLogic.EntityToType[route.RootType], route.Path)); }
static PropertyRoute ToPropertyRouteImplementation(PropertyRouteEntity route) { return(PropertyRoute.Parse(TypeLogic.EntityToType.GetOrThrow(route.RootType), route.Path)); }
public static WikiLink LinkParser(string content) { Match m = HelpLogic.HelpLinkRegex.Match(content); if (m.Success) { string letter = m.Groups["letter"].ToString(); string link = m.Groups["link"].ToString(); string text = m.Groups["text"].ToString(); switch (letter) { case WikiFormat.EntityLink: Type t = TypeLogic.TryGetType(link); return(new WikiLink( HelpUrls.EntityUrl(t), text.HasText() ? text : t.NiceName())); case WikiFormat.Hyperlink: return(new WikiLink(link, text)); case WikiFormat.OperationLink: OperationSymbol operation = SymbolLogic <OperationSymbol> .TryToSymbol(link); List <Type> types = OperationLogic.FindTypes(operation).Where(TypeLogic.TypeToEntity.ContainsKey).ToList(); if (types.Count == 1) { return(new WikiLink( HelpUrls.OperationUrl(types[0], operation), text.HasText() ? text : operation.NiceToString())); } else { return(new MultiWikiLink(operation.NiceToString()) { Links = types.Select(currentType => new WikiLink( HelpUrls.OperationUrl(currentType, operation), currentType.NiceName(), operation.NiceToString())).ToList() }); } case WikiFormat.PropertyLink: PropertyRoute route = PropertyRoute.Parse(TypeLogic.TryGetType(link.Before('.')), link.After('.')); while (route.PropertyRouteType == PropertyRouteType.LiteEntity || route.PropertyRouteType == PropertyRouteType.Mixin || route.PropertyRouteType == PropertyRouteType.MListItems) { route = route.Parent; } return(new WikiLink(HelpUrls.PropertyUrl(route), route.PropertyInfo.NiceName())); case WikiFormat.QueryLink: object o = QueryLogic.TryToQueryName(link); if (o as Enum != null) { Enum query = (Enum)o; return(new WikiLink( HelpUrls.QueryUrl(query), text.HasText() ? text : QueryUtils.GetNiceName(query))); } else { Type query = (Type)o; return(new WikiLink( HelpUrls.QueryUrl(query), text.HasText() ? text : QueryUtils.GetNiceName(query))); } case WikiFormat.NamespaceLink: NamespaceHelp nameSpace = HelpLogic.GetNamespaceHelp(link); return(new WikiLink( HelpUrls.NamespaceUrl(link), text.HasText() ? text : link, nameSpace != null ? "" : "unavailable")); case WikiFormat.AppendixLink: AppendixHelp appendix = HelpLogic.GetAppendixHelp(link); return(new WikiLink( HelpUrls.AppendixUrl(link), text.HasText() ? text : link, appendix != null ? "" : "unavailable")); } } return(null); }
public static PropertyRoute ToPropertyRoute(this PropertyRouteEntity route) { return(PropertyRoute.Parse(TypeLogic.DnToType[route.RootType], route.Path)); }