Exemple #1
0
        public void Run()
        {
            var obj = new DynamicObj();

            obj.Add("Name", "Xyz");
            obj.Add("Age", 10);
            obj.Add("Price", 2000.0);

            //var exp = "(Age + 11)";
        }
Exemple #2
0
        private static List <DynamicObj> PrepareButtonNLinks(StackAppContext appContext, IDBEntity entity)
        {
            var actions = EntityActionService.GetActions(appContext, entity.EntityId, EntityLayoutType.View);

            var coll = new List <DynamicObj>();

            foreach (var f in actions)
            {
                var d = new DynamicObj();
                d.Add("Id", f.Id);
                d.Add("Text", f.Text);
                coll.Add(d);
            }

            return(coll);
        }
Exemple #3
0
        public static DynamicObj ReadAsDynamicObj(this IDataRecord reader)
        {
            var d = new DynamicObj();

            for (int i = 0; i < reader.FieldCount; i++)
            {
                d.Add(reader.GetName(i), reader.GetValue(i));
            }

            return(d);
        }
Exemple #4
0
        protected DynamicObj PrepareRowData(DbObject dataRow, DataListContext context, DataListDefinition defn)
        {
            var row = new DynamicObj();

            row.Add(ViewConstant.RowId, dataRow.Get(context.DbQuery.ItemIdField, 0));
            foreach (var field in context.DbQuery.Fields)
            {
                var val = field.Field.ResolveDbValue(dataRow);
                if (context.Fields.Keys.Contains(field.FieldName))
                {
                    row.Add(context.Fields[field.FieldName].WidgetId, OnPrepareCell(context, defn, field.FieldName, val, row), true);
                }
                else
                {
                    row.Add(field.FieldName, val);
                }
            }
            OnPrepareRow(context, defn, row, dataRow);

            return(row);
        }
        protected virtual void OnRenderComplete()
        {
            var pageTitle = new DynamicObj();
            var entity    = this.FormContext.Entity;

            if (entity != null)
            {
                pageTitle.Add(ViewConstant.PageTitle, entity.Text);
            }

            View.PageTitle = pageTitle;
        }
        public List <DynamicObj> GetEntityListData()
        {
            var ents = new List <DynamicObj>();

            foreach (var entK in EntityMetaData.entities)
            {
                var ent = entK.Value;
                if (ent.EntityType != EntityType.CoreEntity)
                {
                    continue;
                }

                var o = new DynamicObj();
                o.Add("Module", ent.AppModule);
                o.Add("Name", ent.Name);
                o.Add("Text", ent.Name);
                o.Add("ID", ent.EntityId.Code);

                ents.Add(o);
            }

            return(ents);
        }
        private static void InitEntity(int itemTyp, DBEntity ent)
        {
            DynamicObj dataParam = new DynamicObj();

            dataParam.Add("DEFAULTLAYOUT", itemTyp);

            foreach (var fieldK in ent.Fields)
            {
                fieldK.Value.ControlType = GetDefaultControl(fieldK.Value.Type);
                fieldK.Value.Init();
            }

            ent.Init(dataParam);
        }
Exemple #8
0
        protected override void OnPrepareRow(DataListContext context, DataListDefinition defn, DynamicObj row, DbObject dataRow)
        {
            var pickerContext = context as PickerListContext;

            if (pickerContext.FormModelMapping != null)
            {
                var mapping = new DynamicObj();
                foreach (var c in pickerContext.FormModelMapping)
                {
                    mapping.Add(c.Key, dataRow.Get <object>(c.Value.ToString(), null));
                }

                row.Add("_ModelMapping", mapping);
            }
        }
        protected override void BuildDataRowActions(DataListContext context, DynamicObj row)
        {
            var rowId   = row.Get(ViewConstant.RowId, 0);
            var actions = new List <ActionInfo>();

            if (context.Context.UserInfo.HasAccess(context.SourceEntityId, AccessType.Update))
            {
                var actionContext = new ActionContext(null, ActionType.Edit, "BTN_EDIT");
                actionContext.Query          = new RequestQueryString();
                actionContext.Query.EntityId = context.SourceEntityId;
                actionContext.Query.ItemId   = rowId;

                var ac = PageActionCreator.Create(actionContext);
                ac.LinkTarget = "POPUP";

                actions.Add(ac);
            }

            row.Add("_RowActions", actions);
        }
        private void SetFormModelMapping(CustomRequestInfo reqInfo)
        {
            DynamicObj mapping = null;

            if (this.Field != null && reqInfo.DependencyContext != null && reqInfo.DependencyContext.Dependency != null)
            {
                var childs = reqInfo.DependencyContext.Dependency.Children;
                if (childs != null && childs.Count > 0)
                {
                    mapping = new DynamicObj();
                    var refmetadat = this.Field.Entity;
                    foreach (var c in childs)
                    {
                        var field = refmetadat.GetFieldSchema(c.WidgetId);
                        if (field.IsRelatedField && field.Related.LinkField == this.Field.Name)
                        {
                            mapping.Add(field.Name, field.Related.Field);
                        }
                    }
                }
            }

            this.FormModelMapping = mapping;
        }
Exemple #11
0
        private static List <DynamicObj> PrepareFieldList(IDBEntity entity)
        {
            var fields = entity.GetLayoutFields(EntityLayoutType.None);

            var coll = new List <DynamicObj>();

            foreach (var f in fields)
            {
                var d = new DynamicObj();
                d.Add("Name", f.Name);
                d.Add("Text", f.Text);
                d.Add("Type", f.Type);
                d.Add("WidgetType", f.ControlType);
                d.Add("Isrequired", f.IsRequired);
                d.Add("ShouldFullRow", EntityLayoutService.IsWidgetOnFullRow(f.ControlType));
                coll.Add(d);
            }

            return(coll);
        }