Esempio n. 1
0
        public void CanFailToGetSpecificUserFunction()
        {
            UserFunctionsList lst    = new UserFunctionsList();
            UserFunction      actual = lst.GetUserFunction("bogus");

            Assert.IsNull(actual);
        }
Esempio n. 2
0
        public void CanGetSpecificUserFunction()
        {
            UserFunctionsList lst    = new UserFunctionsList();
            UserFunction      actual = lst.GetUserFunction("HtmlEncode");

            Assert.AreEqual("Encodes to html", actual.Description);
        }
Esempio n. 3
0
        public void CanGetUserFunctions()
        {
            UserFunctionsList lst    = new UserFunctionsList();
            List <string>     actual = lst.GetFunctions();

            Assert.AreEqual(3, actual.Count);
            Assert.AreEqual("NumList", actual[0]);
            Assert.AreEqual("HtmlEncode", actual[1]);
        }
Esempio n. 4
0
        public UdfEditor()
        {
            Name        = "Will not be a normal usable function";
            Description = "#";

            _udfParameters   = new Dictionary <string, string>();
            _xmlDefinedParms = new List <Parameter>();
            _userFunctions   = new UserFunctionsList();
            DefineParameters();
        }
Esempio n. 5
0
        public Dictionary <string, string> GetFunctions()
        {
            UserFunctionsList           flist  = new UserFunctionsList();
            Dictionary <string, string> output = new Dictionary <string, string>();

            foreach (UserFunction uf in flist)
            {
                output.Add(uf.Name, uf.Description);
            }
            return(output);
        }
Esempio n. 6
0
    /// <summary>
    /// metod za promena na korisnikot za koj sakame da dodame novi funkcii.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnChildChanged(object sender, EventArgs e)
    {
        ObjectDataSource1.SelectParameters.Clear();
        ObjectDataSource1.SelectParameters.Add(new System.Web.UI.WebControls.Parameter("userId", TypeCode.Int32, ddlUsers.SelectedValue));

        ObjectDataSource3.SelectParameters.Clear();
        ObjectDataSource3.SelectParameters.Add(new System.Web.UI.WebControls.Parameter("parentId", TypeCode.Int32, PageUser.ID.ToString()));
        ObjectDataSource3.SelectParameters.Add(new System.Web.UI.WebControls.Parameter("childId", TypeCode.Int32, ddlUsers.SelectedValue));
        RoleFunctionsList.DataBind();
        UserFunctionsList.DataBind();

        RoleFunctionsList.Visible = true;
        UserFunctionsList.Visible = true;
    }
Esempio n. 7
0
 public UdfEditor()
 {
     _functions = new UserFunctionsList();
     InitializeComponent();
 }
Esempio n. 8
0
        private List <StiToken> PostProcessTokensList(List <StiToken> tokensList)
        {
            List <StiToken> newList = new List <StiToken>();

            tokenPos = 0;
            while (tokenPos < tokensList.Count)
            {
                StiToken token = tokensList[tokenPos];
                tokenPos++;
                if (token.Type == StiTokenType.Identifier)
                {
                    if ((newList.Count > 0) && (newList[newList.Count - 1].Type == StiTokenType.Dot))
                    {
                        if (MethodsList.Contains(token.Value))
                        {
                            token.Type = StiTokenType.Method;
                        }
                        //Proryv
                        else if (Equals(token.Value, "Value") || ProryvPropertiesList.Contains(token.Value) || PropertiesList.Contains(token.Value))
                        {
                            token.Type = StiTokenType.Property;
                        }
                        else
                        {
                            ThrowError(ParserErrorCode.FieldMethodOrPropertyNotFound, token, token.Value);
                        }
                    }
                    else if (TypesList.Contains(token.Value))
                    {
                        token.Type = StiTokenType.Cast;

                        if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Dot))
                        {
                            string tempName = token.Value + "." + tokensList[tokenPos + 1].Value;
                            if (FunctionsList.Contains(tempName))
                            {
                                token.Type  = StiTokenType.Function;
                                token.Value = tempName;
                                tokenPos   += 2;
                            }
                            //Proryv
                            else if (ProryvFunctionsList.Contains(tempName))
                            {
                                token.Type  = StiTokenType.ProryvFunction;
                                token.Value = tempName;
                                tokenPos   += 2;
                            }
                            if (SystemVariablesList.Contains(tempName))
                            {
                                token.Type  = StiTokenType.SystemVariable;
                                token.Value = tempName;
                                tokenPos   += 2;
                            }
                        }
                    }

                    //Proryv
                    else if (ProryvFunctionsList.Contains(token.Value))
                    {
                        token.Type = StiTokenType.ProryvFunction;
                    }
                    else if (_proryvSpreadsheetProperties != null && _proryvSpreadsheetProperties.ContainsKey(token.Value.ToLowerInvariant()))
                    {
                        token.Type = StiTokenType.ProryvSpreadsheetProperties;
                    }
                    else if (_proryvFreeHierarchyBalanceSignature != null && _proryvFreeHierarchyBalanceSignature.ContainsKey(token.Value.ToLowerInvariant()))
                    {
                        token.Type = StiTokenType.ProryvFreeHierarchyBalanceSignature;
                    }

                    else if (FunctionsList.Contains(token.Value))
                    {
                        while ((ProryvFunctionType)FunctionsList[token.Value] == ProryvFunctionType.NameSpace)
                        {
                            if (tokenPos + 1 >= tokensList.Count)
                            {
                                ThrowError(ParserErrorCode.UnexpectedEndOfExpression);
                            }
                            var np = tokensList[tokenPos + 1].Value;
                            token.Value += "." + np;
                            tokenPos    += 2;
                            if (!FunctionsList.Contains(token.Value))
                            {
                                if (FunctionsList.Contains(np))
                                {
                                    token.Value = np;
                                }
                                else
                                {
                                    ThrowError(ParserErrorCode.FunctionNotFound, token, token.Value);
                                }
                            }
                        }
                        token.Type = StiTokenType.Function;
                    }

                    else if (SystemVariablesList.Contains(token.Value) && (token.Value != "value"))
                    {
                        token.Type = StiTokenType.SystemVariable;
                    }

                    //else if (token.Value.ToLowerInvariant() == "true" || token.Value.ToLowerInvariant() == "false")
                    //{
                    //    if (token.Value.ToLowerInvariant() == "true")
                    //        token.ValueObject = true;
                    //    else
                    //        token.ValueObject = false;
                    //    token.Type = StiTokenType.Number;
                    //}
                    //else if (token.Value.ToLowerInvariant() == "null")
                    //{
                    //    token.ValueObject = null;
                    //    token.Type = StiTokenType.Number;
                    //}

                    else if (ConstantsList.Contains(token.Value))
                    {
                        while (ConstantsList[token.Value] == namespaceObj)
                        {
                            if (tokenPos + 1 >= tokensList.Count)
                            {
                                ThrowError(ParserErrorCode.UnexpectedEndOfExpression);
                            }
                            string oldTokenValue = token.Value;
                            token.Value += "." + tokensList[tokenPos + 1].Value;
                            tokenPos    += 2;
                            if (!ConstantsList.Contains(token.Value))
                            {
                                ThrowError(ParserErrorCode.ItemDoesNotContainDefinition, token, oldTokenValue, tokensList[tokenPos + 1].Value);
                            }
                        }
                        token.ValueObject = ConstantsList[token.Value];
                        token.Type        = StiTokenType.Number;
                    }

                    else if (UserFunctionsList.Contains(token.Value))
                    {
                        token.Type = StiTokenType.Function;
                    }

                    else
                    {
                        ThrowError(ParserErrorCode.NameDoesNotExistInCurrentContext, token, token.Value);
                    }
                }
                newList.Add(token);
            }
            return(newList);
        }