예제 #1
0
        /// <inheritdoc/>
        public void UpdateSettingsFromSession(IConfigurationUnitStore configStore)
        {
            this.LogReportEmailAddress = configStore?.ConfigValue("LogReport.EmailAddress") ?? string.Empty;
            if (configStore == null || this.OverrideServerSettings)
            {
                return;
            }

            this.LogClass         = configStore.ConfigValue("Log.Class");
            this.LogMethod        = configStore.ConfigValue("Log.LogMethod");
            this.LogConfig        = this.AsBooleanSetting(configStore.ConfigValue("Log.Config"));
            this.LogNetwork       = this.AsBooleanSetting(configStore.ConfigValue("Log.Network"));
            this.LogQuestionnaire = this.AsBooleanSetting(configStore.ConfigValue("Log.Questionnaire"));
            this.LogRequests      = this.AsBooleanSetting(configStore.ConfigValue("Log.Requests"));
            this.LogResults       = this.AsBooleanSetting(configStore.ConfigValue("Log.Result"));
            this.LogSerialEntry   = this.AsBooleanSetting(configStore.ConfigValue("Log.SerialEntry"));
            this.LogStatements    = this.AsBooleanSetting(configStore.ConfigValue("Log.Statements"));
            this.LogUpSync        = this.AsBooleanSetting(configStore.ConfigValue("Log.UpSync"));
            this.LogFlags         = this.GetLogFlags();
            var logLevel = "4"; //configStore.ConfigValue("Log.Level");

            this.LogLevel = LogLevel.Debug;
            if (!string.IsNullOrWhiteSpace(logLevel))
            {
                var val = 1;
                if (int.TryParse(logLevel, out val) && Enum.IsDefined(typeof(LogLevel), val))
                {
                    this.LogLevel = (LogLevel)val;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JavascriptEngine"/> class.
        /// </summary>
        public JavascriptEngine()
        {
            this.jCtx = new Engine();
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            var globalJavascripts = configStore?.ConfigValue("System.JavascriptGlobals");

            if (globalJavascripts?.Length > 0)
            {
                var scriptFiles = globalJavascripts.Split(',');
                foreach (string scriptName in scriptFiles)
                {
                    string fileName = configStore.FileNameForResourceName(scriptName);
                    Task.Run(async() =>
                    {
                        var content = await SimpleIoc.Default.GetInstance <IPlatformService>().StorageProvider.FileContents(fileName);
                        var script  = Encoding.UTF8.GetString(content, 0, content.Length);
                        this.jCtx.Execute(script);
                    });
                }
            }
        }
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow row)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            bool             hideEmptyFields    = configStore.ConfigValueIsSet("SettingsView.HideEmptyFields");
            UPMStandardGroup detailGroup        = null;
            int fieldCount = this.LayoutTab.FieldCount;

            for (int j = 0; j < fieldCount; j++)
            {
                WebConfigLayoutField fieldDef        = this.LayoutTab.FieldAtIndex(j);
                IIdentifier          fieldIdentifier = StringIdentifier.IdentifierWithStringId(fieldDef.ValueName);
                string fieldValue    = configStore.ConfigValue(fieldDef.ValueName);
                bool   hasFieldValue = !string.IsNullOrEmpty(fieldValue);

                if (!hasFieldValue && hideEmptyFields)
                {
                    continue;
                }

                var field = new UPMStringField(fieldIdentifier)
                {
                    StringValue = fieldDef.DisplayValueForValue(fieldValue),
                    LabelText   = fieldDef.Label
                };
                if (detailGroup == null)
                {
                    detailGroup           = new UPMStandardGroup(StringIdentifier.IdentifierWithStringId($"{this.Layout.UnitName}_{this.TabIndex}"));
                    detailGroup.LabelText = this.TabLabel;
                }

                detailGroup.AddField(field);
            }

            this.Group           = detailGroup;
            this.ControllerState = (detailGroup == null) ? GroupModelControllerState.Empty : GroupModelControllerState.Finished;
            return(detailGroup);
        }
예제 #4
0
        /// <summary>
        /// Applies the result row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns></returns>
        public override UPMGroup ApplyResultRow(UPCRMResultRow row)
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPMStandardGroup        detailGroup = null;
            int fieldCount = this.LayoutTab.FieldCount;
            List <UPEditFieldContext> editFieldContextArray = new List <UPEditFieldContext>(fieldCount);

            for (int j = 0; j < fieldCount; j++)
            {
                WebConfigLayoutField fieldDef        = this.LayoutTab.FieldAtIndex(j);
                IIdentifier          fieldIdentifier = StringIdentifier.IdentifierWithStringId(fieldDef.ValueName);
                string             fieldValue        = configStore.ConfigValue(fieldDef.ValueName);
                UPEditFieldContext editFieldContext  = UPEditFieldContext.FieldContextForWebConfigParameterFieldIdentifierValue(fieldDef, fieldIdentifier, fieldValue);
                if (editFieldContext == null)
                {
                    continue;
                }

                editFieldContextArray.Add(editFieldContext);
                if (detailGroup == null)
                {
                    detailGroup           = new UPMStandardGroup(StringIdentifier.IdentifierWithStringId($"{this.Layout.UnitName}_{this.TabIndex}"));
                    detailGroup.LabelText = this.TabLabel;
                }

                foreach (UPMEditField editField in editFieldContext.EditFields)
                {
                    detailGroup.AddField(editField);
                }
            }

            this.EditFieldContexts = editFieldContextArray;
            this.Group             = detailGroup;
            this.ControllerState   = (detailGroup == null) ? GroupModelControllerState.Empty : GroupModelControllerState.Finished;
            return(detailGroup);
        }