Click or drag to resize

MPInterfaceoGetGroups Method

Returns all Groups values to find an id by name. See also clsImportGroups.

Namespace:  MARIInterface
Assembly:  MARIInterface (in MARIInterface.dll) Version: 8.0.0.100
Syntax
public List<clsKeyPair> oGetGroups(
	clsImportGroupseGroupType nGroupType
)

Parameters

nGroupType
Type: MARIInterfaceclsImportGroupseGroupType
See clsImportQualification.GroupId for the list of group types

Return Value

Type: ListclsKeyPair
Remarks
Examples
Get existing group or create a new group
public int GetOrCreateGroup(clsImportGroups.eGroupType nGroupType, string GroupName) {
    List<MARIInterface.clsKeyPair> ListOfGroup;
    //Load list all group values
    ListOfGroup = oMPInterface.oGetGroups(nGroupType);

    //Seach if groups is existing
    foreach (MARIInterface.clsKeyPair oPair in ListOfGroup) {
        if (oPair.sMatchcode.ToUpper() == GroupName.ToUpper()) {
            return Int32.Parse(oPair.sKeyInternal);
        }
    }

    //Group not found, create it
    clsImportGroups NewGroup = new clsImportGroups();
    NewGroup.GroupType = nGroupType;
    NewGroup.Description = GroupName;
    if (oMPInterface.bImportGroup(NewGroup, clsImportBase.eImportMode.ValidateAndImport)) {
        return NewGroup.GroupID;
    } else {
        string sErrordetails = oMPInterface.oErrors.PrintErrors(true);
        Assert.False(true, sErrordetails);
        return 0;
    }
}
See Also