public override void Render(string requesterUniqueID) { Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); this._IDAccessTree = instance.IDAccessTree; this._CacheID = CacheObject.ProvideUniqueCacheID(this, ref instance); CacheObject cacheObject = null; CachePool.Current.Get(this._IDAccessTree, this._CacheID, out cacheObject); if (cacheObject != null) { this.RenderedValue = cacheObject.Content; return; } Global.ContentDescription contentDescription = new Global.ContentDescription(this.Value); string blockContent = contentDescription.Parts[0]; this.Parse(blockContent); base.Render(requesterUniqueID); }
private void RenderDomainContents() { Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); this.RenderedValue = instance.ContentsVirtualPath; this.ObjectResult = (object)this.RenderedValue; }
public override void Render(string requesterUniqueID) { if (this.IsRendered) { return; } string translationID = this.Value.Split(':')[1]; IDomain instance = null; InstanceRequested?.Invoke(ref instance); this.RenderedValue = instance.Languages.Current.Get(translationID); }
public override void Build() { base.Build(); Basics.Domain.IDomain instance = null; InstanceRequested?.Invoke(ref instance); string renderedValue = this.RenderedValue; this.ExtractSubDirectives(ref renderedValue); if (!this._Cache && string.IsNullOrEmpty(renderedValue)) { throw new Exception.EmptyBlockException(); } object methodResultInfo = Manager.AssemblyCore.ExecuteStatement(instance.IDAccessTree, this.ControlID, renderedValue, this.RenderParameters(), this._Cache); if (methodResultInfo != null && methodResultInfo is System.Exception) { throw new Exception.ExecutionException(((System.Exception)methodResultInfo).Message, ((System.Exception)methodResultInfo).InnerException); } if (methodResultInfo != null) { string renderResult = string.Empty; if (methodResultInfo is Basics.ControlResult.RedirectOrder) { Helpers.Context.AddOrUpdate("RedirectLocation", ((Basics.ControlResult.RedirectOrder)methodResultInfo).Location); } else { renderResult = Manager.AssemblyCore.GetPrimitiveValue(methodResultInfo); } this.RenderedValue = renderResult; return; } this.RenderedValue = string.Empty; }
public override IController Find(string controlID) { IDomain instance = null; InstanceRequested?.Invoke(ref instance); IDomain workingInstance = instance; if (!this.CheckIsAuthenticated(ref instance, ref workingInstance)) { return(null); } string templateContent = this.LoadTemplate(ref workingInstance); this.RenderedValue = templateContent; return(base.Find(controlID)); }
public override void Render(string requesterUniqueID) { // Template should always included with security check in render process in UpdateBlockRequest because // UpdateBlock can be located under a template included in another template IDomain instance = null; InstanceRequested?.Invoke(ref instance); IDomain workingInstance = instance; if (!this.CheckIsAuthenticated(ref instance, ref workingInstance)) { this.RenderedValue = "<div style='width:100%; font-weight:bolder; color:#CC0000; text-align:center'>" + SystemMessages.TEMPLATE_AUTH + "!</div>"; return; } this.RenderInternal(ref workingInstance, requesterUniqueID); }
public object[] RenderParameters() { if (string.IsNullOrEmpty(this._ParametersDefinition)) { return(null); } List <object> parameters = new List <object>(); string[] paramDefs = this._ParametersDefinition.Split('|'); foreach (string paramDef in paramDefs) { Property property = new Property(0, paramDef, this.Parent.ContentArguments); property.Mother = this.Mother; property.Parent = this.Parent; property.InstanceRequested += (ref Basics.Domain.IDomain instance) => InstanceRequested?.Invoke(ref instance); property.Setup(); property.Render(null); parameters.Add(property.ObjectResult); } return(parameters.ToArray()); }
protected override void RenderControl(string requesterUniqueID) { Global.ContentDescription contentDescription = new Global.ContentDescription(this.Value); string blockContent = contentDescription.Parts[0]; // Call Related Function and Exam It IController leveledController = this; int level = this.Leveling.Level; do { if (level == 0) { break; } leveledController = leveledController.Parent; if (leveledController is Renderless) { leveledController = leveledController.Parent; } level -= 1; } while (leveledController != null); // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters this.Bind.Parameters.Prepare( (parameter) => { Property property = new Property(0, parameter.Query, (leveledController.Parent == null ? null : leveledController.Parent.ContentArguments)); property.Mother = leveledController.Mother; property.Parent = leveledController.Parent; property.InstanceRequested += (ref IDomain instance) => InstanceRequested?.Invoke(ref instance); property.Setup(); property.Render(requesterUniqueID); return(property.ObjectResult); } ); Basics.Execution.InvokeResult <Basics.ControlResult.VariableBlock> invokeResult = Manager.AssemblyCore.InvokeBind <Basics.ControlResult.VariableBlock>(Basics.Helpers.Context.Request.Header.Method, this.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exception.ExecutionException(invokeResult.Exception.Message, invokeResult.Exception.InnerException); } // ---- if (!this.Leveling.ExecutionOnly) { this.ContentArguments.Replace(leveledController.ContentArguments); } if (invokeResult.Result != null) { foreach (string key in invokeResult.Result.Keys) { this.ContentArguments.AppendKeyWithValue(key, invokeResult.Result[key]); } } // Just parse the children to be accessable in search this.Parse(blockContent); if (!this.Leveling.ExecutionOnly) { this.RenderedValue = ControllerHelper.RenderSingleContent(blockContent, leveledController, this.ContentArguments, requesterUniqueID); } else { this.RenderedValue = ControllerHelper.RenderSingleContent(blockContent, this, this.ContentArguments, requesterUniqueID); } this.Mother.Scheduler.Fire(this.ControlID); }
public void RequestInstance(out IDomain instance) { instance = null; InstanceRequested?.Invoke(out instance); }
protected override void RenderControl(string requesterUniqueID) { Global.ContentDescription contentDescription = new Global.ContentDescription(this.Value); // ConditionalStatment does not have any ContentArguments, That's why it copies it's parent Arguments if (this.Parent != null) { this.ContentArguments.Replace(this.Parent.ContentArguments); } string contentTrue = contentDescription.Parts[0]; string contentFalse = string.Empty; if (contentDescription.Parts.Count > 1) { contentFalse = contentDescription.Parts[1]; } // Call Related Function and Exam It IController leveledController = this; int level = this.Leveling.Level; do { if (level == 0) { break; } leveledController = leveledController.Parent; if (leveledController is Renderless) { leveledController = leveledController.Parent; } level -= 1; } while (leveledController != null); // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters this.Bind.Parameters.Prepare( (parameter) => { Property property = new Property(0, parameter.Query, (leveledController.Parent == null ? null : leveledController.Parent.ContentArguments)); property.Mother = leveledController.Mother; property.Parent = leveledController.Parent; property.InstanceRequested += (ref IDomain instance) => InstanceRequested?.Invoke(ref instance); property.Setup(); property.Render(requesterUniqueID); return(property.ObjectResult); } ); Basics.Execution.InvokeResult <Basics.ControlResult.Conditional> invokeResult = Manager.AssemblyCore.InvokeBind <Basics.ControlResult.Conditional>(Basics.Helpers.Context.Request.Header.Method, this.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exception.ExecutionException(invokeResult.Exception.Message, invokeResult.Exception.InnerException); } // ---- if (invokeResult.Result != null) { switch (invokeResult.Result.Result) { case Basics.ControlResult.Conditional.Conditions.True: if (!string.IsNullOrEmpty(contentTrue)) { if (!this.Leveling.ExecutionOnly) { this.ContentArguments.Replace(leveledController.ContentArguments); // Just parse the children to be accessable in search this.Parse(contentTrue); this.RenderedValue = ControllerHelper.RenderSingleContent(contentTrue, leveledController, this.ContentArguments, requesterUniqueID); } else { // Just parse the children to be accessable in search this.Parse(contentTrue); this.RenderedValue = ControllerHelper.RenderSingleContent(contentTrue, this, this.ContentArguments, requesterUniqueID); } } break; case Basics.ControlResult.Conditional.Conditions.False: if (!string.IsNullOrEmpty(contentFalse)) { if (!this.Leveling.ExecutionOnly) { this.ContentArguments.Replace(leveledController.ContentArguments); // Just parse the children to be accessable in search this.Parse(contentFalse); this.RenderedValue = ControllerHelper.RenderSingleContent(contentFalse, leveledController, this.ContentArguments, requesterUniqueID); } else { // Just parse the children to be accessable in search this.Parse(contentFalse); this.RenderedValue = ControllerHelper.RenderSingleContent(contentFalse, this, this.ContentArguments, requesterUniqueID); } } break; case Basics.ControlResult.Conditional.Conditions.Unknown: // Reserved For Future Uses break; } } this.Mother.Scheduler.Fire(this.ControlID); }
private void RenderInternal(string requesterUniqueID) { string[] controlValueSplitted = this.Value.Split(':'); // Call Related Function and Exam It IController leveledController = this; int level = this.Leveling.Level; do { if (level == 0) { break; } leveledController = leveledController.Parent; if (leveledController is Renderless) { leveledController = leveledController.Parent; } level -= 1; } while (leveledController != null); Basics.Execution.Bind bind = Basics.Execution.Bind.Make(string.Join(":", controlValueSplitted, 1, controlValueSplitted.Length - 1)); // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters bind.Parameters.Prepare( (parameter) => { Property property = new Property(0, parameter.Query, (leveledController.Parent == null ? null : leveledController.Parent.ContentArguments)); property.Mother = leveledController.Mother; property.Parent = leveledController.Parent; property.InstanceRequested += (ref Basics.Domain.IDomain instance) => InstanceRequested?.Invoke(ref instance); property.Setup(); property.Render(requesterUniqueID); return(property.ObjectResult); } ); Basics.Execution.InvokeResult <object> invokeResult = Manager.AssemblyCore.InvokeBind <object>(Basics.Helpers.Context.Request.Header.Method, bind, Manager.ExecuterTypes.Other); if (invokeResult.Exception != null) { throw new Exception.ExecutionException(invokeResult.Exception.Message, invokeResult.Exception.InnerException); } if (invokeResult.Result != null && invokeResult.Result is Basics.ControlResult.RedirectOrder) { Helpers.Context.AddOrUpdate("RedirectLocation", ((Basics.ControlResult.RedirectOrder)invokeResult.Result).Location); this.RenderedValue = string.Empty; return; } this.RenderedValue = Manager.AssemblyCore.GetPrimitiveValue(invokeResult.Result); }
protected override void RenderControl(string requesterUniqueID) { Global.ContentDescription contentDescription = new Global.ContentDescription(this.Value); // Reset Variables Basics.Helpers.VariablePool.Set(this.ControlID, null); // Call Related Function and Exam It IController leveledController = this; int level = this.Leveling.Level; do { if (level == 0) { break; } leveledController = leveledController.Parent; if (leveledController is Renderless) { leveledController = leveledController.Parent; } level -= 1; } while (leveledController != null); // Execution preparation should be done at the same level with it's parent. Because of that, send parent as parameters this.Bind.Parameters.Prepare( (parameter) => { Property property = new Property(0, parameter.Query, (leveledController.Parent == null ? null : leveledController.Parent.ContentArguments)); property.Mother = leveledController.Mother; property.Parent = leveledController.Parent; property.InstanceRequested += (ref IDomain instance) => InstanceRequested?.Invoke(ref instance); property.Setup(); property.Render(requesterUniqueID); return(property.ObjectResult); } ); Basics.Execution.InvokeResult <Basics.ControlResult.IDataSource> invokeResult = Manager.AssemblyCore.InvokeBind <Basics.ControlResult.IDataSource>(Basics.Helpers.Context.Request.Header.Method, this.Bind, Manager.ExecuterTypes.Control); if (invokeResult.Exception != null) { throw new Exception.ExecutionException(invokeResult.Exception.Message, invokeResult.Exception.InnerException); } Basics.Helpers.VariablePool.Set(this.ControlID, new Global.DataListOutputInfo(this.UniqueID, 0, 0)); switch (invokeResult.Result.Type) { case Basics.ControlResult.DataSourceTypes.DirectDataAccess: this.RenderDirectDataAccess(requesterUniqueID, invokeResult, contentDescription); break; case Basics.ControlResult.DataSourceTypes.ObjectFeed: this.RenderObjectFeed(requesterUniqueID, invokeResult, contentDescription); break; case Basics.ControlResult.DataSourceTypes.PartialDataTable: this.RenderPartialDataTable(requesterUniqueID, invokeResult, contentDescription); break; } // ---- this.Mother.Scheduler.Fire(this.ControlID); }