clsImportCustomerLocationTreeElement Class |
MS Access table: MARIProjektImportCustomerTreeElements. See clsImportBase.eImportMode relative tables in MS-Access.
Use MPInterface.bImportCustomerLocationTreeElement(clsImportCustomerLocationTreeElement, clsImportBaseeImportMode) to import.
Namespace: MARIInterface
The clsImportCustomerLocationTreeElement type exposes the following members.
| Name | Description | |
|---|---|---|
| clsImportCustomerLocationTreeElement | Initializes a new instance of the clsImportCustomerLocationTreeElement class |
| Name | Description | |
|---|---|---|
| Barcode | Field to search for the location via a unique bar code. | |
| Block | Address Information of the location: Block | |
| Building | Address Information of the location: Building | |
| City | Address Information of the location: City | |
| Country | Address Information of the location: Country | |
| County | Address Information of the location: County | |
| CreationMode |
Manages the creation of leaves and parents
| |
| ElementID | Customer Location Tree Element ID. Internal key. Can be 0 for the import. It can be used < 100,000 in the depending tables as a reference to the tree element. See clsImportBase.eImportMode depending tables in MS-Access | |
| ElementName | Visible name of the location in the tree. | |
| ElementNameShort | Abbriviation of the location to build a short combinations of each element in the hierarchy. | |
| Latitude | Geo Location | |
| LevelName1 | Name of hierarchy 1: The hierarchy can be build/find using the names or barcodes of the hiearchy elements. The mechanism is based in the clsImportCustomerLocationTreeElementeSearchMode used. | |
| LevelName2 | Name of hierarchy 2 | |
| LevelName3 | Name of hierarchy 3 | |
| LevelName4 | Name of hierarchy 4 | |
| LevelName5 | Name of hierarchy 5 | |
| LevelName6 | Name of hierarchy 6 | |
| LevelName7 | Name of hierarchy 7 | |
| LevelName8 | Name of hierarchy 8 | |
| LevelName9 | Name of hierarchy 9 | |
| LevelSearchKey1 | Search key of hierarchy 1 | |
| LevelSearchKey2 | Search key of hierarchy 2 | |
| LevelSearchKey3 | Search key of hierarchy 3 | |
| LevelSearchKey4 | Search key of hierarchy 4 | |
| LevelSearchKey5 | Search key of hierarchy 5 | |
| LevelSearchKey6 | Search key of hierarchy 6 | |
| LevelSearchKey7 | Search key of hierarchy 7 | |
| LevelSearchKey8 | Search key of hierarchy 8 | |
| LevelSearchKey9 | Search key of hierarchy 9 | |
| LocationTreeID | Logical link to the tree header (Linked to a customer). Field in MS Access database is updated after the import of the table MARIProjektImportCustomerTrees | |
| Longitude | Geo Location | |
| Responsible | Employee responsible. Used for notifications (can be used for example only inthe first hierarchy and a message linked to a leave in the tree will be send to the employee in the first indent.). See clsImportEmployee for the employee dimension. | |
| SearchMode |
Mandatory if you don't like to search by ElementName. Maybe Barcode or UDFs
| |
| State | Address Information of the location: State | |
| Street | Address Information of the location: Street | |
| StreetNumber | Address Information of the location: StreetNumber | |
| ZipCode | Address Information of the location: ZipCode |
| Name | Description | |
|---|---|---|
| bSaveRSToMDB | (Overrides clsImportBasebSaveRSToMDB(MPInterface, DataRow, DataTable).) |
public bool CreateLocationTreeExample() { string sCardCode = "10002"; short nCompany = 1; int lElem; int lTreeID = lGetCreateLocationTree("School Buildings", sCardCode, nCompany); if (lTreeID != 0) { lElem = lGetCreateLocationTreeElement(lTreeID, "Main Building"); lElem = lGetCreateLocationTreeElement(lTreeID, "First Floor", "Main Building"); lElem = lGetCreateLocationTreeElement(lTreeID, "Physics", "Main Building", "First Floor"); lElem = lGetCreateLocationTreeElement(lTreeID, "Mathematics", "Main Building", "First Floor"); lElem = lGetCreateLocationTreeElement(lTreeID, "Second Floor", "Main Building"); lElem = lGetCreateLocationTreeElement(lTreeID, "Staff Room", "Main Building", "Second Floor"); return (lElem != 0); } else { return false; } } public int lGetCreateLocationTree(string sTreeName, string sCardCode, short nCompany) { clsImportCustomerLocationTree NewTree = new clsImportCustomerLocationTree(); NewTree.CompanyID = nCompany; NewTree.LocationTreeName = sTreeName; NewTree.CardCode = sCardCode; if (oMPInterface.bImportCustomerLocationTree(NewTree, clsImportBase.eImportMode.ValidateAndImport)) { return NewTree.LocationTreeID; } else { throw new Exception(string.Format("lGetCreateLocationTree({0},{1},{2}): oMPInterface.bImportCustomerLocationTree failed.", sTreeName, sCardCode, nCompany) + oMPInterface.oErrors.PrintErrors()); } } public int lGetCreateLocationTreeElement(int lLocationTreeID, string sElement, string sLeafIndent1 = null, string sLeafIndent2 = null) { clsImportCustomerLocationTreeElement NewTreeElement = new clsImportCustomerLocationTreeElement(); NewTreeElement.LocationTreeID = lLocationTreeID; NewTreeElement.ElementName = sElement; NewTreeElement.CreationMode = clsImportCustomerLocationTreeElement.eCreationMode.Create_Leafs_And_Node; // Create leaf or node if it does not exist. if (!string.IsNullOrEmpty(sLeafIndent1)) NewTreeElement.LevelName1 = sLeafIndent1; if (!string.IsNullOrEmpty(sLeafIndent2)) NewTreeElement.LevelName2 = sLeafIndent2; if (oMPInterface.bImportCustomerLocationTreeElement(NewTreeElement, clsImportBase.eImportMode.ValidateAndImport)) { return NewTreeElement.ElementID; } else { LogFail(string.Format("lGetCreateLocationTreeElement({0},\"{1}\",\"{2}\",\"{3}\"): oMPInterface.bImportCustomerLocationTreeElement failed.", lLocationTreeID, sElement, sLeafIndent1, sLeafIndent2) + oMPInterface.oErrors.PrintErrors()); return 0; } }
public bool CreateLocationTreeExampleBarCode() { string sCardCode = "10005"; short nCompany = 1; int lElem; int lTreeID = lGetCreateLocationTree("School Buildings Bar Code", sCardCode, nCompany); if (lTreeID != 0) { lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Main Building", "MB", "1200000"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "First Floor", "1st", "1200100", "1200000"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Physics", "Ph", "1200101", "1200000", "1200100"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Mathematics", "Ma", "1200102", "1200000", "1200100"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Staff Room", "Tea", "1200103", "1200000", "1200100"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Second Floor", "2nd", "1200200", "1200000"); lElem = lGetCreateLocationTreeElementBarCode(lTreeID, "Staff Room", "Tea", "1200201", "1200000", "1200200"); return (lElem != 0); } else { return false; } } public int lGetCreateLocationTreeElementBarCode(int lLocationTreeID, string sElement, string sShort, string sBarCode, string sBarCodeIndent1 = null, string sBarCodeIndent2 = null) { clsImportCustomerLocationTreeElement NewTreeElement = new clsImportCustomerLocationTreeElement(); NewTreeElement.LocationTreeID = lLocationTreeID; NewTreeElement.ElementName = sElement; NewTreeElement.ElementNameShort = sShort; NewTreeElement.Barcode = sBarCode; NewTreeElement.SearchMode = clsImportCustomerLocationTreeElement.eSearchMode.Barcode; // search for parents and already existing via BarCode NewTreeElement.CreationMode = clsImportCustomerLocationTreeElement.eCreationMode.Create_Leafs_And_Node; if (!string.IsNullOrEmpty(sBarCodeIndent1)) NewTreeElement.LevelName1 = sBarCodeIndent1; if (!string.IsNullOrEmpty(sBarCodeIndent2)) NewTreeElement.LevelName2 = sBarCodeIndent2; if (oMPInterface.bImportCustomerLocationTreeElement(NewTreeElement, clsImportBase.eImportMode.ValidateAndImport)) { return NewTreeElement.ElementID; } else { LogFail(string.Format("lGetCreateLocationTreeElementBarCode({0},\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"): oMPInterface.bImportCustomerLocationTreeElement failed.", lLocationTreeID, sElement, sShort, sBarCodeIndent1, sBarCodeIndent2) + oMPInterface.oErrors.PrintErrors()); return 0; } }