Пример #1
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;
        }
Пример #2
0
        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            if (parseNode == null)
                return;

            if (parseNode.ChildNodes[0].AstNode != null)
            {

                if (parseNode.ChildNodes[0].AstNode is SettingAttrNode)
                {
                    SettingDefinition = new SettingAttributeDefinition((parseNode.ChildNodes[0].AstNode as SettingAttrNode).Attributes);
                }

                else if (parseNode.ChildNodes[0].AstNode is SettingTypeNode)
                {
                    SettingDefinition = new SettingTypeDefinition((parseNode.ChildNodes[0].AstNode as SettingTypeNode).Types);
                }

            }

            else if (parseNode.ChildNodes[0] != null)
            {

                switch (parseNode.ChildNodes[0].Term.Name.ToUpper())
                {
                    case "DB":
                        SettingDefinition = new SettingDBDefinition();
                    break;
                    case "SESSION":
                        SettingDefinition = new SettingSessionDefinition();
                    break;

                    default:
                        SettingDefinition = new SettingDBDefinition();
                    break;
                }

            }
        }
Пример #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)));

            }
        }