Click or drag to resize

clsImportWorkItemServicePlanTemplate Class

Info for table MPWorkItem: Service Plan Template

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

Use MPInterface.bImportServicePlanTemplate(clsImportWorkItemServicePlanTemplate, clsImportBaseeImportMode) to import.

Use clsImportWorkItemServicePlanTemplatePosition to import positions to the service template (Spare parts, services and template for).

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportWorkItemServicePlanTemplate

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

The clsImportWorkItemServicePlanTemplate type exposes the following members.

Constructors
  NameDescription
Public methodclsImportWorkItemServicePlanTemplate
Initializes a new instance of the clsImportWorkItemServicePlanTemplate class
Top
Methods
  NameDescription
Public methodGetListUserDefinedFields
Returns the user defined field definition for all dimension "WorkItem: Service Plan Template, Service Plan, Service Task, etc.". The fields have to be defined directly in MARIProject.
(Overrides clsImportBaseGetListUserDefinedFields(MPInterface).)
Top
Fields
  NameDescription
Public fieldCheckList
CheckList (int)
Public fieldCompanyID
Company ID. Link to the logical link to the SBO Database(Schema)
Public fieldCurrency
Currency (NVARCHAR 3)
Public fieldCycleType
Cycle Type
Public fieldCycleValue
Cycle Value = Number of month. For standard CycleType this value is set automatically
Public fieldExchangeRate
Exchange Rate (decimal)
Public fieldMatchcode
Matchcode
Public fieldResetStatusOnReturnEquipment
Then this is true, the linked service tasks will be reset, by rescheduling, that a hew due date will be used on return. This setting in the template will be copied to new created service plans.
Public fieldScheduleType
Handling definition to create the plan dates for a service plan. See eScheduleType.
Public fieldServiceplanID
Serviceplan ID Internal ID (not visible). Can be 0. For access this number should be <100000 to link the positions
Public fieldTemplateSource
Template Source
Public fieldTemplateValue
Template Value (NVARCHAR 20). Reference to item group, item, equipment category
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