Click or drag to resize

clsImportCustomerLocationTreeElement Class

Import the customer location elements for customer service objects and equipment.

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

Use MPInterface.bImportCustomerLocationTreeElement(clsImportCustomerLocationTreeElement, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportCustomerLocationTreeElement

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

The clsImportCustomerLocationTreeElement type exposes the following members.

Constructors
  NameDescription
Public methodclsImportCustomerLocationTreeElement
Initializes a new instance of the clsImportCustomerLocationTreeElement class
Top
Properties
  NameDescription
Public propertyBarcode
Field to search for the location via a unique bar code.
Public propertyBlock
Address Information of the location: Block
Public propertyBuilding
Address Information of the location: Building
Public propertyCity
Address Information of the location: City
Public propertyCountry
Address Information of the location: Country
Public propertyCounty
Address Information of the location: County
Public propertyCreationMode
Manages the creation of leaves and parents
Public propertyElementID
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
Public propertyElementName
Visible name of the location in the tree.
Public propertyElementNameShort
Abbriviation of the location to build a short combinations of each element in the hierarchy.
Public propertyLatitude
Geo Location
Public propertyLevelName1
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.
Public propertyLevelName2
Name of hierarchy 2
Public propertyLevelName3
Name of hierarchy 3
Public propertyLevelName4
Name of hierarchy 4
Public propertyLevelName5
Name of hierarchy 5
Public propertyLevelName6
Name of hierarchy 6
Public propertyLevelName7
Name of hierarchy 7
Public propertyLevelName8
Name of hierarchy 8
Public propertyLevelName9
Name of hierarchy 9
Public propertyLevelSearchKey1
Search key of hierarchy 1
Public propertyLevelSearchKey2
Search key of hierarchy 2
Public propertyLevelSearchKey3
Search key of hierarchy 3
Public propertyLevelSearchKey4
Search key of hierarchy 4
Public propertyLevelSearchKey5
Search key of hierarchy 5
Public propertyLevelSearchKey6
Search key of hierarchy 6
Public propertyLevelSearchKey7
Search key of hierarchy 7
Public propertyLevelSearchKey8
Search key of hierarchy 8
Public propertyLevelSearchKey9
Search key of hierarchy 9
Public propertyLocationTreeID
Logical link to the tree header (Linked to a customer). Field in MS Access database is updated after the import of the table MARIProjektImportCustomerTrees
Public propertyLongitude
Geo Location
Public propertyResponsible
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.
Public propertySearchMode
Mandatory if you don't like to search by ElementName. Maybe Barcode or UDFs
Public propertyState
Address Information of the location: State
Public propertyStreet
Address Information of the location: Street
Public propertyStreetNumber
Address Information of the location: StreetNumber
Public propertyZipCode
Address Information of the location: ZipCode
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;
    }
}
Create a location tree and elements with hiearchy based on barcodes
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;
    }
}
See Also