Click or drag to resize

clsImportCustomerLocationTree Class

Import the customer location for customer service objects and equipment.

MS Access table: MARIProjektImportCustomerTrees. See clsImportBase.eImportMode relative tables in MS-Access.

Use MPInterface.bImportCustomerLocationTree(clsImportCustomerLocationTree, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportCustomerLocationTree

Namespace:  MARIInterface
Assembly:  MARIInterface (in MARIInterface.dll) Version: 8.0.0.100
Syntax
public class clsImportCustomerLocationTree : clsImportBase

The clsImportCustomerLocationTree type exposes the following members.

Constructors
  NameDescription
Public methodclsImportCustomerLocationTree
Initializes a new instance of the clsImportCustomerLocationTree class
Top
Properties
  NameDescription
Public propertyCardCode
CardCode
Public propertyCompanyID
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.
Public propertyLocationTreeID
Internal ID will be set during the import. < 100,000 used in the MS Access Table to link the table MARIProjektImportCustomerTreeElements as reference.
Public propertyLocationTreeName
Mainly the nam of the customer is used to identify the location tree.
Public propertyMemo
Free text as hints to use the tree
Top
Methods
Remarks
Examples
Create a location tree and elements with hiearchy
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;
    }
}
See Also