Click or drag to resize

clsImportEmployeeMaster Class

Import employe master including some or all linked tables. This class can be used as of version 6.4 (11/2020) and will replace clsImportEmployee. The old class has properties for some of the sub tables.. Use bImportEmployeeMaster(clsImportEmployeeMaster, clsImportBaseeImportMode) to import an employee.

This class contains several sub tables. In real data many of the tables are 1:n to the employee master. For the initial import, the subtables can be created in one go.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportEmployeeMaster

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

The clsImportEmployeeMaster type exposes the following members.

Constructors
  NameDescription
Public methodclsImportEmployeeMaster
Initializes a new instance of the clsImportEmployeeMaster class
Top
Properties
  NameDescription
Public propertyAddressName3
AddressName3
Public propertyAdressMemo
AdressMemo Private Address
Public propertyAvatarPictureID
AvatarPictureID
Public propertyBirthCity
BirthCity
Public propertyBirthPlace
BirthPlace
Public propertyBirthState
BirthState
Public propertyChangeDate
ChangeDate
Public propertyChangeUser
ChangeUser
Public propertyCreateDate
CreateDate
Public propertyCreateUser
CreateUser
Public propertyDateOfBirth
DateOfBirth
Public propertyDateOfEntry
DateOfEntry
Public propertyEmailPrivate
EmailPrivate
Public propertyEmployeeName
EmployeeName FirstName, Lastname
Public propertyEmployeeNumber
EmployeeNumber
Public propertyExchangeSyncMode
Synchronizing appointments with the exchange calendar. Setting which side will be master. See clsImportEmployeeMastereEmployeeExchangeSyncMode
Public propertyFirstName
FirstName
Public propertyImageID
PictureID (for the import only existing key in table MPBilder supported.
Public propertyInactive
Inactive Hide dataset
Public propertyLeavingDate
LeavingDate
Public propertyListOfEmployeeAnnualVacation
Optional collection annual vacation settings. Settings are stored in clsImportEmployeeAnnualVacation.
Public propertyListOfEmployeeValidFrom
Mandatory collection of general settings of the employee based on the "valid from" settings. Settings are stored in clsImportEmployeePeriod and clsImportEmployeeOrganisation. One element in this list is mandatory for a new employees. Give a ValidFrom to the period the employee starts in the enterprise.
Public propertyListOfProjectLinks
Optional collection link special use projects fo the employee. See clsImportEmployeeProjectLink.
Public propertyListOfServiceLinks
Collection link the prefered services to the employee master. They are used to simplify the data entry. See clsImportEmployeeServiceLink.
Public propertyListOfSkillLinks
Optional collection of skills liked to the employee. See clsImportEmployeeSkillLink.
Public propertyLocationID
LocationID
Public propertyMatchcode
Matchcode for search of employees: Lastname, Firstname
Public propertyMemo
Memo
Public propertyMiddleName
MiddleName
Public propertyNameInitials
NameInitials
Public propertyOfficeAddrAddressMemo
A1AddressMemo Business Address
Public propertyOfficeAddrBlock
A1Block Business Address
Public propertyOfficeAddrBuilding
A1Building Business Address
Public propertyOfficeAddrCity
A1City Business Address
Public propertyOfficeAddrCountry
A1Country Business Address two letter code
Public propertyOfficeAddrCounty
A1County Business Address
Public propertyOfficeAddrState
A1State Business Address
Public propertyOfficeAddrStreet
A1Street Business Address
Public propertyOfficeAddrStreetNum
A1StreetNum Business Address
Public propertyOfficeAddrZIP
A1ZIP Business Address
Public propertyOfficeEmail
Email Business Email Address
Public propertyOfficeFax
Fax Business Fax
Public propertyOfficeMobile
Mobile Business Mobile/Celular
Public propertyOfficePhone
Phone Business Phone
Public propertyOutOfOfficeStatus
Public propertyOutOfOfficeSubstitute
eMail to forward internal notifications based on the OutOfOfficeStatus.
Public propertyOutOfOfficeText
text as information, why the employee is out of office.
Public propertyPDAKey
PDAKey Key for external HP Systems for the employee
Public propertyPictureArrayOfBytes
The picture can be transfered via a byte array instead of a PictureFileName.
Public propertyPictureFileName
Linking a file name, will load this file into the database. The file content has to be accessable from the import process.

The picture content is stored in: View: MARIPictures : : Table: MPBilder

Public propertyPosition
Position
Public propertyPrivateAddrBlock
AddressBlock Private Address
Public propertyPrivateAddrBuilding
AddressBuilding Private Address
Public propertyPrivateAddrCity
AddressCity Private Address
Public propertyPrivateAddrCountry
Country Private Address (two letter code)
Public propertyPrivateAddrCounty
AddressCounty Private Address
Public propertyPrivateAddrState
AddressState Private Address
Public propertyPrivateAddrStreet
AddressStreet Private Address
Public propertyPrivateAddrStreetNo
AddressStreetNo Private Address
Public propertyPrivateAddrZIP
AddressZIP Private Address
Public propertyPrivateFax
PrivateFax
Public propertyPrivateMobile
PrivateMobile
Public propertyPrivatePhone
PrivatePhone
Public propertyProfession
Profession
Public propertySalutation
Mr. Mrs. Ms. Herr, Frau
Public propertySalutation2
newsletter address of the employee. "Dear Carlos"
Public propertyServiceHandling
ServiceHandling select behaviour in data entry
Public propertySignaturePictureID
SignaturePictureID Picture for the signature
Public propertySurname
Surname
Public propertySysMasterProperties
Optional: Link this employee to one or many SysMaster Properties. Having the ID in the list means, that the property is true.

See the clsImportSysMasterProperties description to create new properites.

All selected properties must have a UsageFlag of ClassID033Employee.

Public propertyUpdateStamp
UpdateStamp
Public propertyUserCode
Link to the user. Create first a user via clsImportMARIUser and link the returned user code.
Top
Methods
Remarks
Examples
Import a new employee and create a user
private string CreateEmployee(bool IncludeSubClasses = true) {
    string EmployeeNumber = oMPInterface.sGetNewEmployeeNumber(); //next free number based on the given Format E100*..
    string EmployeeName = "Marc Import";
    string SurName = "Import";
    Log($"EmployeeNumber={EmployeeNumber}, EmployeeName={EmployeeName}, SurName={SurName}");
    string UserCode;
    MARIInterface.clsImportMARIUser NewUser = CreateUser(SurName);
    if (!oMPInterface.bImportMARIUser(NewUser, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        LogFail(oMPInterface.oErrors.PrintErrors());
        return null;
    }
    else {
        UserCode = NewUser.UserCode;
        Log($"UserCode={UserCode}");
    }
    MARIInterface.clsImportEmployeeMaster NewEmployee = CreateEmployeeMaster(EmployeeNumber, EmployeeName, SurName, UserCode, IncludeSubClasses);
    if (!oMPInterface.bImportEmployeeMaster(NewEmployee, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        LogFail(oMPInterface.oErrors.PrintErrors());
        return null;
    }
    else {
        return NewEmployee.EmployeeNumber;
    }
}


private MARIInterface.clsImportEmployeeMaster CreateEmployeeMaster(string EmployeeNumber, string EmployeeName, string SurName, string UserCode, bool IncludeSubClasses = true) {
    Log($"CreateEmployeeMaster(EmployeeNumber={EmployeeNumber}, EmployeeName={EmployeeName}, SurName={SurName}, UserCode={UserCode})");
    MARIInterface.clsImportEmployeeMaster NewEmployee = new MARIInterface.clsImportEmployeeMaster();
    // MARIEmployeeMaster
    NewEmployee.EmployeeNumber = EmployeeNumber; // oMPInterface.sGetNewEmployeeNumber(); 
    NewEmployee.EmployeeName = EmployeeName;
    NewEmployee.Matchcode = EmployeeName; //Field for search and display
    NewEmployee.Salutation2 = $"Dear Mr. {SurName}";
    NewEmployee.Salutation = "Mr.";
    NewEmployee.FirstName = "Marc";
    NewEmployee.Surname = SurName;
    NewEmployee.OfficeAddrStreet = "Cupertino Drive";
    NewEmployee.OfficeAddrStreetNum = "1";
    NewEmployee.OfficeAddrZIP = "59000";
    NewEmployee.OfficeAddrCountry = "US";
    NewEmployee.OfficeAddrCounty = "Cupertino";
    NewEmployee.OfficeAddrCity = "Cupertino";
    NewEmployee.OfficePhone = "+1 212 456 798";
    NewEmployee.DateOfBirth = new DateTime(1985, 8, 12);
    NewEmployee.PDAKey = "98654631"; // Code of the RFID Chip
    NewEmployee.UserCode = UserCode;

    //MARIEmployeesPeriod
    MARIInterface.clsImportEmployeePeriod EmployeePeriod = new clsImportEmployeePeriod();
    NewEmployee.ListOfEmployeeValidFrom.Add(EmployeePeriod);
    EmployeePeriod.ValidFrom = 2020001; //SELECT Period FROM MARIPeriods
    EmployeePeriod.PoliticalCostRateType = clsImportEmployeePeriod.eEmployeeCostRateType.OneCostRate;
    EmployeePeriod.PoliticalCostRateOne4All = 50m;
    EmployeePeriod.AccountingCostRate1 = 45.46m; //MARIEmployeesCostRates >MARIEmployeesPeriod
    EmployeePeriod.EmployeeStatus = clsImportEmployeePeriod.eEmployeeMasterStatus.FixedEmployee; // 1
    EmployeePeriod.OvertimeInitialValue = 0m;
    EmployeePeriod.CalendarID = 100000; //SELECT CalendarID FROM MARICalendar
    EmployeePeriod.PlanningCapacity = 100; //100%

    //MARIEmployeesOrganisation >MARIEmployeesPeriod
    MARIInterface.clsImportEmployeeOrganisation NewOrga = new clsImportEmployeeOrganisation();
    EmployeePeriod.ListOfOrganisationSettings.Add(NewOrga);
    NewOrga.BusinessUnitID = 1; // SELECT BusinessUnitID FROM MARIBusinessUnitMaster
    NewOrga.Creditor = "71004"; // travel expense creditor SELECT CardCode FROM OCRD WHERE CardType='S'
    NewOrga.EmployeeSuperior = "0001"; //SELECT EmployeeNumber FROM MARIEmployeeMaster

    if (IncludeSubClasses) {
        //MARIEmployeeAnnualVacation
        MARIInterface.clsImportEmployeeAnnualVacation VacationSettings = new clsImportEmployeeAnnualVacation();
        NewEmployee.ListOfEmployeeAnnualVacation.Add(VacationSettings);
        VacationSettings.CalendarYear = 2020;
        VacationSettings.EntitlementCurrYear = 25;

        //MARIEmployeesService
        NewEmployee.ServiceHandling = clsImportEmployeeMaster.eServiceHandling.AllServicesSelectFirst;
        NewEmployee.ListOfServiceLinks.Add(new clsImportEmployeeServiceLink() { ServiceNumber = "1000", Prio = 1 });
        NewEmployee.ListOfServiceLinks.Add(new clsImportEmployeeServiceLink() { ServiceNumber = "1010", Prio = 2 });

        //MARIEmployeesPool
        clsImportEmployeePoolLink PoolLink = new clsImportEmployeePoolLink();
        EmployeePeriod.ListOfPoolLinks.Add(PoolLink);
        PoolLink.EmployeeNumber = EmployeeNumber;
        PoolLink.ResourcePool = "00001";
        PoolLink.ValidPeriodFrom = 2020001;
        PoolLink.PlanningType = clsImportEmployeePoolLink.ePoolLinkPlanningType.PlanningInvolvement;
        PoolLink.Priority = 1;
        PoolLink.Capacity = 30;

        //MARIEmployeesProjectLinks
        NewEmployee.ListOfProjectLinks.Add(new clsImportEmployeeProjectLink() {
            ProjectTemplateType = clsImportEmployeeProjectLink.eProjectTemplateType.VacationProject,
            ProjectNumber = "P100001" //SELECT [Projectnumber] FROM MARIProjectMaster WHERE ProjectType=3 clsImportProject.eProjectType.VacationProjects 
        });
        NewEmployee.ListOfProjectLinks.Add(new clsImportEmployeeProjectLink() {
            ProjectTemplateType = clsImportEmployeeProjectLink.eProjectTemplateType.SickLeaveProject,
            ProjectNumber = "P100003"//SELECT [Projectnumber] FROM MARIProjectMaster WHERE ProjectType=8 clsImportProject.eProjectType.AbsenseProjects
        });

        //MARIEmployeeSkills
        clsImportEmployeeSkillLink SkillLink = new clsImportEmployeeSkillLink();
        NewEmployee.ListOfSkillLinks.Add(SkillLink);
        SkillLink.EmployeeNumber = EmployeeNumber;
        SkillLink.SkillID = 100001;
        SkillLink.Priority = 100;
    }

    return NewEmployee;
}

private clsImportMARIUser CreateUser(string UserName) {
    Log($"CreateUser(UserName=\"{UserName}\")");
    //MARIUser
    MARIInterface.clsImportMARIUser NewUser = new clsImportMARIUser();
    NewUser.UserType = clsImportMARIUser.eMPUserType.InternalMARIProjectUser;
    NewUser.UserName = UserName;
    NewUser.Password = string.Empty; // Interface will create a new pasword.
    NewUser.LoginActive = true;
    NewUser.UserLevel = clsImportMARIUser.eAuthUserLevel.ProjectManager;
    NewUser.Groups = 2052; //SELECT Groups FROM MARIUser. Flags depending on the defined user groups
    NewUser.AccountingMode = 1; //See only hours
    NewUser.Modules = clsImportMARIUser.eLicenseModule.Professional;
    return NewUser;
}
Examples
Import a new freelancer
public string CreateEmployeeFreeLancer() {
    LogStart("EmployeeMaster", "CreateEmployeeFreeLancer", eLogLevel.AllActions, @"ProjectManagementMobileUnitTest\UT_MARIInterface\UT_MARIInterface_EmployeeMaster.cs");
    string EmployeeNumber = oMPInterface.sGetNewEmployeeNumber(); //next free number based on the given Format E100*..
    string EmployeeName = "Marc Free";
    string SurName = "Free";
    Log($"EmployeeNumber={EmployeeNumber}, EmployeeName={EmployeeName}, SurName={SurName}");
    string UserCode = string.Empty;
    MARIInterface.clsImportEmployeeMaster NewEmployee = CreateEmployeeFreeLancer(EmployeeNumber, EmployeeName, SurName, UserCode);
    if (!oMPInterface.bImportEmployeeMaster(NewEmployee, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) {
        LogFail(oMPInterface.oErrors.PrintErrors());
        return null;
    }
    else {
        string sMessage = NewEmployee.EmployeeNumber;
        return sMessage;
    }
}


private MARIInterface.clsImportEmployeeMaster CreateEmployeeFreeLancer(string EmployeeNumber, string EmployeeName, string SurName, string UserCode) {
    Log($"CreateEmployeeFreeLancer(EmployeeNumber={EmployeeNumber}, EmployeeName={EmployeeName}, SurName={SurName}, UserCode={UserCode})");
    MARIInterface.clsImportEmployeeMaster NewEmployee = new MARIInterface.clsImportEmployeeMaster();
    // MARIEmployeeMaster
    NewEmployee.EmployeeNumber = EmployeeNumber; // oMPInterface.sGetNewEmployeeNumber(); 
    NewEmployee.EmployeeName = EmployeeName;
    NewEmployee.Matchcode = EmployeeName; //Field for search and display
    NewEmployee.Salutation2 = $"Dear Mr. {SurName}";
    NewEmployee.Salutation = "Mr.";
    NewEmployee.FirstName = "Marc";
    NewEmployee.Surname = SurName;
    NewEmployee.OfficeAddrStreet = "Cupertino Drive";
    NewEmployee.OfficeAddrStreetNum = "1";
    NewEmployee.OfficeAddrZIP = "59000";
    NewEmployee.OfficeAddrCountry = "US";
    NewEmployee.OfficeAddrCounty = "Cupertino";
    NewEmployee.OfficeAddrCity = "Cupertino";
    NewEmployee.OfficePhone = "+1 212 456 798";
    NewEmployee.DateOfBirth = new DateTime(1985, 8, 12);
    NewEmployee.PDAKey = "98654631"; // Code of the RFID Chip
    NewEmployee.UserCode = UserCode;

    //MARIEmployeesPeriod
    MARIInterface.clsImportEmployeePeriod EmployeePeriod = new clsImportEmployeePeriod();
    NewEmployee.ListOfEmployeeValidFrom.Add(EmployeePeriod);
    EmployeePeriod.ValidFrom = 2020001; //SELECT Period FROM MARIPeriods
    EmployeePeriod.PoliticalCostRateType = clsImportEmployeePeriod.eEmployeeCostRateType.PricePerProject;
    EmployeePeriod.EmployeeStatus = clsImportEmployeePeriod.eEmployeeMasterStatus.FreeLancer; // 10
    EmployeePeriod.OvertimeInitialValue = 0m;
    EmployeePeriod.CalendarID = 100000; //SELECT CalendarID FROM MARICalendar
    EmployeePeriod.PlanningCapacity = 100; //100%
    EmployeePeriod.ListOfCostRatesProjects.Add(new clsImportEmployeeCostRatesProject() { ProjectNumber = "P100006", ISCRateHour = 33.60m });
    EmployeePeriod.ListOfCostRatesProjects.Add(new clsImportEmployeeCostRatesProject() { ProjectNumber = "P100007", ISCRateHour = 36.450m });

    //MARIEmployeesOrganisation
    MARIInterface.clsImportEmployeeOrganisation NewOrga = new clsImportEmployeeOrganisation();
    EmployeePeriod.ListOfOrganisationSettings.Add(NewOrga);
    NewOrga.EmployeeNumber = EmployeeNumber;
    NewOrga.BusinessUnitID = 1; // SELECT BusinessUnitID FROM MARIBusinessUnitMaster
    NewOrga.Creditor = "71004"; // travel expense creditor SELECT CardCode FROM OCRD WHERE CardType='S'
    NewOrga.EmployeeSuperior = "0001"; //SELECT EmployeeNumber FROM MARIEmployeeMaster
    NewOrga.MainBusinessUnit = true;

    //Link to a second business unit
    NewOrga = new clsImportEmployeeOrganisation();
    EmployeePeriod.ListOfOrganisationSettings.Add(NewOrga);
    NewOrga.EmployeeNumber = EmployeeNumber;
    NewOrga.BusinessUnitID = 2; // SELECT BusinessUnitID FROM MARIBusinessUnitMaster
    NewOrga.Creditor = "71004"; // travel expense creditor SELECT CardCode FROM OCRD WHERE CardType='S'
    NewOrga.EmployeeSuperior = "0001"; //SELECT EmployeeNumber FROM MARIEmployeeMaster
    return NewEmployee;
}
See Also