//A. Page in motion (DO SOMETHING) public override async Task <JObject> Action() { #region 1. INPUTS #region DEFINE parameter inputs SingleParmPoco_12_2_1_0 storedInputs = null; #endregion #region DEFINE html details dynamic storedHtmlContainerJSON = ""; dynamic storedHtmlRowsJSON = ""; dynamic storedHtmlColumnsJSON = ""; dynamic storedHtmlContentJSON = ""; dynamic storedHtmlStylesFiltered = ""; dynamic storedHtmlStylesJSON = ""; string storedHtmlResultInlineStylesString = ""; string storedHtmlResultString = ""; #endregion #region MEMORIZE developer mode bool storedProcessRequestDeveloperMode = _storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") ? _storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") : false; SingleParmPoco_12_2_1_0 storedProcessRequestDeveloperLoggingInputs = new SingleParmPoco_12_2_1_0(); //REQUIRED storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequest3WordDescription", "CONVERTING json to html"); //storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterInputRequestActionName", _parameterInputs.Parameters.getValue("parameterInputRequestActionName")); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestTracker["storedProcessRequestSettings"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestFileName", "Director_Of_WebDevelopment_Chapter_12_3_Page_6_OutputHomeScreen_Handler_1_0 -> Page_6_5_Process_StorySetting_12_3_1_0.cs"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestMethodName", "Action"); //OPTIONAL //storedProcessRequestDeveloperLoggingInputs.Parameters.setValue("parameterOPTIONALIgnoreDeveloperConsoleLog", parameterInputs.Parameters["parameterOPTIONALIgnoreDeveloperConsoleLog")); #endregion #region MEMORIZE observation details storedInputs = new SingleParmPoco_12_2_1_0(); string storedOutputResponseObservationPresentationTemplateItem = @"{ 'htmlResult': '{htmlResult}' }"; string storedOutputResponseObservationBusinessTemplateItem = "{}"; string storedOutputResponseObservationServiceTemplateItem = "{}"; string storedOutputResponseObservationSecurityTemplateItem = "{}"; string storedOutputResponseObservationDataTemplateItem = "{}"; storedInputs.Parameters.Add("parameterProcessRequest3WordDescription", "RENDER web page"); storedInputs.Parameters.Add("parameterInputRequestActionName", _storedInputRequestActionName); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterOutputResponseObservationFileName", "Page_6_5_Process_StorySetting_12_3_1_0.cs"); storedInputs.Parameters.Add("parameterOutputResponseObservationMethodName", "Action"); storedInputs.Parameters.Add("parameterOutputResponseObservationPresentationTemplate", storedOutputResponseObservationPresentationTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationBusinessTemplate", storedOutputResponseObservationBusinessTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationServiceTemplate", storedOutputResponseObservationServiceTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationSecurityTemplate", storedOutputResponseObservationSecurityTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationDataTemplate", storedOutputResponseObservationDataTemplateItem); string storedOutputResponseObservationItem = await Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Output_JsonObservationNode_1_0(storedInputs); #endregion #region MEMORIZE storyline details dynamic storedProcessRequestDataStorylineDetails = _storedProcessRequestDataStorylineDetails; #endregion #endregion #region 2. PROCESS #region EXECUTE json to html conversion try { #region IDEAL CASE - USE baseDI converter #region 1. CONVERT html container try { Func <Task <string> > ExecuteConversionRequest = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestDataToFilter", storedProcessRequestDataStorylineDetails); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterKey", "searchkey"); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterValue", "HTMLContentItem_SetImplementer_ProductCreation_WebDevelopment_HTMLContainer"); storedInputs.Parameters.Add("parameterOutputResponseAsArray", false); storedHtmlContainerJSON = Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Convert_JsonDataSetToNodes_1_0(storedInputs).Result.SingleOrDefault().Parent.Parent; storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlContainerJSON", storedHtmlContainerJSON); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); storedHtmlResultString = await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_1_0_Framework_Convert_HtmlContainerJsonToHtml_1_0(storedInputs); return(storedHtmlResultString); }; storedHtmlResultString = await ExecuteConversionRequest(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html container", storedProcessRequestMistake); } #endregion #region 2. CONVERT html rows try { Func <Task <string> > ExecuteConversionRequest = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestDataToFilter", storedProcessRequestDataStorylineDetails); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterKey", "searchkey"); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterValue", "HTMLContentItem_SetImplementer_ProductCreation_WebDevelopment_HTMLRows"); storedInputs.Parameters.Add("parameterOutputResponseAsArray", false); storedHtmlRowsJSON = Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Convert_JsonDataSetToNodes_1_0(storedInputs).Result.SingleOrDefault().Parent.Parent; storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlRowsJSON", storedHtmlRowsJSON); storedInputs.Parameters.Add("parameterOutputResponseHtmlContainerString", storedHtmlResultString); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); storedHtmlResultString = await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_2_0_Framework_Convert_HtmlRowsJsonToHtml_1_0(storedInputs); return(storedHtmlResultString); }; storedHtmlResultString = await ExecuteConversionRequest(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html rows", storedProcessRequestMistake); } #endregion #region 3. CONVERT html columns try { Func <Task <string> > ExecuteConversionRequest = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestDataToFilter", storedProcessRequestDataStorylineDetails); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterKey", "searchkey"); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterValue", "HTMLContentItem_SetImplementer_ProductCreation_WebDevelopment_HTMLColumns"); storedInputs.Parameters.Add("parameterOutputResponseAsArray", false); storedHtmlColumnsJSON = Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Convert_JsonDataSetToNodes_1_0(storedInputs).Result.SingleOrDefault().Parent.Parent; storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlColumnsJSON", storedHtmlColumnsJSON); storedInputs.Parameters.Add("parameterOutputResponseHtmlRowString", storedHtmlResultString); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); storedHtmlResultString = await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_3_0_Framework_Convert_HtmlColumnsJsonToHtml_1_0(storedInputs); return(storedHtmlResultString); }; storedHtmlResultString = await ExecuteConversionRequest(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html rows", storedProcessRequestMistake); } #endregion #region 4. CONVERT html content try { Func <Task <string> > ExecuteConversionRequest = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestDataToFilter", storedProcessRequestDataStorylineDetails); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterKey", "searchkey"); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterValue", "HTMLContentItem_SetImplementer_ProductCreation_WebDevelopment_HTMLContent"); storedInputs.Parameters.Add("parameterOutputResponseAsArray", false); storedHtmlContentJSON = Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Convert_JsonDataSetToNodes_1_0(storedInputs).Result.SingleOrDefault().Parent.Parent; storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlContentJSON", storedHtmlContentJSON); storedInputs.Parameters.Add("parameterOutputResponseHtmlColumnString", storedHtmlResultString); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); storedHtmlResultString = await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_4_0_Framework_Convert_HtmlContentJsonToHtml_1_0(storedInputs); return(storedHtmlResultString); }; storedHtmlResultString = await ExecuteConversionRequest(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html content", storedProcessRequestMistake); } #endregion #region 5. CONVERT html inline styles try { Func <Task <string> > ExecuteConversionRequest = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestDataToFilter", storedProcessRequestDataStorylineDetails); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterKey", "searchkey"); storedInputs.Parameters.Add("parameterProcessRequestDataToFilterValue", "HTMLContentStylingDetails_SetImplementer_ProductCreation_WebDevelopment_CSS"); storedInputs.Parameters.Add("parameterOutputResponseAsArray", false); storedHtmlStylesFiltered = Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Convert_JsonDataSetToNodes_2_0(storedInputs).Result.SingleOrDefault(); storedHtmlStylesJSON = storedHtmlStylesFiltered.Count > 0 ? storedHtmlStylesFiltered[0].Parent.Parent : null; storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlStylesJSON", storedHtmlStylesJSON); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); return(await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_5_0_Framework_Convert_HtmlCssJSONToInlineStyles_1_0(storedInputs)); }; storedHtmlResultInlineStylesString = await ExecuteConversionRequest(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html inline styles", storedProcessRequestMistake); } #endregion #region 6. CONVERT html inline scripts //TODO try { Func <Task <string> > ExecuteConversionRequest = async() => { return(await Task.FromResult <string>("").ConfigureAwait(true)); }; } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html inline scripts", storedProcessRequestMistake); } #endregion #region 7. CONVERT html inline metadata //TODO try { Func <Task <string> > ExecuteConversionRequest = async() => { return(await Task.FromResult <string>("").ConfigureAwait(true)); }; } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html inline metadata", storedProcessRequestMistake); } #endregion #region 8. OUTPUT html string try { Func <Task <string> > ExecuteOutputResponse = async() => { storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestHtmlMetaData", ""); storedInputs.Parameters.Add("parameterInputRequestHtmlTitle", ""); storedInputs.Parameters.Add("parameterInputRequestHtmlScripts", ""); storedInputs.Parameters.Add("parameterInputRequestHtmlStyles", storedHtmlResultInlineStylesString); storedInputs.Parameters.Add("parameterInputRequestHtmlAdditionalHeadData", ""); storedInputs.Parameters.Add("parameterInputRequestHtmlBody", storedHtmlResultString); storedInputs.Parameters.Add("parameterProcessRequestTracker", _storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", _storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequestCentralizedStorer", _storedProcessRequestCentralizedStorer); storedInputs.Parameters.Add("parameterProcessRequestDataStorylineDetails", storedProcessRequestDataStorylineDetails); return(await Extension_Director_Of_WebDevelopment_Chapter_12_3_Page_0_GoalHelper_Handler_1_0.Step_8_0_Framework_Convert_HtmlStructureToString_1_0(storedInputs)); }; storedHtmlResultString = await ExecuteOutputResponse(); } catch (Exception storedProcessRequestMistake) { throw new Exception("converting html content", storedProcessRequestMistake); } #endregion #region 9. STORE html string try { Func <Task <JObject> > ExecuteOutputResponse = async() => { storedOutputResponseObservationItem = storedOutputResponseObservationItem.Replace("'", "\""); storedOutputResponseObservationItem = storedOutputResponseObservationItem.Replace("{htmlResult}", Regex.Unescape(storedHtmlResultString)); storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations.Add((JObject.Parse(storedOutputResponseObservationItem) as dynamic).baseDIObservations[0].observation); return(storedProcessRequestDataStorylineDetails); }; StorylineDetails = await ExecuteOutputResponse(); } catch (Exception storedProcessRequestMistake) { throw new Exception("storing html string output observation", storedProcessRequestMistake); } #endregion #endregion } catch (Exception storedProcessRequestMistake) { #region EDGE CASE - USE developer logger if (storedProcessRequestDeveloperMode) { _storedProcessRequestTracker["storedProcessRequestStepNumber"] = (int)_storedProcessRequestTracker["storedProcessRequestStepNumber"] + 1; storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequest3WordDescription", "FAILED converting json to html"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterOutputResponseMessageType", "Mistake"); //Values = Logging or Mistake storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestStepNumberReplace", _storedProcessRequestTracker["storedProcessRequestStepNumber"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestMethodName", "Step_0_0_Framework_Store_HtmlAttributesToArray_1_0.ExecuteConversionRequest"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestMistake", storedProcessRequestMistake); await Extension_Director_Of_RiskManagement_Chapter_11_1_Page_0_GoalHelper_Handler_1_0.Step_X_X_Framework_Output_DeveloperMessage_1_0(storedProcessRequestDeveloperLoggingInputs); } #endregion #region EDGE CASE - USE exception handler throw new Exception("CONVERSION request failed " + storedProcessRequestMistake.ToString()); #endregion } #endregion #endregion #region 3. OUTPUT #region RETURN process response #region IDEAL CASE - USE baseDI dataset return(await Task.FromResult <JObject>(StorylineDetails).ConfigureAwait(true)); #endregion #endregion #endregion }
public static async Task <JObject> Step_X_X_Framework_Store_CacheDataToPersistentStorage_1_0(SingleParmPoco_12_2_1_0 parameterInputs) { #region 1. INPUTS #region VALIDATE input parameters Func <SingleParmPoco_12_2_1_0, Task <bool> > ValidateInputs = async(SingleParmPoco_12_2_1_0 parameterInputs) => { #region 1. INPUTS #region DEFINE parameter inputs #endregion #region DEFINE process checkpoint bool storedProcessRequestMistakeMade = false; #endregion #region DEFINE stored message string storedOutputResponseMessage = ""; #endregion #region MEMORIZE control client server Dictionary <string, object> storedProcessRequestTracker = parameterInputs.Parameters["parameterProcessRequestTracker"] as Dictionary <string, object>; #endregion #region MEMORIZE app settings IConfiguration storedProcessRequestSettings = (IConfiguration)storedProcessRequestTracker["storedProcessRequestSettings"]; #endregion #region MEMORIZE developer mode bool storedProcessRequestDeveloperMode = storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") ? storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") : false; SingleParmPoco_12_2_1_0 storedProcessRequestDeveloperLoggingInputs = new SingleParmPoco_12_2_1_0(); //REQUIRED storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterInputRequestActionName", parameterInputs.Parameters["parameterInputRequestActionName"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestSettings", storedProcessRequestTracker["storedProcessRequestSettings"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestTracker", storedProcessRequestTracker); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestFileName", "Extension_Director_Of_Programming_Chapter_12_2_Page_3_StorageRequest_Handler_1_0.ts"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestMethodName", "Step_X_X_Framework_Store_CacheDataToPersistentStorage_1_0.ValidateInputs()"); #endregion #endregion #region 2. PROCESS #region EXECUTE validation process #region IDEAL CASE - USE valid information if (parameterInputs != null || parameterInputs.Parameters != null) { if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestTracker")) { storedOutputResponseMessage += "***parameterProcessRequestTracker*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } else { if (parameterInputs.Parameters["parameterProcessRequestTracker"]["storedProcessRequestSettings"] == null) { storedOutputResponseMessage += "***parameterProcessRequestTracker*** must contain a key of ***storedProcessRequestSettings***.\n\n Please verify you are doing something like parameterInputs.Parameters.Add(process.env).\n Please also make sure you added this value in the ***webpack.config.server.js*** file under new webpack.DefinePlugin(process.env{'process.env':'xxxxx'})"; storedProcessRequestMistakeMade = true; } } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestCRUDVerb")) { storedOutputResponseMessage += "***parameterProcessRequestCRUDVerb*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestHandler")) { storedOutputResponseMessage += "***parameterProcessRequestHandler*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestCentralizedStorer")) { storedOutputResponseMessage += "***parameterProcessRequestCentralizedStorer*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestStorageValue")) { storedOutputResponseMessage += "***parameterProcessRequestStorageValue*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestDataStorylineDetails")) { storedOutputResponseMessage += "***parameterProcessRequestDataStorylineDetails*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestPageName")) { storedOutputResponseMessage += "***parameterProcessRequestPageName*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestStorageDescription")) { storedOutputResponseMessage += "***parameterProcessRequestStorageDescription*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (!parameterInputs.Parameters.ContainsKey("parameterProcessRequestStorageUniqueKey")) { storedOutputResponseMessage += "***parameterProcessRequestStorageUniqueKey*** cannot be blank or empty.\n"; storedProcessRequestMistakeMade = true; } if (storedProcessRequestMistakeMade) { #region EDGE CASE - USE developer logger if (storedProcessRequestDeveloperMode) { storedProcessRequestTracker["storedProcessRequestStepNumber"] = (int)storedProcessRequestTracker["storedProcessRequestStepNumber"] + 1; storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequest3WordDescription", "PARSING parameter values failed"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterOutputResponseMessageType", "Mistake"); //Values = Logging or Mistake storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestStepNumberReplace", storedProcessRequestTracker["storedProcessRequestStepNumber"]); Extension_Director_Of_RiskManagement_Chapter_11_1_Page_0_GoalHelper_Handler_1_0.Step_X_X_Framework_Output_DeveloperMessage_1_0(storedProcessRequestDeveloperLoggingInputs); } #endregion #region EDGE CASE - USE exception handler throw new Exception("PARSING parameter values failed"); #endregion } } else { #region EDGE CASE - USE developer logger if (storedProcessRequestDeveloperMode) { storedProcessRequestTracker["storedProcessRequestStepNumber"] = (int)storedProcessRequestTracker["storedProcessRequestStepNumber"] + 1; storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequest3WordDescription", "PARSING parameter values failed"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterOutputResponseMessageType", "Mistake"); //Values = Logging or Mistake storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestStepNumberReplace", storedProcessRequestTracker["storedProcessRequestStepNumber"]); Extension_Director_Of_RiskManagement_Chapter_11_1_Page_0_GoalHelper_Handler_1_0.Step_X_X_Framework_Output_DeveloperMessage_1_0(storedProcessRequestDeveloperLoggingInputs); } #endregion #region EDGE CASE - USE exception handler throw new Exception("PARSING parameter values failed"); #endregion } #endregion #endregion #endregion #region 3. OUTPUT #region RETURN validation passed #region IDEAL CASE - USE passed indicator return(true); #endregion #endregion #endregion }; ///BEGIN valdation process await ValidateInputs(parameterInputs); #endregion #region DEFINE storage details string storedFilteredStorageKey = ""; Dictionary <string, dynamic> storedProcessRequestStorageDictionary = new Dictionary <string, dynamic>(); #endregion #region DEFINE parameter inputs SingleParmPoco_12_2_1_0 storedInputs; #endregion #region DEFINE storyline details outputs string storedOutputResponseObservationPresentationTemplateItem = ""; string storedOutputResponseObservationItem = ""; #endregion #region MEMORIZE centralized processes aClass_Programming_ScriptAction_12_2_1_0 <dynamic> storedProcessRequestCentralizedStorer = parameterInputs.Parameters["parameterProcessRequestCentralizedStorer"] as aClass_Programming_ScriptAction_12_2_1_0 <dynamic>; //this._storedProcessRequestCentralizedSensor = parameterProcessRequestCentralizedSensor; //this._storedProcessRequestCentralizedStorer = parameterProcessRequestCentralizedStorer; #endregion #region MEMORIZE control client server Dictionary <string, object> storedProcessRequestTracker = parameterInputs.Parameters["parameterProcessRequestTracker"] as Dictionary <string, object>; #endregion #region MEMORIZE app settings IConfiguration storedProcessRequestSettings = (IConfiguration)storedProcessRequestTracker["storedProcessRequestSettings"]; #endregion #region MEMORIZE CRUD verb string storedCRUDVerb = parameterInputs.Parameters["parameterProcessRequestCRUDVerb"]; #endregion #region MEMORIZE developer mode bool storedProcessRequestDeveloperMode = storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") ? storedProcessRequestSettings.GetValue <bool>("AppSettings:APP_SETTING_DEVELOPER_MODE") : false; SingleParmPoco_12_2_1_0 storedProcessRequestDeveloperLoggingInputs = new SingleParmPoco_12_2_1_0(); //REQUIRED storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterInputRequestActionName", parameterInputs.Parameters["parameterInputRequestActionName"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequest3WordDescription", "PREPARING caching request"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestSettings", storedProcessRequestTracker["storedProcessRequestSettings"]); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestTracker", storedProcessRequestTracker); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestFileName", "Extension_Director_Of_Programming_Chapter_12_2_Page_3_StorageRequest_Handler_1_0.ts"); storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestMethodName", "Step_X_X_Framework_Store_CacheDataToPersistentStorage_1_0"); //OPTIONAL storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterOPTIONALIgnoreDeveloperConsoleLog", parameterInputs.Parameters["parameterOPTIONALIgnoreDeveloperConsoleLog"]); #endregion #region MEMORIZE request details string storedDirectorOrExperienceName = parameterInputs.Parameters["parameterProcessRequestHandler"]; #endregion #region MEMORIZE page name string storedPageName = parameterInputs.Parameters["parameterProcessRequestPageName"]; #endregion #region MEMORIZE storage details string storedStorageDescription = parameterInputs.Parameters["parameterProcessRequestStorageDescription"]; dynamic storedStorageValue = parameterInputs.Parameters["parameterProcessRequestStorageValue"]; string storedProcessRequestStorageKey = "StorageKey_" + storedDirectorOrExperienceName + "-" + storedCRUDVerb; string storedUniqueStorageKey = parameterInputs.Parameters["parameterProcessRequestStorageUniqueKey"]; if (!string.IsNullOrEmpty(storedUniqueStorageKey)) { storedProcessRequestStorageKey += "-" + storedUniqueStorageKey; } #endregion #region MEMORIZE storyline details dynamic storedProcessRequestDataStorylineDetails = parameterInputs.Parameters["parameterProcessRequestDataStorylineDetails"]; //storedProcessRequestDataStorylineDetails_Parameters = parameterProcessRequestDataStorylineDetails_Parameters; #endregion #region MEMORIZE storyline details outputs string storedOutputResponseObservationBusinessTemplateItem = "{}"; string storedOutputResponseObservationServiceTemplateItem = "{}"; string storedOutputResponseObservationSecurityTemplateItem = "{}"; string storedOutputResponseObservationDataTemplateItem = @"{ 'dataResult': '{dataResult}' }"; #endregion #endregion #region 2. PROCESS #region EXECUTE local storage process #region IDEAL CASE - USE npm node-localstorage //DETERMINE if we have something to store. if (storedStorageValue) { #region 1. CREATE new storage item storedInputs = new SingleParmPoco_12_2_1_0(); storedInputs.Parameters.Add("parameterInputRequestActionName", parameterInputs.Parameters["parameterInputRequestActionName"]); storedInputs.Parameters.Add("parameterProcessRequestTracker", storedProcessRequestTracker); storedInputs.Parameters.Add("parameterProcessRequestSettings", storedProcessRequestSettings); storedInputs.Parameters.Add("parameterProcessRequest3WordDescription", "CREATING storage output item"); storedInputs.Parameters.Add("parameterOutputResponseObservationFileName", "Extension_Director_Of_Programming_Chapter_12_2_Page_3_StorageRequest_Handler_1_0"); storedInputs.Parameters.Add("parameterOutputResponseObservationMethodName", "Step_X_X_Framework_Store_CacheDataToPersistentStorage_1_0"); storedInputs.Parameters.Add("parameterOutputResponseObservationPresentationTemplate", storedOutputResponseObservationPresentationTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationBusinessTemplate", storedOutputResponseObservationBusinessTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationServiceTemplate", storedOutputResponseObservationServiceTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationSecurityTemplate", storedOutputResponseObservationSecurityTemplateItem); storedInputs.Parameters.Add("parameterOutputResponseObservationDataTemplate", storedOutputResponseObservationDataTemplateItem); storedOutputResponseObservationItem = await Extension_Studio_Automation_Programming_Chapter_12_2_Page_0_ControlMasterLeader_Handler_1_0.Step_X_X_Framework_Output_JsonObservationNode_1_0(storedInputs); //DETERMINE if we are storing a string value. if (storedStorageValue is string) { //PREPARING to store a string value. storedOutputResponseObservationItem = storedOutputResponseObservationItem.Replace("{dataResult}", Regex.Unescape(storedStorageValue.trim())); } else { //PREPARING to store an object value. storedOutputResponseObservationItem = storedOutputResponseObservationItem.Replace("{dataResult}", Regex.Unescape(storedStorageValue.ToString(Formatting.None))); storedProcessRequestStorageDictionary[storedProcessRequestStorageKey] = storedOutputResponseObservationItem.ToString(); } #endregion #region 2. REMOVE previous stored item storedFilteredStorageKey = storedProcessRequestStorageKey.ToString().Replace("-Create", ""); storedFilteredStorageKey = storedFilteredStorageKey.ToString().Replace("-Read", ""); storedFilteredStorageKey = storedFilteredStorageKey.ToString().Replace("-Update", ""); storedFilteredStorageKey = storedFilteredStorageKey.ToString().Replace("-Delete", ""); foreach (var storedOutputResponseObservation in storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations) { } foreach (var storedOutputResponseObservation in storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations) { } //storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations.forEach(element => { // delete element[storedFilteredStorageKey] // }); //storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations.forEach(element => { // delete element[storedProcessRequestStorageKey] // }); #endregion #region 3. CREATE storage request storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations.push(storedProcessRequestStorageDictionary); #endregion #region 4. EXECUTE storage request if (storedProcessRequestDeveloperMode) { storedProcessRequestTracker["storedProcessRequestStepNumber"] = (int)storedProcessRequestTracker["storedProcessRequestStepNumber"] + 1; storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterOutputResponseMessageType", "Logging"); //Values = Logging or Mistake storedProcessRequestDeveloperLoggingInputs.Parameters.Add("parameterProcessRequestStepNumberReplace", storedProcessRequestTracker["storedProcessRequestStepNumber"]); Extension_Director_Of_RiskManagement_Chapter_11_1_Page_0_GoalHelper_Handler_1_0.Step_X_X_Framework_Output_DeveloperMessage_1_0(storedProcessRequestDeveloperLoggingInputs); } storedProcessRequestCentralizedStorer.ExtraData.KeyValuePairs.Add("parametersInputs", parameterInputs); storedProcessRequestCentralizedStorer.ExtraData.KeyValuePairs.Add("storedProcessRequestDeveloperLoggingInputs", storedProcessRequestDeveloperLoggingInputs); storedProcessRequestDataStorylineDetails = await storedProcessRequestCentralizedStorer?.Action_1_Begin_Process(); //storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations = (storedProcessRequestDataStorylineDetails && storedProcessRequestDataStorylineDetails.ouputs) ? storedProcessRequestDataStorylineDetails?.outputs[1]?.baseDIObservations?.filter((value: { }) => Object.keys(value).length !== 0) : storedProcessRequestDataStorylineDetails.outputs[1].baseDIObservations; #endregion #region FUTURE CODE EXAMPLE // In case If we need to remove based on verb // if(CRUDVerb.toUpperCase() == "CREATE") { // console.log(CRUDVerb) // console.log(storylineDetails.outputs[1].baseDIObservations) // } else if(CRUDVerb.toUpperCase() == "READ") { // console.log(CRUDVerb) // console.log(storylineDetails.outputs[1].baseDIObservations) // } // else if(CRUDVerb.toUpperCase() == "UPDATE") { // console.log(CRUDVerb) // } // else if(CRUDVerb.toUpperCase() == "DELETE") { // console.log(CRUDVerb) // } // if (chapter.MasterStorer.CallBack) // chapter.MasterStorer.CallBack(); #endregion } #endregion #endregion #endregion #region 3. OUTPUT #region RETURN storyline details #region IDEAL CASE - USE baseDI dataset return(storedProcessRequestDataStorylineDetails); #endregion #endregion #endregion }