Exemplo n.º 1
0
        /// <summary>
        /// Initializes the any option children defined for the instance.
        /// </summary>
        protected override void InitializeOptionalChildren(ISystemContext context)
        {
            base.InitializeOptionalChildren(context);

            if (DisplayMaxValue != null)
            {
                DisplayMaxValue.Initialize(context, DisplayMaxValue_InitializationString);
            }

            if (DisplayMinValue != null)
            {
                DisplayMinValue.Initialize(context, DisplayMinValue_InitializationString);
            }

            if (Exponent != null)
            {
                Exponent.Initialize(context, Exponent_InitializationString);
            }

            if (MaxValue != null)
            {
                MaxValue.Initialize(context, MaxValue_InitializationString);
            }

            if (MinValue != null)
            {
                MinValue.Initialize(context, MinValue_InitializationString);
            }

            if (ProcedureCommand != null)
            {
                ProcedureCommand.Initialize(context, ProcedureCommand_InitializationString);
            }
        }
Exemplo n.º 2
0
        private ICommand ParseFunctionCommand()
        {
            string        name           = this.ParseName();
            List <string> parameterNames = this.ParseParameterNameList();

            this.ParseEndOfLine();

            CompositeCommand command = this.ParseCommandList("return");

            this.lexer.NextToken();

            Token token = this.lexer.NextToken();

            if (token != null)
            {
                this.lexer.PushToken(token);

                if (token.TokenType != TokenType.EndOfLine)
                {
                    command.AddCommand(new ReturnCommand(this.ParseExpression()));
                }
            }

            ProcedureCommand procedureCommand = new ProcedureCommand(name, parameterNames, command);

            return(procedureCommand);
        }
Exemplo n.º 3
0
        private ICommand ParseProcedureCommand()
        {
            string        name           = this.ParseName();
            List <string> parameterNames = this.ParseParameterNameList();

            this.ParseEndOfLine();
            ICommand command = this.ParseCommandList("return");

            ProcedureCommand procedureCommand = new ProcedureCommand(name, parameterNames, command);

            this.lexer.NextToken();

            return(procedureCommand);
        }
Exemplo n.º 4
0
        public void ParseSimpleProcedureWithParameter()
        {
            Parser parser = new Parser("Procedure DoBar(b)\r\na := b\r\nreturn");

            ICommand command = parser.ParseCommand();

            Assert.IsNotNull(command);
            Assert.IsInstanceOfType(command, typeof(ProcedureCommand));

            ProcedureCommand proc = (ProcedureCommand)command;

            Assert.AreEqual("DoBar", proc.Name);
            Assert.IsNotNull(proc.ParameterNames);
            Assert.AreEqual(1, proc.ParameterNames.Count);
            Assert.AreEqual("b", proc.ParameterNames[0]);
        }
Exemplo n.º 5
0
        public ActionResult UpdateDelayedSO(string orderNumber, int lineNumber, string delayedDays, string supplementaryText5, int post = -1)
        {
            if (post != -1)
            {
                Random rnd   = new Random();
                int    value = rnd.Next(0, 10);
                return(Content(value > 5 ? post.ToString() : post.ToString()));
            }
            else
            {
                return(Content("Ожидание"));
            }

            // Обновление данных
            Param[] parameters =
            {
                new Param("fDecision", "Отправить запрос МП"), new Param("fYourRequest", "Не отправлен"), new Param("fDelayNumber", delayedDays),
                new Param("fDelay",    supplementaryText5),    new Param("fOrdernumb",   orderNumber),    new Param("fLinenumb",    lineNumber)
            };
            var command = new ProcedureCommand(Options.Sheets["Обновление задерж. ЗК"].Procedure, parameters, Returns.Nothing);
            var caller  = new DbCaller(command);

            try
            {
                caller.DoWork();
            }
            catch
            {
                return(Content("Обновить данные не удалось!"));
            }
            // Проверка, обновились ли данные. Возвращает простой текст в HTML страничку по итогам проверки
            var checkCommand = new TextCommand(string.Format("select 1 result from OrderLine where OrderNumber = {0} and LineNumber = {1} SupplementaryText5 like '%LETTER%'", orderNumber, lineNumber));
            var checkCaller  = new DbCaller(checkCommand);

            try
            {
                checkCaller.DoWork();
                return(Content(checkCaller.GetResult().ToString().Equals("1") ? "Успешно" : "Неуспешно"));
            }
            catch (Exception e)
            {
                return(Content("Проверка неуспешна"));
            }
        }