예제 #1
0
        private SOARolePropertyRowCollection MergeExternalMatrix(SOARolePropertyRowCollection matrixRows, IEnumerable <SOARolePropertiesQueryParam> queryParams)
        {
            if (this.ExternalMatrixID.IsNotEmpty())
            {
                IWfMatrixContainer externalMatrix = this.GetExternalMatrix();

                SOARoleContext.DoNewContextAction(externalMatrix.PropertyDefinitions, this.ProcessInstance, (context) =>
                {
                    if (externalMatrix.PropertyDefinitions.MatrixType == WfMatrixType.ApprovalMatrix)
                    {
                        SOARolePropertyRowCollection approvalRows = externalMatrix.Rows.QueryWithoutCondition(context.QueryParams, true);

                        matrixRows.SortActivitySN();
                        matrixRows.MergeApprovalMatrix(this.PropertyDefinitions, approvalRows, externalMatrix.PropertyDefinitions);
                    }
                    else
                    {
                        SOARolePropertyRowCollection approvalRows = externalMatrix.Rows.QueryWithoutCondition(context.QueryParams, false);

                        matrixRows.SortActivitySN();
                        matrixRows.MergeActivityMatrix(this.PropertyDefinitions, approvalRows, externalMatrix.PropertyDefinitions);
                    }
                });

                matrixRows = matrixRows.FilterByConditionColumn();
            }

            return(matrixRows);
        }
예제 #2
0
        public static void CreateMatrixHeaderRow(this IWfMatrixContainer matrix, WorkSheet sheet)
        {
            matrix.NullCheck("matrix");
            sheet.NullCheck("sheet");

            Row headRow = new Row(3);

            headRow.Style.Fill.SetBackgroundColor(Color.Gold, ExcelFillStyle.Solid);
            headRow.Style.Border.Top.Style = ExcelBorderStyle.Thin;
            headRow.Style.Border.Top.Color.SetColor(Color.Black);
            headRow.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            headRow.Style.Border.Bottom.Color.SetColor(Color.Black);
            headRow.Style.Border.Left.Style = ExcelBorderStyle.Thin;
            headRow.Style.Border.Left.Color.SetColor(Color.Black);
            headRow.Style.Font.Bold = true;
            sheet.Rows.Add(headRow);

            int columnIndex = 1;

            foreach (SOARolePropertyDefinition dimension in matrix.PropertyDefinitions)
            {
                sheet.Cells[headRow.Index, columnIndex].Value = dimension.Description.IsNotEmpty() ? dimension.Description : dimension.Name;
                sheet.Names.Add(CellAddress.Parse(columnIndex, headRow.Index).ToString(), dimension.Name);

                columnIndex++;
            }
        }
예제 #3
0
        public static void FillMatrixSheetData(this IWfMatrixContainer matrix, WorkSheet sheet)
        {
            matrix.NullCheck("matrix");
            sheet.NullCheck("sheet");

            int rowIndex = 4;
            SOARolePropertyRowCollection rows = matrix.Rows;

            foreach (SOARolePropertyRow row in rows)
            {
                foreach (DefinedName name in sheet.Names)
                {
                    var propertyValue = row.Values.FindByColumnName(name.Name);

                    object dataValue = null;

                    if (propertyValue != null)
                    {
                        if (propertyValue.Column.DataType != Data.DataObjects.ColumnDataType.String)
                        {
                            dataValue = DataConverter.ChangeType(typeof(string),
                                                                 propertyValue.Value,
                                                                 propertyValue.Column.RealDataType);
                        }
                        else
                        {
                            dataValue = propertyValue.Value;
                        }
                    }
                    else
                    {
                        if (matrix.MatrixType != WfMatrixType.ApprovalMatrix)
                        {
                            switch (name.Name.ToLower())
                            {
                            case "operatortype":
                                dataValue = row.OperatorType.ToString();
                                break;

                            case "operator":
                                dataValue = row.Operator;
                                break;
                            }
                        }
                    }

                    if (dataValue != null)
                    {
                        sheet.Cells[rowIndex, name.Address.StartColumn].Value = dataValue;
                    }
                }

                rowIndex++;
            }
        }
예제 #4
0
        /// <summary>
        /// 将活动矩阵与审批矩阵进行合并
        /// </summary>
        /// <param name="activieyMatrixResource"></param>
        /// <param name="approvalMatrix"></param>
        public static void MergeApprovalMatrix(this IWfMatrixContainer activieyMatrixResource, IWfMatrixContainer approvalMatrix)
        {
            activieyMatrixResource.NullCheck("activieyMatrixResource");
            approvalMatrix.NullCheck("approvalMatrix");

            activieyMatrixResource.Rows.MergeApprovalMatrix(
                    activieyMatrixResource.PropertyDefinitions,
                    approvalMatrix.Rows,
                    approvalMatrix.PropertyDefinitions
                );
        }
예제 #5
0
        /// <summary>
        /// 将活动矩阵与审批矩阵进行合并,以第一个矩阵的列定义为准
        /// </summary>
        /// <param name="activieyMatrixResource"></param>
        /// <param name="container"></param>
        public static void MergeActivityMatrix(this IWfMatrixContainer activieyMatrixResource, IWfMatrixContainer container)
        {
            activieyMatrixResource.NullCheck("activieyMatrixResource");
            container.NullCheck("container");

            activieyMatrixResource.Rows.MergeActivityMatrix(
                    activieyMatrixResource.PropertyDefinitions,
                    container.Rows,
                    container.PropertyDefinitions
                );
        }
예제 #6
0
        /// <summary>
        /// 将活动矩阵与审批矩阵进行合并
        /// </summary>
        /// <param name="activieyMatrixResource"></param>
        /// <param name="approvalMatrix"></param>
        public static void MergeApprovalMatrix(this IWfMatrixContainer activieyMatrixResource, IWfMatrixContainer approvalMatrix)
        {
            activieyMatrixResource.NullCheck("activieyMatrixResource");
            approvalMatrix.NullCheck("approvalMatrix");

            activieyMatrixResource.Rows.MergeApprovalMatrix(
                activieyMatrixResource.PropertyDefinitions,
                approvalMatrix.Rows,
                approvalMatrix.PropertyDefinitions
                );
        }
예제 #7
0
        /// <summary>
        /// 将活动矩阵与审批矩阵进行合并,以第一个矩阵的列定义为准
        /// </summary>
        /// <param name="activieyMatrixResource"></param>
        /// <param name="container"></param>
        public static void MergeActivityMatrix(this IWfMatrixContainer activieyMatrixResource, IWfMatrixContainer container)
        {
            activieyMatrixResource.NullCheck("activieyMatrixResource");
            container.NullCheck("container");

            activieyMatrixResource.Rows.MergeActivityMatrix(
                activieyMatrixResource.PropertyDefinitions,
                container.Rows,
                container.PropertyDefinitions
                );
        }
예제 #8
0
        /// <summary>
        /// 矩阵转换为Excel的WorkBook
        /// </summary>
        /// <param name="matrix"></param>
        /// <returns></returns>
        public static WorkBook ToWorkBook(this IWfMatrixContainer matrix)
        {
            WorkBook workBook = WorkBook.CreateNew();

            workBook.Sheets.Clear();

            WorkSheet sheet = matrix.ToWorkSheet(workBook);

            workBook.Sheets.Add(sheet);

            return(workBook);
        }
예제 #9
0
        /// <summary>
        /// 矩阵转换为Excel的WorkBook的流
        /// </summary>
        /// <param name="matrix"></param>
        /// <returns></returns>
        public static Stream ToExcelStream(this IWfMatrixContainer matrix)
        {
            matrix.NullCheck("matrix");

            WorkBook workBook = matrix.ToWorkBook();

            MemoryStream stream = new MemoryStream();

            workBook.Save(stream);
            stream.Seek(0, SeekOrigin.Begin);

            return(stream);
        }
예제 #10
0
        /// <summary>
        /// 转换为Excel的WorkSheet
        /// </summary>
        /// <param name="matrix"></param>
        /// <param name="workBook"></param>
        /// <returns></returns>
        public static WorkSheet ToWorkSheet(this IWfMatrixContainer matrix, WorkBook workBook)
        {
            matrix.NullCheck("matrix");

            WorkSheet sheet = new WorkSheet(workBook, "Matrix");

            Row titleRow = new Row(1)
            {
                Height = 30d
            };

            titleRow.Style.Fill.SetBackgroundColor(Color.LightGray, ExcelFillStyle.Solid);
            titleRow.Style.Font.Size = 20;
            sheet.Rows.Add(titleRow);

            sheet.Cells[titleRow.Index, 1].Value = "审批矩阵";

            CreateMatrixHeaderRow(matrix, sheet);

            FillMatrixSheetData(matrix, sheet);

            return(sheet);
        }
예제 #11
0
        public static void AssertAndOutputMatrixOperators(this IWfMatrixContainer matrix)
        {
            matrix.NullCheck("matrix");

            matrix.Rows.AssertAndOutputMatrixOperators();
        }