clsImportCustomerLocationTree Class |
MS Access table: MARIProjektImportCustomerTrees. See clsImportBase.eImportMode relative tables in MS-Access.
Use MPInterface.bImportCustomerLocationTree(clsImportCustomerLocationTree, clsImportBaseeImportMode) to import.
Namespace: MARIInterface
The clsImportCustomerLocationTree type exposes the following members.
| Name | Description | |
|---|---|---|
| clsImportCustomerLocationTree | Initializes a new instance of the clsImportCustomerLocationTree class |
| Name | Description | |
|---|---|---|
| CardCode | CardCode | |
| CompanyID | CompanyID to link the customer to the location tree. In the import only one (mandatory) customer can be linked. In the application additional customters can be linked. | |
| LocationTreeID |
Internal ID will be set during the import. < 100,000 used in the MS Access Table to link the table MARIProjektImportCustomerTreeElements as reference.
| |
| LocationTreeName | Mainly the nam of the customer is used to identify the location tree. | |
| Memo | Free text as hints to use the tree |
| 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; } }