public static ArrayList GetEntityPatch(projectsettingsEntityexport pEntityExport) { ArrayList aRet = new ArrayList(); if (pEntityExport.patchentities != null) { foreach (projectsettingsEntityexportPatchentity e in pEntityExport.patchentities) { aRet.Add(e.entity); } } return(aRet); }
public static DataView GetExportEntityOptions(projectsettingsEntityexport pEntityExport, XmlDocument pDbDefinitionDocument) { DataTable dt = new DataTable(); dt.Columns.Add("Entity", typeof(string)); dt.Columns.Add("SortNo", typeof(int)); dt.Columns.Add("ExportStructure", typeof(bool)); dt.Columns.Add("ExportData", typeof(bool)); dt.Columns.Add("ExportDrop", typeof(bool)); dt.Columns["ExportStructure"].DefaultValue = false; dt.Columns["ExportData"].DefaultValue = false; dt.Columns["ExportDrop"].DefaultValue = false; ArrayList alEntity = new ArrayList(); if (pEntityExport.exportentities != null) { alEntity.AddRange(pEntityExport.exportentities); } ArrayList alEntityName = new ArrayList(); foreach (XmlNode node in pDbDefinitionDocument.SelectNodes("/db-definition/entities/entity")) { string strEntity = node.Attributes["name"].Value; alEntityName.Add(strEntity); projectsettingsEntityexportExportentity expentity = null; foreach (projectsettingsEntityexportExportentity e in alEntity) { if (e.entity.Equals(strEntity)) { expentity = e; break; } } if (expentity == null) { expentity = new projectsettingsEntityexportExportentity(); expentity.entity = strEntity; expentity.exportstructure = true; expentity.exportdata = true; expentity.exportdrop = false; alEntity.Add(expentity); } DataRow row = dt.NewRow(); row["Entity"] = expentity.entity; if (PVFormatUtil.ParseInt(expentity.sortno) != 0) { row["SortNo"] = expentity.sortno; } row["ExportStructure"] = expentity.exportstructure; row["ExportData"] = expentity.exportdata; row["ExportDrop"] = expentity.exportdrop; dt.Rows.Add(row); } foreach (projectsettingsEntityexportExportentity expentity in alEntity) { if (!alEntityName.Contains(expentity.entity)) { alEntityName.Add(expentity.entity); DataRow row = dt.NewRow(); row["Entity"] = expentity.entity; if (PVFormatUtil.ParseInt(expentity.sortno) != 0) { row["SortNo"] = expentity.sortno; } row["ExportStructure"] = expentity.exportstructure; row["ExportData"] = expentity.exportdata; row["ExportDrop"] = expentity.exportdrop; dt.Rows.Add(row); } } pEntityExport.exportentities = (projectsettingsEntityexportExportentity[])alEntity.ToArray(typeof(projectsettingsEntityexportExportentity)); DataView dv = new DataView(dt); dv.AllowEdit = true; dv.AllowNew = true; dv.AllowDelete = true; dv.Sort = "SortNo, Entity"; return(dv); }