public static void GetDecisionsVariables(tDecision tdecision, string fileName, ref List <DmnDataDictionaryModel> dataDictionaryList) { var decisionId = tdecision.id; var decisionName = tdecision.name; var decisionTable = (tDecisionTable)tdecision.Item; foreach (var inputClause in decisionTable.input) { //add input variable name //var dictionary = AddVariablesToDictionary(fileName, decisionId, decisionName, inputClause.id, inputClause.label,inputClause.inputExpression.typeRef.Name, "input"); var dictionary = AddVariablesToDictionary(fileName, decisionId, decisionName, inputClause.inputExpression.Item.ToString(), inputClause.label, inputClause.inputExpression.typeRef.Name, "input"); dataDictionaryList.Add(dictionary); } foreach (var outputClause in decisionTable.output) { // Add Output variable name var dictionary = AddVariablesToDictionary(fileName, decisionId, decisionName, outputClause.name, outputClause.label, outputClause.typeRef.Name, "output"); dataDictionaryList.Add(dictionary); } }
//---- Data Dictionary public static void GetDecisionsVariables(tDecision tdecision, string fileName, ref List <DmnInfo> dataDictionaryList) { var decisionTable = (tDecisionTable)tdecision.Item; var dmnInfo = new DmnInfo() { FileName = $"{fileName}.dmn", DmnId = tdecision.id, DmnName = tdecision.name, }; foreach (var inputClause in decisionTable.input) { //add input variable to DMN //var dictionary = AddVariablesToDictionary(fileName, decisionId, decisionName, inputClause.id, inputClause.label,inputClause.inputExpression.typeRef.Name, "input"); var dictionary = AddVariablesToDictionary(ref dmnInfo, inputClause.inputExpression.Item.ToString(), inputClause.label, inputClause.inputExpression.typeRef.Name, "input"); } foreach (var outputClause in decisionTable.output) { // Add Output variable name var dictionary = AddVariablesToDictionary(ref dmnInfo, outputClause.name, outputClause.label, outputClause.typeRef.Name, "output"); } dataDictionaryList.Add(dmnInfo); }
public tDefinitions SerializeDictionariesToDmn(Dictionary <string, object> outputsDictionary, Dictionary <int, object> rulesDictionary, string fileName) { var tDecisionTable = new tDecisionTable(); tDecisionTable.input = new tInputClause[] { }; var tExpression = tDecisionTable; var tdecision = new tDecision(); tdecision.Item = tExpression; var tDefinitions = new tDefinitions(); tDefinitions.id = fileName; tDefinitions.Items = new tDRGElement[] { tdecision }; return(tDefinitions); }