Exemplo n.º 1
0
        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            _Settings = new Dictionary<String, String>();

            foreach (var _ParseTreeNode1 in parseNode.ChildNodes)
            {

                if (_ParseTreeNode1.HasChildNodes())
                {

                    switch (_ParseTreeNode1.ChildNodes[0].Token.Text.ToUpper())
                    {
                        case "GET":
                            _OperationType = TypesOfSettingOperation.GET;
                            break;
                        case "SET":
                            _OperationType = TypesOfSettingOperation.SET;
                            break;
                        case "REMOVE":
                            _OperationType = TypesOfSettingOperation.REMOVE;
                            break;
                    }

                    foreach (var _ParseTreeNode2 in _ParseTreeNode1.ChildNodes[1].ChildNodes)
                    {

                        if (_ParseTreeNode2 != null)
                        {
                            if (_ParseTreeNode2.HasChildNodes())
                            {
                                if (_ParseTreeNode2.ChildNodes[0] != null)
                                {
                                    if (_ParseTreeNode2.ChildNodes[2] != null)
                                    {
                                        if (_ParseTreeNode2.ChildNodes[0].Token != null && _ParseTreeNode2.ChildNodes[2].Token != null)
                                        {
                                            var Temp = _ParseTreeNode2.ChildNodes[2].Token.Text.ToUpper();

                                            if (Temp.Contains("DEFAULT"))
                                                _Settings.Add(_ParseTreeNode2.ChildNodes[0].Token.ValueString.ToUpper(), Temp);
                                            else
                                                _Settings.Add(_ParseTreeNode2.ChildNodes[0].Token.ValueString.ToUpper(), _ParseTreeNode2.ChildNodes[2].Token.ValueString.ToUpper());
                                        }
                                    }
                                }
                            }

                            else
                            {
                                if (_ParseTreeNode2.Token != null)
                                    _Settings.Add(_ParseTreeNode2.Token.ValueString, "");
                            }
                        }

                    }

                }

            }
        }
Exemplo n.º 2
0
        public override void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            _ASettingDefinition = ((SettingScopeNode)parseNode.ChildNodes[1].AstNode).SettingDefinition;

            var settingOpNode = (SettingOperationNode)parseNode.ChildNodes[2].AstNode;
            _TypeOfSettingOperation = settingOpNode.OperationType;
            _Settings = settingOpNode.Settings;
        }
Exemplo n.º 3
0
        /// <summary>
        /// this is whaer the aektschn haeppens
        /// </summary>
        /// <param name="myDBContext"></param>
        /// <returns></returns>
        public QueryResult ExecuteSettingOperation(DBContext myDBContext, ASettingDefinition mySettingDefinition, TypesOfSettingOperation myTypeOfSettingOperation, Dictionary<string, string> mySettings)
        {
            QueryResult result = new QueryResult();

            switch (myTypeOfSettingOperation)
            {
                case TypesOfSettingOperation.GET:

                    #region GET

                    var extractDataResult = mySettingDefinition.ExtractData(mySettings, myDBContext);
                    if (extractDataResult.Failed())
                    {
                        return new QueryResult(extractDataResult);
                    }
                    return new QueryResult(extractDataResult.Value);

                    #endregion

                case TypesOfSettingOperation.SET:

                    #region SET

                    var setDataResult = mySettingDefinition.SetData(mySettings, myDBContext);
                    if (setDataResult.Failed())
                    {
                        return new QueryResult(setDataResult);
                    }
                    return new QueryResult(setDataResult.Value);

                    #endregion

                case TypesOfSettingOperation.REMOVE:

                    #region REMOVE

                    var removeDataResult = mySettingDefinition.RemoveData(mySettings, myDBContext);
                    if (removeDataResult.Failed())
                    {
                        return new QueryResult(removeDataResult);
                    }
                    return new QueryResult(removeDataResult.Value);

                    #endregion

                default:

                    return new QueryResult(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));

            }
        }