// Summary: // Load objects from database public async Task <bool> loadObjects(string objDefName) { if (parent == null) { return(false); } DGObjectsDefinition def = objsDefinitions[objDefName]; if (def == null) { return(false); } DGObjects objs = new DGObjects(def); objs.parent = this; objs.SetContainer(await objs.QueryAllByObjs()); // build a empty DGObjects for use objsContainer[def.Name] = objs; return(true); }
// Summary: // Load objects from database public bool loadObjects(string objDefName, DbContext dbContext) { if (parent == null) { return(false); } DGObjectsDefinition def = objsDefinitions[objDefName]; if (def == null) { return(false); } DGObjects objs = new DGObjects(def); bool success = objs.load(dbContext); objs.parent = this; // Old objs will be replaced recently loaded objects. if (success) { objsContainer[def.Name] = objs; } return(success); }
public bool loadObjects(string objDefName) { if (parent == null) { return(false); } DGObjectsDefinition def = objsDefinitions[objDefName]; if (def == null) { return(false); } DGObjects objs = new DGObjects(def); //bool success = objs.load(); objs.parent = this; // Old objs will be replaced recently loaded objects. //if (success) objsContainer[def.Name] = objs; return(true); }
public static DGObjectsDefinition LoadDefinition(XElement root) { DGObjectsDefinition def = new DGObjectsDefinition(); XAttribute attr; def.Type = root.Name.ToString(); attr = root.Attribute("Name"); if (attr != null) { def.Name = (string)attr; } attr = root.Attribute("HasGeometry"); if (attr != null) { def.HasGeometry = (bool)attr; } attr = root.Attribute("GISLayerName"); if (attr != null) { def.GISLayerName = (string)attr; } attr = root.Attribute("Has3D"); if (attr != null) { def.Has3D = (bool)attr; } attr = root.Attribute("Layer3DName"); if (attr != null) { def.Layer3DName = (string)attr; } attr = root.Attribute("TableNameSQL"); if (attr != null) { def.TableNameSQL = (string)attr; } attr = root.Attribute("DefNamesSQL"); if (attr != null) { def.DefNamesSQL = (string)attr; } attr = root.Attribute("ConditionSQL"); if (attr != null) { def.ConditionSQL = (string)attr; } attr = root.Attribute("OrderSQL"); if (attr != null) { def.OrderSQL = (string)attr; } return(def); }
getSelectedObjs(Domain domain, string objType) { Dictionary <string, IEnumerable <int> > selectedObjsDict = new Dictionary <string, IEnumerable <int> >(); foreach (string objdefName in objSelectedIndex.Keys) { DGObjectsDefinition definition = objsDefIndex[objdefName].definition; if ((objsDefIndex[objdefName].parent.name == domain.name) && (definition.Type == objType)) { selectedObjsDict.Add(objdefName, objSelectedIndex[objdefName]); } } return(selectedObjsDict); }
// Summary: // Load a Domain from XML element public static Domain loadDefinition(XElement root) { string name = root.Attribute("Name").Value; string type = root.Attribute("Type").Value; DomainType domainType = (DomainType)Enum.Parse(typeof(DomainType), type); Domain domain = new Domain(name, domainType); // Load tree definition // XElement treeDefNode = root.Element("TreeDefinition"); if (treeDefNode != null) { // only first node is loaded, other nodes are ignored. IEnumerable <XElement> nodes = treeDefNode.Elements(); if (nodes.Count() > 0) { XElement node = nodes.First(); domain.root = Tree.Element2Tree(node); } } // Load DGObjects definition // XElement objsDefNode = root.Element("ObjsDefinition"); if (objsDefNode != null) { IEnumerable <XElement> nodes = objsDefNode.Elements(); foreach (XElement node in nodes) { DGObjectsDefinition def = DGObjectsDefinition.LoadDefinition(node); domain.objsDefinitions.Add(def.Name, def); } } return(domain); }
// Summary: // Constructors public DGObjects(DGObjectsDefinition def) { //_objs = new Dictionary<string, DGObject>(); definition = def; }