Click or drag to resize

clsImportEquipmentBookings Class

Import class to import equipment bookings. This class is very close to clsImportLine, but it covers the equipment bookings instead of time bookings.

Use MPInterface.bImportEquipmentBooking(clsImportEquipmentBookings, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportEquipmentBookings

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

The clsImportEquipmentBookings type exposes the following members.

Constructors
  NameDescription
Public methodclsImportEquipmentBookings
Initializes a new instance of the clsImportEquipmentBookings class
Top
Fields
  NameDescription
Public fieldActivity
ActivityText: Free Text
Public fieldApprovalFlag
The import can directly set the approval flag. This only works, if the user loged into the interface is allowed in the project to approve equipment bookings.
Public fieldApprovalText
ApprovalText
Public fieldContractID
ContractID: Contract Identifier. This is the internal identifier (INT) not the official contract number (char20).
Public fieldContractParentPositionID
Identifier of the contract position (INT).This is the main (parent) category contract position. Computed, if 0
Public fieldCostTypePositionID
ContractPositionID: Contract position ID for the required cost type in the contract. If 0, then the HelpCostType is used
Public fieldEmployeeNumber
Employee: User who is responsible for the transaction. Mostly the project manager. See clsImportEmployee for the employee dimension.
Public fieldEndTime
EndTime: End Time (0:01 to 23:59). StartTime=NULL and EndTime=NULL means full day
Public fieldEndTimeBillable
EndTimeBillable: End Time (0:01 to 23:59) for billing. StartTimeBillable=NULL and EndTimeBillable=NULL means full day
Public fieldEquipmentCode
EquipmentCode Used equipment Code
Public fieldEquipmentFrom
EquipmentFrom Equipment Start Date
Public fieldEquipmentTo
Equipment End Date for repeating bookings
Public fieldHelpContractNumber
If ContractID is 0 the Contract is searched by the visible contract ID
Public fieldHelpCostType
HelpCostType: Used cost type. if CostTypePositionID=0 the first contract position with this CostType is used
Public fieldHelpPhaseName
For projects with phases, the phase ID can be searched by the phase name, if PhaseID is 0: The first matching phase with the given name will be used.
Public fieldLineID
EquipmentBookingID Line ID: Given by the system. Filled after import
Public fieldMemoText
Memo: The Memo field can store 2 Million caracters (TEXT).
Public fieldNumberOfEquipments
NumberOfEquipments: default=1, other numbers only for Equipment of the EquipmentType=eEquipmentMasterType.EquipmentMasterQtyNoSN = 451
Public fieldPhaseID
PhaseID: Phase Identifier (INT). Only leaves of phases can be used, not branches.
Public fieldProjectNumber
ProjectNumber
Public fieldQuantity
Quantity: Number of hours used. Put 24 for one day:
Public fieldQuantityBillable
QuantityBillable: Number of hours used for billing (please fill this field 1:1 with the Quanity
Public fieldStartTime
StartTime Time start (0:00 to 23:59)
Public fieldStartTimeBillable
StartTimeBillable: Time start (0:00 to 23:59) for billing
Top
Remarks
Examples
Create a full month equipment booking linked to a project/Contract
private void CreateEquipmentBooking(string sProject, int lContract, int lContractPositionEquipment, string sEquipmentMasterCode) {
    Log($"CreateEquipmentBooking(\"{sProject}\", lContract={lContract}, lContractPositionEquipment={lContractPositionEquipment}, \"{sEquipmentMasterCode}\")");
    clsImportEquipmentBookings NewLine = new clsImportEquipmentBookings();
    NewLine.EquipmentCode = sEquipmentMasterCode;
    NewLine.EquipmentFrom = new DateTime(2015, 1, 1);
    NewLine.EquipmentTo = new DateTime(2015, 1, 31); // start and end date have to be in the same period. SELECT PeriodStart, PeriodEnd, Period FROM MARIPeriods
    NewLine.ProjectNumber = sProject;
    NewLine.ContractID = lContract; //SELECT ContractID FROM MARIContract WHERE ProjectNumber='P100032'
    NewLine.CostTypePositionID = lContractPositionEquipment; //SELECT ContractPositionID FROM MARIContractPositions where PositionType=47 AND ContractID=102080
    NewLine.EmployeeNumber = "0001"; //Employee using the equipment (Can be the project manager, but mandatory)
    NewLine.Activity = "Imported Line from MARIInterface";
    NewLine.Quantity = 1; //day
    NewLine.QuantityBillable = 1; //day
    //NewLine.ApprovalFlag = true;//directly approve this booking
    //NewLine.ApprovalText = "Approved by import";


    if (oMPInterface.bImportEquipmentBooking(NewLine, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        Log($"Equipment Booking is created = LindID = {NewLine.LineID}"); 
    } else {
        LogFail(oMPInterface.oErrors.PrintErrors());
    }
}
See Also