Exemplo n.º 1
0
        public JsonResult GeBizRuleTalbe(string ruleCode, string matrixCode, bool isView)
        {
            return(ExecuteFunctionRun(() => {
                if (string.IsNullOrEmpty(ruleCode) || string.IsNullOrEmpty(matrixCode))
                {
                    return null;
                }


                #region 获取对应的业务规则和决策表
                OThinker.H3.BizBus.BizRule.BizRuleTable Rule = null;
                OThinker.H3.BizBus.BizRule.BizRuleDecisionMatrix Matrix = null;

                Rule = this.Engine.BizBus.GetBizRule(ruleCode);
                if (Rule == null)
                {
                    return null;
                }

                Matrix = Rule.GetDecisionMatrix(matrixCode);
                if (Matrix == null)
                {
                    return null;
                }
                #endregion


                BizRuleTableViewModel model = new BizRuleTableViewModel();

                #region 基本信息
                model.RuleCode = ruleCode;
                model.MatrixCode = matrixCode;
                model.IsView = isView;
                model.MatrixType = Matrix.MatrixType.ToString();
                model.HorizontalCellCount = Matrix.HorizontalCellCount;
                model.VerticalCellCount = Matrix.VerticalCellCount;
                model.RowDepth = Matrix.RowDepth;
                model.ColumnDepth = Matrix.ColumnDepth;
                #endregion

                #region  列集合

                model.Columns = GetMatrixData(Matrix.Columns);

                #endregion

                #region  行集合

                model.Rows = GetMatrixData(Matrix.Rows);

                #endregion

                #region  单元格集合

                int rowLength = Matrix.Cells.Length;

                List <List <MatrixCellViewModel> > listCellcells = new List <List <MatrixCellViewModel> >();

                for (int i = 0; i < rowLength; i++)
                {
                    List <MatrixCellViewModel> listCells = new List <MatrixCellViewModel>();
                    int colLength = Matrix.Cells[i].Length;
                    for (int j = 0; j < colLength; j++)
                    {
                        MatrixCellViewModel cell = new MatrixCellViewModel();
                        cell.RowIndex = i;
                        cell.ColumnIndex = j;
                        cell.Value = Matrix.Cells[i][j].CellValue;

                        listCells.Add(cell);
                    }
                    listCellcells.Add(listCells);
                }
                model.Cells = listCellcells;

                #endregion

                return Json(model, JsonRequestBehavior.AllowGet);
            }));
        }
 /// <summary>
 /// Returns a specific value
 /// </summary>
 /// <param name="matrixCellViewModel">The <see cref="MatrixCellViewModel"/> that helps to return the right value</param>
 /// <returns>Background color by name</returns>
 protected override string GetValue(MatrixCellViewModel matrixCellViewModel)
 {
     return(matrixCellViewModel.IsDeprecated ? "LightGray" : "Transparent");
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a specific value
 /// </summary>
 /// <param name="matrixCellViewModel">The <see cref="MatrixCellViewModel"/> that helps to return the right value</param>
 /// <returns></returns>
 protected override string GetValue(MatrixCellViewModel matrixCellViewModel)
 {
     return(matrixCellViewModel?.Tooltip ?? "-");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a specific value
 /// </summary>
 /// <typeparam name="T">The type of the value to be returned</typeparam>
 /// <param name="matrixCellViewModel">The <see cref="MatrixCellViewModel"/> that helps to return the right value</param>
 /// <returns>Value of type T</returns>
 protected abstract T GetValue(MatrixCellViewModel matrixCellViewModel);
Exemplo n.º 5
0
 /// <summary>
 /// Returns a specific value
 /// </summary>
 /// <param name="matrixCellViewModel">The <see cref="MatrixCellViewModel"/> that helps to return the right value</param>
 /// <returns>Opacity</returns>
 protected override double GetValue(MatrixCellViewModel matrixCellViewModel)
 {
     return(matrixCellViewModel.IsDeprecated ? 0.5D : double.PositiveInfinity);
 }