コード例 #1
0
ファイル: searchfilter.cs プロジェクト: tuomokari/1.6
        // 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);
            }
        }
コード例 #2
0
 public MC2Value set(DataTree datatree, string name, MC2Value value)
 {
     datatree[name] = value;
     return(MC2EmptyValue.EmptyValue);
 }
コード例 #3
0
ファイル: convert.cs プロジェクト: tuomokari/1.6
 public MC2Value tostring(MC2Value value)
 {
     return(Runtime.ControllerManager.MC2ValueToString(value));
 }
コード例 #4
0
 public MC2Value getvalueordefault(DataTree datatree, string name, MC2Value defaultValue)
 {
     return(datatree[name].GetValueOrDefault(defaultValue));
 }