private void WriteDataRow(XmlWriter writer, CremaDataRow dataRow) { var dataTable = dataRow.Table; writer.WriteStartElement(dataTable.GetXmlName(this.targetNamespace)); foreach (var item in dataTable.Attributes) { if (item.IsVisible == false) { continue; } this.WriteAttribute(writer, dataRow.InternalObject, item.InternalAttribute); } if (dataTable.Childs.Count > 0) { writer.WriteStartAttribute(CremaSchema.RelationID); writer.WriteValue(dataRow.Field <string>(dataTable.RelationColumn)); writer.WriteEndAttribute(); } foreach (var item in dataTable.Columns) { WriteField(writer, dataRow, item); } if (dataTable.Childs.Count > 0) { var relationID = dataRow.Field <string>(dataTable.RelationColumn); foreach (var child in dataTable.Childs) { var rows = child.Select(string.Format("{0} = '{1}'", "__ParentID__", relationID)); foreach (var row in rows) { this.WriteDataRow(writer, row); } } } writer.WriteEndElement(); }
private void WriteDataRow(XmlWriter writer, CremaDataRow dataRow) { var dataTable = dataRow.Table; writer.WriteStartElement(dataTable.GetXmlName(this.targetNamespace)); foreach (var item in dataTable.Attributes) { if (item.IsVisible == false) { continue; } this.WriteAttribute(writer, dataRow.InternalObject, item.InternalAttribute); } if (dataTable.ColumnRelation != null) { writer.WriteStartAttribute(CremaSchema.RelationID); writer.WriteValue(dataRow.Field <string>(dataTable.ColumnRelation)); writer.WriteEndAttribute(); } if (dataTable.ParentRelation != null) { writer.WriteStartAttribute(CremaSchema.ParentID); writer.WriteValue(dataRow.Field <string>(dataTable.ParentRelation)); writer.WriteEndAttribute(); } foreach (var item in dataTable.Columns) { WriteField(writer, dataRow, item); } writer.WriteEndElement(); }
static void Write(string outputPath, CremaDataRow dataRow) { var localPath = dataRow.Field <string>("ProjectPath").Replace(PathUtility.SeparatorChar, Path.DirectorySeparatorChar); var projectPath = Path.Combine(outputPath, localPath); var projectXml = File.ReadAllText(projectPath); var projectInfo = new ProjectInfo(projectXml); foreach (var item in projectInfo.ResxInfos) { var dataTable = FindDataTable(item); if (dataTable == null) { continue; } Write(Path.GetDirectoryName(projectPath), item, dataTable); if (item.ResgenFileName != string.Empty) { WriteDesigner(Path.GetDirectoryName(projectPath), projectInfo, item); } } CremaDataTable FindDataTable(ResxInfo resxInfo) { foreach (var item in dataRow.GetChildRows("ExportInfo")) { if (item.Field <string>("FileName") == resxInfo.Name) { var tableName = item.Field <string>("TableName"); return(dataRow.Table.DataSet.Tables[tableName]); } } return(null); } }