Ejemplo n.º 1
0
        public WfMatrix BuildWfMatrix()
        {
            var matrixDef = BuildNewMatrixDef(_matrixColumnNum);

            WfMatrix matrixInstance = new WfMatrix(matrixDef)
            {
                CreatorID   = "testCreatorID1",
                CreatorName = "testCreatorName1",
                MatrixID    = UuidHelper.NewUuidString(),
                ProcessKey  = "testProcessKey",
                ActivityKey = "testActivityKey"
            };

            for (int i = 0; i < _matrixRowNum; i++)
            {
                var row = new WfMatrixRow()
                {
                    RowNumber    = i,
                    OperatorType = WfMatrixOperatorType.Person,
                    Operator     = "wanhw"
                };

                if (i % 2 == 0)
                {
                    row.Operator = "fanhy";
                }

                for (int j = 0; j < matrixDef.Dimensions.Count; j++)
                {
                    row.Cells.Add(new WfMatrixCell(matrixDef.Dimensions[j])
                    {
                        StringValue = "String" + j.ToString()
                    });
                }
                matrixInstance.Rows.Add(row);
            }

            return(matrixInstance);
        }
		private static WfMatrixRow AddMatrixRow(WfMatrix matrix, params string[] values)
		{
			WfMatrixRow row = new WfMatrixRow(matrix);

			row.RowNumber = matrix.Rows.Count;

			for (int i = 0; i < matrix.Definition.Dimensions.Count; i++)
			{
				WfMatrixDimensionDefinition dd = matrix.Definition.Dimensions[i];

				WfMatrixCell cell = new WfMatrixCell(dd);

				if (i < values.Length)
					cell.StringValue = values[i];

				row.Cells.Add(cell);
			}

			matrix.Rows.Add(row);

			return row;
		}
Ejemplo n.º 3
0
        private static WfMatrixRow AddMatrixRow(WfMatrix matrix, params string[] values)
        {
            WfMatrixRow row = new WfMatrixRow(matrix);

            row.RowNumber = matrix.Rows.Count;

            for (int i = 0; i < matrix.Definition.Dimensions.Count; i++)
            {
                WfMatrixDimensionDefinition dd = matrix.Definition.Dimensions[i];

                WfMatrixCell cell = new WfMatrixCell(dd);

                if (i < values.Length)
                {
                    cell.StringValue = values[i];
                }

                row.Cells.Add(cell);
            }

            matrix.Rows.Add(row);

            return(row);
        }
Ejemplo n.º 4
0
        protected void uploadProgress_DoUploadProgress(HttpPostedFile file, UploadProgressResult result)
        {
            ExceptionHelper.FalseThrow(Path.GetExtension(file.FileName).ToLower() == ".xml", "'{0}'权限矩阵必须是xml电子表格", file.FileName);

            WorkbookNode workbook = new WorkbookNode();

            workbook.Load(file.InputStream);

            //矩阵在文件第1个sheet,sheet名称为矩阵引用的定义名称
            TableNode table = workbook.Worksheets[0].Table;

            var matrixDef = WfMatrixDefinitionAdapter.Instance.Load(workbook.Worksheets[0].Name);

            WfMatrix matrix = new WfMatrix(matrixDef)
            {
                MatrixID = Guid.NewGuid().ToString()
            };

            if (table.Rows.Count <= 1)
            {
                PrepareResultInfo(result, "没有数据或格式不正确");
                return;
            }

            UploadProgressStatus status = new UploadProgressStatus();

            status.CurrentStep = 1;
            status.MinStep     = 0;
            status.MaxStep     = table.Rows.Count;

            for (int i = status.CurrentStep; i < status.MaxStep; i++)
            {
                var newRow = new WfMatrixRow()
                {
                    RowNumber = i
                };

                for (int j = 0; j < table.Rows[i].Cells.Count; j++)
                {
                    if (table.Rows[0].Cells[j].Data.InnerText == "操作人")
                    {
                        newRow.Operator = table.Rows[i].Cells[j].Data.InnerText;
                        continue;
                    }

                    var newCell = new WfMatrixCell(matrixDef.Dimensions[table.Rows[0].Cells[j].Data.InnerText])
                    {
                        StringValue = table.Rows[i].Cells[j].Data.InnerText
                    };

                    newRow.Cells.Add(newCell);
                }
                matrix.Rows.Add(newRow);

                status.CurrentStep = i;
                status.Response();
                Thread.Sleep(100);
            }

            status.CurrentStep = status.MaxStep;
            status.Response();

            WfMatrixAdapter.Instance.Update(matrix);

            string logInfo = string.Format("导入成功,权限矩阵名称:{0}{1}共导入{2}行数据.", matrix.MatrixID, Environment.NewLine, table.Rows.Count - 1);

            PrepareResultInfo(result, logInfo);
        }
Ejemplo n.º 5
0
		public WfMatrix BuildWfMatrix()
		{
			var matrixDef = WfMatrixDefinitionAdapterTest.BuildNewMatrixDef(_matrixColumnNum);

			WfMatrix matrixInstance = new WfMatrix(matrixDef)
			{
				CreatorID = "testCreatorID1",
				CreatorName = "testCreatorName1",
				MatrixID = UuidHelper.NewUuidString(),
				ProcessKey = "testProcessKey",
				ActivityKey = "testActivityKey"
			};

			for (int i = 0; i < _matrixRowNum; i++)
			{
				var row = new WfMatrixRow()
				{
					RowNumber = i,
					OperatorType = WfMatrixOperatorType.Person,
					Operator = "wanhw"
				};

				if (i % 2 == 0)
				{
					row.Operator = "fanhy";
				}

				for (int j = 0; j < matrixDef.Dimensions.Count; j++)
				{
					row.Cells.Add(new WfMatrixCell(matrixDef.Dimensions[j])
					{
						StringValue = "String" + j.ToString()
					});
				}
				matrixInstance.Rows.Add(row);
			}

			return matrixInstance;
		}