/// <summary> /// 从DataRow构造行信息 /// </summary> /// <param name="rows"></param> /// <param name="definitions"></param> internal void FromDataTable(DataRowCollection rows, IEnumerable <WfClientRolePropertyDefinition> definitions) { rows.NullCheck("rows"); definitions.NullCheck("definitions"); this.Clear(); int rowIndex = 1; foreach (DataRow row in rows) { WfClientRolePropertyRow mRow = new WfClientRolePropertyRow() { RowNumber = rowIndex++ }; foreach (WfClientRolePropertyDefinition dimension in definitions) { WfClientRolePropertyValue mCell = new WfClientRolePropertyValue(dimension); mCell.Value = row[dimension.Name].ToString(); switch (dimension.Name) { case "Operator": mRow.Operator = row[dimension.Name].ToString(); break; case "OperatorType": WfClientRoleOperatorType opType = WfClientRoleOperatorType.User; Enum.TryParse(row[dimension.Name].ToString(), out opType); mRow.OperatorType = opType; break; default: break; } mRow.Values.Add(mCell); } this.Add(mRow); } }
public static SOARoleOperatorType ToRoleOperatorType(this WfClientRoleOperatorType opType) { return((SOARoleOperatorType)opType); }