Exemplo n.º 1
0
        // Use Nullable to distinguish from other ActionResults that get interpreted as
        // MC2 actions
        protected DataTree GetDefaultResults(
            string rootschema,
            string collection,
            string valuename,
            string relationtarget,
            string itemid,
            string filtercontroller,
            string filteraction)
        {
            string defaultValueController = Runtime.Schema.First[collection][valuename]["defaultresultscontroller"];
            string defaultValueBlock      = Runtime.Schema.First[collection][valuename]["defaultresultsblock"];
            string relation = Runtime.Schema.First[collection][valuename]["relation"];

            if (string.IsNullOrEmpty(defaultValueController) || string.IsNullOrEmpty(defaultValueBlock))
            {
                return(null);
            }

            MC2Value result = Runtime.RunBlock(
                defaultValueController,
                defaultValueBlock,
                collection,
                valuename,
                relationtarget,
                itemid,
                filtercontroller,
                filteraction);

            if (result is MC2DataTreeValue)
            {
                // MC2 datatree value has no name and we use the relation's target
                DataTree dtResult = ((MC2DataTreeValue)result).DataTreeValue;
                dtResult.Name = relation;
                return(dtResult);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 public MC2Value set(DataTree datatree, string name, MC2Value value)
 {
     datatree[name] = value;
     return(MC2EmptyValue.EmptyValue);
 }
Exemplo n.º 3
0
 public MC2Value tostring(MC2Value value)
 {
     return(Runtime.ControllerManager.MC2ValueToString(value));
 }
Exemplo n.º 4
0
 public MC2Value getvalueordefault(DataTree datatree, string name, MC2Value defaultValue)
 {
     return(datatree[name].GetValueOrDefault(defaultValue));
 }