Exemple #1
0
 public static void RegisterFunction(string name, Function function)
 {
     if (!_binder.ContainsKey(name))
     {
         _binder.Add(name, function);
     }
 }
        public bool ContainsKey(string search, params string[] keys)
        {
            InvariantDictionary<bool> dict = new InvariantDictionary<bool>();
            foreach (string key in keys)
                dict.Add(key, true);

            return dict.ContainsKey(search);
        }
        public void Add_FailsIfDuplicate()
        {
            // ReSharper disable once CollectionNeverQueried.Local
            InvariantDictionary <bool> dict = new InvariantDictionary <bool> {
                ["a"] = true
            };

            Assert.Throws <ArgumentException>(() => dict.Add("A", false));
        }
Exemple #4
0
        static UtilityFunctions()
        {
            _binder = new InvariantDictionary <Function>();

            _binder.Add("tovalue", ToValue);

            _binder.Add("parseint", ParseInt);
            _binder.Add("parsedecimal", ParseDecimal);
            _binder.Add("parsedatetime", ParseDateTime);
            _binder.Add("parsebool", ParseBool);

            _binder.Add("isint", IsInt);
            _binder.Add("isdecimal", IsDecimal);
            _binder.Add("isdateTime", IsDateTime);
            _binder.Add("isbool", IsBool);

            _binder.Add("concat", Concat);
        }
Exemple #5
0
 protected void BuildRelatedFIeldQueries(EntityQueryBuilder qBuilder)
 {
     _relatedFieldDataQryList = new InvariantDictionary <string>();
     foreach (var rel in this.Relations)
     {
         if (rel.Type == EntityRelationType.ManyToMany)
         {
             var childE = EntityMetaData.Get(rel.ChildName);
             _relatedFieldDataQryList.Add(rel.ParentRefField.Name, qBuilder.PrepareRelatedFieldDataQueries(rel, childE));
         }
     }
 }
        private void PrepareErrorModel(EntityModelBase recordModel, ref UIFormModel model)
        {
            var fields = new InvariantDictionary <UIFormField>();

            foreach (var fData in recordModel.GetInvalidFields())
            {
                fields.Add(fData.Field.ViewName.ToUpper(), new UIFormField()
                {
                    WidgetId = fData.Field.ViewName, ErrorMessage = fData.ErrorMessage
                });
            }

            model.Widgets = fields;
        }
Exemple #7
0
        public static InvariantDictionary <IEnumerable <DbObject> > Query(InvariantDictionary <string> sqls, object param = null, IDbTransaction trans = null)
        {
            InvariantDictionary <IEnumerable <DbObject> > rows = new InvariantDictionary <IEnumerable <DbObject> >();

            using (IDbConnection dbConnection = Connection)
            {
                dbConnection.Open();
                foreach (var q in sqls)
                {
                    var data = dbConnection.Query <dynamic>(q.Value, param, trans);
                    rows.Add(q.Key, ConvertToDbObjectData(data));
                }
            }

            return(rows);
        }
Exemple #8
0
        static ScriptFunctions()
        {
            _binder = new InvariantDictionary <Function>();
            #region DataTypes
            _binder.Add("Collection", Collection);
            _binder.Add("Object", Obj);
            _binder.Add("Date", Date);
            #endregion

            _binder.Add("iftrue", IfTrue);
            _binder.Add("ifnull", IfNull);

            _binder.Add("contains", Contains);

            _binder.Add("log", Log);
            _binder.Add("throw", Throw);

            //_binder.Add("navigate", Navigate);
        }