private void AddDecision(Row row, DecisionTableDef decisionTableDef) { var decisionDef = new DecisionDef(); //Decision Table row try { //Go through the condition columns one at a time int cellNumber = 0; foreach (var conditionDimension in decisionTableDef.Conditions) { var conditionNodeDef = new ConditionNodeDef(); //column in Decision table row try { conditionNodeDef.SourceValueID = GetConditionValueGuidForSpreadsheetCell(row.Conditions[cellNumber].Value, conditionDimension); conditionNodeDef.SourceDimensionID = conditionDimension.DimensionID; } catch { // Caused by empty cell, so do nothing. Will show as -Any- } decisionDef.ConditionNodes.Add(conditionNodeDef); cellNumber++; } cellNumber = 0; foreach (ActionDimensionDef actionDimension in decisionTableDef.Actions) { var actionNodeDef = new ActionNodeDef(); try { actionNodeDef.SourceValueID = GetActionValueGuidForSpreadsheetCell(row.Actions[cellNumber].Value, actionDimension); actionNodeDef.SourceDimensionID = actionDimension.DimensionID; } catch { // Caused by empty cell, so do nothing Will show as -Ignore- } decisionDef.ActionNodes.Add(actionNodeDef); cellNumber++; } decisionTableDef.Decisions.Add(decisionDef); } catch (Exception ex) { throw (ex); } }
// // create the condition cells on the spreadsheet for a given row (DecisionDef) // private void addConditionCells(StringBuilder spreadsheetText, List <System.Guid> condIds, DecisionDef def) { foreach (System.Guid condId in condIds) { try { spreadsheetText.Append("\"" + def.ConditionNodes.GetByDimensionId(condId).GetValueDisplayName() + "\","); } catch (Exception ex) { spreadsheetText.Append("-Any-,"); var info = ex.StackTrace; } } spreadsheetText.Append(","); //spacer cell before actions }
// // create the action cells on the spreadsheet for a given row (DecisionDef) // private void addActionCells(StringBuilder spreadsheetText, List <System.Guid> actionIds, DecisionDef def) { foreach (System.Guid actId in actionIds) { try { spreadsheetText.Append("\"" + def.ActionNodes.GetByDimensionId(actId).GetValueDisplayName() + "\","); } catch (Exception ex2) { spreadsheetText.Append("-Ignore-,"); var info = ex2.StackTrace; } } }