Click or drag to resize

clsImportWorkItemServicePlanTemplatePosition Class

Info for table MPWorkItemPosition: Positions for Service Plan Templates.

Access table MARIProjektImportWorkItemServicePlanTemplatePos

Use MPInterface.bImportServicePlanTemplatePosition(clsImportWorkItemServicePlanTemplatePosition, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportWorkItemServicePlanTemplatePosition
      MARIInterfaceclsImportWorkItemServicePlanPosition

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

The clsImportWorkItemServicePlanTemplatePosition type exposes the following members.

Constructors
  NameDescription
Public methodclsImportWorkItemServicePlanTemplatePosition
Initializes a new instance of the clsImportWorkItemServicePlanTemplatePosition class
Top
Fields
  NameDescription
Public fieldContractPosType
Contract Position Type
Public fieldDescription1
NVARCHAR (100) Description1
Public fieldDescription2
NVARCHAR (100) Description2
Public fieldMatchcode
NVARCHAR (100) Matchcode
Public fieldPosID
Position ID: Internal position ID: can be <100000. will be created
Public fieldPosType
Position Type. See ePosType.
Public fieldPosValue
Position Value (ItemCode,ServiceCode, Equipment Category, ItemGroup). This defines that the template is linked to the selected dimension.
Public fieldQuantity
Quantity
Public fieldQuantityInv
Quantity Invoicable
Public fieldServicePlanID
ServicePlanID Link to service plan or service plan template. (in access must be in synch with the header table)
Public fieldUnitPrice
Unit Price
Top
Remarks
Examples
Create a service template annualy
string sErrordetails;

try {
    clsImportWorkItemServicePlanTemplate NewServicePlanTemplate = new clsImportWorkItemServicePlanTemplate();
    NewServicePlanTemplate.Matchcode = "DTW Service Plan Template. Annualy";
    NewServicePlanTemplate.CycleType = clsImportWorkItemServicePlanTemplate.ePlanTemplateCycleType.Yearly;
    NewServicePlanTemplate.CompanyID = 1;

    //Add first link "Used By". This is equipvilant to add clsImportWorkItemServicePlanTemplatePosition.ePosType.BaseLineEquipment Positions.
    NewServicePlanTemplate.TemplateSource = clsImportWorkItemServicePlanTemplate.eTemplateSource.EquipmentCategory;
    NewServicePlanTemplate.TemplateValue = "100001"; // In this case the Id of the EquipmentCategory Master: SELECT EquipmentCategory FROM MARIEquipmentCategory

    if (oMPInterface.bImportServicePlanTemplate(NewServicePlanTemplate, clsImportBase.eImportMode.ValidateAndImport)) {
        // Add some service and spare parts
        clsImportWorkItemServicePlanTemplatePosition oPos;

        oPos = new clsImportWorkItemServicePlanTemplatePosition();
        oPos.ServicePlanID = NewServicePlanTemplate.ServiceplanID;
        oPos.PosType = clsImportWorkItemServicePlanTemplatePosition.ePlanTemplatePosType.Service;
        oPos.PosValue = "1080";//SELECT ServiceNumber FROM [TEMPLATE_FILM_US_PM]..MARIServices
        oPos.Quantity = 0.5m; // hours to perform this service
        oPos.Quantity = 0.5m;
        oPos.UnitPrice = 80m;
        oPos.ContractPosType = clsImportWorkItemServicePlanTemplatePosition.ePlanTemplateContractPosType.AtCost;
        oPos.Matchcode = "Repair Work";
        if (oMPInterface.bImportServicePlanTemplatePosition(oPos, clsImportBase.eImportMode.ValidateAndImport)) {
            sErrordetails = "";
        } else {
            sErrordetails = oMPInterface.oErrors.PrintErrors(true);
            LogFail(sErrordetails);
            return;
        }
        sErrordetails = "";
        return;
    }

    sErrordetails = oMPInterface.oErrors.PrintErrors(true);
    LogFail(sErrordetails);
    return;

} catch (Exception ex) {
    sErrordetails = ex.Message;
    LogFail(sErrordetails);
    return;
}
See Also