Click or drag to resize

clsImportPhase Class

Import of one phase (branch or leave) to a phase tree.

Please concider the correct planning version. See PlanningVersion. The standard planning version is 3.

MS Access table: MARIProjektImportProjectPhases. See clsImportBase.eImportMode for tables in MS Access updated, when a phase is stored.

Use MPInterface.bImportPhase(clsImportPhase, clsImportBaseeImportMode) to import.

Inheritance Hierarchy
SystemObject
  MARIInterfaceclsImportBase
    MARIInterfaceclsImportPhase

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

The clsImportPhase type exposes the following members.

Constructors
  NameDescription
Public methodclsImportPhase
Initializes a new instance of the clsImportPhase class
Top
Properties
  NameDescription
Public propertyAutoPlanningMode
Auto Planning Mode for automatic moving based on dependencies (works with V5.4). See clsImportPhaseeAutoPlanningMode.
Public propertyChangeDate
Date from the last change
Public propertyChangeUserID
User from the last change NVARCHAR(4)
Public propertyDegreeDate
Date when the user change status to complete
Public propertyDegreeMemo
Special Text stored, when the phase status is changed to complete. Can be used only starting with version 5.4
Public propertyDegreeOfCompletion
Degree of completion. Manually estimated. 0 to 0,99 as Integer 1 = 100% is in the same time with completion (automatic in class)
Public propertyDegreeUser
User who did the phase completion
Public propertyGroupID
Phase group ID. Used to link project individual phases to global groups for planning and analyzing features.
Public propertyIndent
Insertion deepness standard=1 (Using ParentID defines the position. Using Indent>Parent.Indent makes new phase to sub phase)
Public propertyMileStone
MileStone
Public propertyParent

Link to phases above in the hirarchy. When the Parent phase is found and the Indent is > the Indent of the parent, a child is created.

The parent may change from Leave to Branch.

When you like to add a phase 'A.3' under A (A.1, A.2) use the PhaseId of A.2 as the Parent and the same Indent. Then A.3 will be under A.2. In the database the field Parent will after the import point to A one Indent higher

Public propertyPhaseID
Identification of a phase. Can be used in the MS Access database as a reference (< 100000). Will get an internal number as a unique phase id.
Public propertyPhaseIdentifier
Identifier of one phase over the several planning versions. When phases are copied from on planning version to another, the phase identifier stays the same. When empty, the phase will use the PhaseID.
Public propertyPhasesEndDate
End date of the phase (branch or leave). When PhaseStartDate and PhaseEndDate are the same. It will be considered as a milestone
Public propertyPhasesMemo
Extra informations for phases
Public propertyPhasesStartDate
Start Date of the phase (branch or leave).
Public propertyPhaseStatus
Status of a phase for data entry and billing. 0=not started, 1=active phase,2=finished phase, 3=partial finished (for branches). See ePhaseStatus.
Public propertyPhaseText
Visible Text of the phase, NVARCHAR(100)
Public propertyPhaseType
Type of the phase in the hierarchy. 1=leave, 2=brach. See ePhaseType for details. Only leaves can be used for transactions.
Public propertyPlanningVersion
Reference for the planning version. Standard=3. When property is 0 the current phase planning version from the project will be used. See clsImportProject.PlanningVersion for the current planning version of the project.

Standard planning versions are:

  • 0: Preplanning not confirmed. (Here the 0 is used to read the value from the project)
  • 1: Primary planning version
  • 2: Initial planning version
  • 3: (default) Current planing version. All transactions (time booking, etc) are only made against the current planning.
  • >100000: Additional planning versions, created by archiving the planning version

Public propertyPosition
Order from the phases (coactive). Is not used in the import. The imnport only attaches phases to the end. Starts with 1.
Public propertyPrimalCreation
Date from the primal cration
Public propertyProjectNumber
Reference for the project. Mandatory
Public propertySourcePhasesID
Link a source phase, the phase is copied from another planning versions. Not used in the import.
Top
Methods
  NameDescription
Public methodbReadFromDB
Reads the project phase data from the database and copies the values to the class Only for internal use! To load data use your own SQL.
(Overrides clsImportBasebReadFromDB(MPInterface, String).)
Public methodbSaveRSToMDB (Overrides clsImportBasebSaveRSToMDB(MPInterface, DataRow, DataTable).)
Public methodGetListUserDefinedFields
Returns the user defined field definition for the dimension "Phase Master". The fields have to be defined directly in MARIProject.
(Overrides clsImportBaseGetListUserDefinedFields(MPInterface).)
Top
Remarks
Examples
Create a new project with phases in a small hierarchy
private string CreateProjectWithPhasesSimple() {
    Log($"CreateProjectWithPhasesSimple");
    string sNewProjectNumber;
    //Let MARIProject create a new project number
    int iBusinessUnit = 1; // SELECT BusinessUnitID FROM MARIBusinessUnitMaster

    //MARIProject will suggest the next free project number:
    sNewProjectNumber = oMPInterface.sGetNewProjectNumber(iBusinessUnit);

    clsImportProject oProject = new clsImportProject();
    oProject.ProjectNumber = sNewProjectNumber;
    oProject.ProjectName = "DTW New Project With Phases";
    oProject.Matchcode = oProject.ProjectName;
    oProject.BusinessUnit = iBusinessUnit;
    oProject.ProjectType = clsImportProject.eProjectType.CustomerProjects;
    oProject.ActiveType = clsImportProject.eProjektActiveType.OpenForBoocking;
    oProject.ProjectStatus = clsImportProject.eProjectStatus.ProjectRunning;

    //Project Code can be created automatically with the project, depending on the settings. DI-API will be used. Make sure hat DI-API 32 or 64 bit is installed, where MARIInterface is running.
    oProject.ProjectCodeFinance = "";

    if (oMPInterface.bImportProject(oProject, clsImportBase.eImportMode.ValidateAndImport)) {
        int lParentPhase, lPhaseA1, lPhaseA2;
        lParentPhase = CreateParentPhaseSimple("Phase A", sNewProjectNumber);
        lPhaseA1 = CreatePhaseSimple("Phase A.1", lParentPhase, sNewProjectNumber);
        lPhaseA2 = CreatePhaseSimple("Phase A.2", lParentPhase, sNewProjectNumber);
        CreatePhaseSimple("Phase A.3", lParentPhase, sNewProjectNumber);

        lParentPhase = CreateParentPhaseSimple("Phase B", sNewProjectNumber);
        CreatePhaseSimple("Phase B.1", lParentPhase, sNewProjectNumber);

        return sNewProjectNumber;
    } else {
        LogFail(oMPInterface.oErrors.PrintErrors(true));
        return "";
    }
}
public int CreatePhaseSimple(string Phase, int Parent, string ProjectNumber) {
    Log($"CreatePhaseSimple(Phase=\"{Phase}\", Parent={Parent}, ProjectNumber=\"{ProjectNumber}\")");
    clsImportPhase oPhase = new clsImportPhase();
    oPhase.ProjectNumber = ProjectNumber;
    oPhase.PhaseText = Phase;
    oPhase.Indent = 2;
    oPhase.Parent = Parent;
    oPhase.PhaseType = clsImportPhase.ePhaseType.Leave;

    if (oMPInterface.bImportPhase(oPhase, clsImportBase.eImportMode.ValidateAndImport)) {
        Log($"CreatePhaseSimple: PhaseID={oPhase.PhaseID}");
        return oPhase.PhaseID;
    } else {
        LogFail( oMPInterface.oErrors.PrintErrors(true));
        return 0;
    }

}
public int CreateParentPhaseSimple(string PhaseText, string ProjectNumber) {
    Log($"CreateParentPhaseSimple(PhaseText=\"{PhaseText}\", ProjectNumber=\"{ProjectNumber}\")");
    clsImportPhase oPhase = new clsImportPhase();
    oPhase.ProjectNumber = ProjectNumber;
    oPhase.PhaseText = PhaseText;
    oPhase.Indent = 1;
    //oPhase.PhaseType = clsImportPhase.ePhaseType.Branch; // The type branch will be defined by its children. Only when adding Indent=2 chilfs will make the phase to a branch

    if (oMPInterface.bImportPhase(oPhase, clsImportBase.eImportMode.ValidateAndImport)) {
        Log($"CreateParentPhaseSimple: PhaseID={oPhase.PhaseID}");
        return oPhase.PhaseID;
    } else {
        LogFail(oMPInterface.oErrors.PrintErrors(true));
        return 0;
    }

}
See Also