public ContentRow GreateRow(string id) { if (ContentRow.ContainsID(id)) return null; ContentRow row = new ContentRow(this); //初始化值 foreach (ConstructItem constructItem in _ConstuctFile.ConstructItems) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { ContentItem contentItem = new ContentItem(row, constructItem, i + 1); if (constructItem.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_ID_CODE) { contentItem.Value = id; } else { contentItem.Value = constructItem.ItemDefault; } row.AddContentItem(contentItem); } } AddContentRow(row); return row; }
public static void ReadItem(ConstructItem constructItem, DataRecord data, ref ContentRow row) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { if (constructItem.ItemCode == "rate") { int test = 1 + 1; } ContentItem contentItem = new ContentItem(row, constructItem, i + 1); string columnName = constructItem.Name; if (constructItem.ItemRepeat > 1) { columnName = (constructItem.Name + (i + 1).ToString()); } columnName = "\"" + columnName + "\""; if (data.HeaderRecord.Contains(columnName)) { contentItem.Value = data[columnName]; } else { contentItem.Value = ""; } row.AddContentItem(contentItem); } }
public ContentRow GreateRow(string id) { if (ContentRow.ContainsID(id)) { return(null); } ContentRow row = new ContentRow(this); //初始化值 foreach (ConstructItem constructItem in _ConstuctFile.ConstructItems) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { ContentItem contentItem = new ContentItem(row, constructItem, i + 1); if (constructItem.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_ID_CODE) { contentItem.Value = id; } else { contentItem.Value = constructItem.ItemDefault; } row.AddContentItem(contentItem); } } AddContentRow(row); return(row); }
public static void CreateNewFile(ConstructFile construct) { ContentFile contentFile = new ContentFile(construct); contentFile.Name = construct.Name; ContentRow row = new ContentRow(contentFile); foreach (ConstructItem constructItem in construct.ConstructItems) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { ContentItem contentItem = new ContentItem(row, constructItem, i + 1); if (constructItem.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_ID_CODE) { contentItem.Value = ContentConfig.CONTENT_INIT_DEFAULT_ID; } else { contentItem.Value = ""; } row.AddContentItem(contentItem); } } contentFile.AddContentRow(row); TableContentManager.Instance.AddContentFile(contentFile); }
public static void CreateNewFile(ConstructFile construct) { ContentFile contentFile = new ContentFile(construct); contentFile.Name = construct.Name; ContentRow row = new ContentRow(contentFile); foreach (ConstructItem constructItem in construct.ConstructItems) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { ContentItem contentItem = new ContentItem(row, constructItem, i + 1); if (constructItem.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_ID_CODE) { contentItem.Value = ContentConfig.CONTENT_INIT_DEFAULT_ID; } else { contentItem.Value = ""; } row.AddContentItem(contentItem); } } contentFile.AddContentRow(row); TableContentManager.Instance.AddContentFile(contentFile); }
public static void ReadItem(ConstructItem constructItem, DataRecord data, ref ContentRow row) { for (int i = 0; i < constructItem.ItemRepeat; ++i) { ContentItem contentItem = new ContentItem(row, constructItem, i + 1); string columnName = constructItem.Name; if (constructItem.ItemRepeat > 1) { columnName = (constructItem.Name + (i + 1).ToString()); } columnName = "\"" + columnName + "\""; if (data.HeaderRecord.Contains(columnName)) { contentItem.Value = data[columnName]; } else { contentItem.Value = ""; } row.AddContentItem(contentItem); } }