Click or drag to resize

clsImportEquipmentCategorySubject Class

Import for table MPEquipmentCategorySubject: EquipmentCategory: Standard cost types for categories. Please use this class only for second, third... subject to a category. The first category (UnitHandling=eUnitHandling.ReservationPlanningDays=1) will be created directly with the equipmetn category.

View: MARIEquipmentCategorySubject: :Table: MPEquipmentCategorySubject

Table in access: MARIProjektImportEquipmentCategorySubject

Requires record in: View: MARIEquipmentCategory: :Table: MPEquipmentCategory

Use MPInterface.bImportEquipmentCategoryAdditionalSubjects(clsImportEquipmentCategorySubject, clsImportBaseeImportMode) to import additional subjects. Use this class already when creating a clsImportEquipmentCategory.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportEquipmentCategorySubject

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

The clsImportEquipmentCategorySubject type exposes the following members.

Constructors
  NameDescription
Public methodclsImportEquipmentCategorySubject
Initializes a new instance of the clsImportEquipmentCategorySubject class
Top
Properties
  NameDescription
Public propertyCounterHandling
Handle counting Yes No
Public propertyCounterSource
Counter Source (internal code, not used)
Public propertyCounterUnit
Counting Unit, Meter Unit
Public propertyDefaultCostMode
Public propertyDefaultService
Default Service for booking time for the operator (optional)
Public propertyDescription1
Description1
Public propertyDescription2
Description2
Public propertyDescription3
Description3
Public propertyDescription4
Description4
Public propertyEquipmentCategoryID
EquipmentCategory required link to the equipment category (clsImportEquipmentCategory)
Public propertyEquipmentSubject
EquipmentSubject Keyfield for the cost type. Please use the given format ("S#####") for this field. When the field is empty, the Import will calculate the next free number based on the format.
Public propertyHelpValidFrom
Add Cost Rates based on the valid from date. When adding several category subjects, the ValidFrom should be the same to avoid several date sets.
Public propertyListOfCategorySubjectRates
Collection to store for each company the three values: ItemCode, CostPrice, SalesPrice
Public propertySubjectName
Subject Name
Public propertyTravelExpenseCategory
TravelExpenseCategory
Public propertyUnit
Unit of measurement
Public propertyUnitHandling
Top
Methods
  NameDescription
Public methodAddSubjectRate
Add new settings for one company. Please add only one per company and add for all companies one setting.
Public methodbSaveRSToMDB (Overrides clsImportBasebSaveRSToMDB(MPInterface, DataRow, DataTable).)
Top
Remarks
Examples
Create Additional Cost Types (Subjects) for an Equipment Category
public void AddEquipmentCategorySubject(int lEquipmentCategory) {
    Log($"AddEquipmentCategorySubject({lEquipmentCategory})");

    MARIInterface.clsImportEquipmentCategorySubject NewSubject = new MARIInterface.clsImportEquipmentCategorySubject();
    NewSubject.SubjectName = "Electrical Power";
    NewSubject.UnitHandling = MARIInterface.clsImportEquipmentCategorySubject.eUnitHandling.ExpenseHandling;
    NewSubject.DefaultCostMode = MARIInterface.clsImportEquipmentCategorySubject.eCategorySubjectCostMode.ItemsAndCostByCompany;
    NewSubject.Unit = "kWh";
    NewSubject.Description1 = "Used energy in kWh";
    NewSubject.HelpValidFrom = DateTime.Today;

    //Set for each company the Item Code, cost price and sales price
    NewSubject.AddSubjectRate(oEngine.oGBs.oGetMandant(1).iGeschaeftsbereich, "220002", 0.05m, 0.12m); // Company 1
    if (oEngine.oERP.oHashMandant.Count > 1) {
        NewSubject.AddSubjectRate(oEngine.oGBs.oGetMandant(2).iGeschaeftsbereich, "220002", 0.05m, 0.12m); // Company 2
    }
    NewSubject.EquipmentCategoryID = lEquipmentCategory; //SELECT EquipmentCategory FROM MARIEquipmentCategory

    if (!oMPInterface.bImportEquipmentCategoryAdditionalSubjects(NewSubject, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        //NewEquipmentCategory.oErrors contains all Errors
        LogFail(oMPInterface.oErrors.PrintErrors());
    } else {
        Log($"New Equipment Category Subject Created. Subject Code = {NewSubject.EquipmentSubject} ");
    }
}
See Also