internal static void CopyFromDataSrc(this ColumnMetadata col, ColumnMetadata[] data) { var entry = data.FirstOrDefault( x => string.Equals(x.table_name, col.table_name, C) && string.Equals(x.column_name, col.column_name, C)); if (entry == null) return; col.CopyFrom(entry); }
/// <summary> /// 将活动矩阵与审批矩阵进行合并 /// </summary> /// <param name="amRows"></param> /// <param name="amDefinitions"></param> /// <param name="apRows"></param> /// <param name="apDefinitions"></param> public static void MergeApprovalMatrix(this SOARolePropertyRowCollection amRows, SOARolePropertyDefinitionCollection amDefinitions, IEnumerable<SOARolePropertyRow> apRows, SOARolePropertyDefinitionCollection apDefinitions) { amDefinitions.NullCheck("amDefinitions"); amRows.NullCheck("amRows"); apDefinitions.NullCheck("apDefinitions"); apRows.NullCheck("apRows"); int maxActivitySN = GetMaxActivitySN(amRows); int maxRowNumber = GetMaxRowNumber(amRows); List<SOARolePropertyRow> newAmRows = new List<SOARolePropertyRow>(); foreach (SOARolePropertyRow apRow in apRows) { int columnIndex = 1; while (columnIndex < apDefinitions.Count) { List<SOARolePropertyRow> amUserRows = FindMatchedActivityMatrixUserRows(amRows, apDefinitions[columnIndex].Name, apRow); List<SOARolePropertyRow> amTemplateRows = FindMatchedActivityMatrixTemplateRows(amRows, apDefinitions[columnIndex].Name, apRow); string apUser = apRow.Values.GetValue(apDefinitions[columnIndex].Name, string.Empty); if (amUserRows.Count == 0 && apUser.IsNotEmpty()) { SOARolePropertyRow templateRow = amTemplateRows.LastOrDefault(); maxActivitySN += 10; SOARolePropertyRow amRow = CreateNewActivityMatrixRow(maxActivitySN, ++maxRowNumber, amDefinitions, templateRow); newAmRows.Add(amRow); MergeToActivityMatrixRow(amRow, amDefinitions, apUser); } else { foreach (SOARolePropertyRow amRow in amUserRows) MergeToActivityMatrixRow(amRow, amDefinitions, apUser); } columnIndex++; } } amRows.CopyFrom(newAmRows); }
/// <summary>复制数据表到另一个数据表,复制所有数据列、索引和关系</summary> /// <param name="src"></param> /// <param name="des"></param> /// <param name="resetColumnID">是否重置列ID</param> /// <returns></returns> public static IDataTable CopyAllFrom(this IDataTable src, IDataTable des, Boolean resetColumnID = false) { src.CopyFrom(des); src.Columns.AddRange(des.Columns.Select(i => src.CreateColumn().CopyFrom(i))); src.Indexes.AddRange(des.Indexes.Select(i => src.CreateIndex().CopyFrom(i))); src.Relations.AddRange(des.Relations.Select(i => src.CreateRelation().CopyFrom(i))); // 重载ID if (resetColumnID) src.Columns.ForEach((it, i) => it.ID = i + 1); return src; }
/// <summary> /// Try to paste the entire GraphDocument from the clipboard using the specified paste options. /// </summary> /// <param name="doc">The graph document to paste into.</param> /// <param name="options">The options used for paste into that graph.</param> public static void PasteFromClipboard(this GraphDocument doc, GraphCopyOptions options) { object from = ClipboardSerialization.GetObjectFromClipboard("Altaxo.Graph.Graph3D.GraphDocumentAsXml"); if (from is GraphDocument) { doc.CopyFrom((GraphDocument)from, options); } }