/// <summary> /// Changes the state of the phase /// </summary> /// <param name="type">The state to set</param> /// <param name="description">The optional description to set</param> /// <returns>The current state of the phase</returns> public virtual PhaseState UpdateState(PhaseStateType type, string description = null) { PhaseState current = GetCurrentState(); if (current != null && current.Type == type) { current.LastModified = DateTime.UtcNow; current.Description = description; return(current); } PhaseState newState = new PhaseState(type, description); States.Add(newState); return(newState); }
/// <summary> /// Sets the identified phase's state with optional description. /// </summary> /// <param name="phaseName">Name of phase to update</param> /// <param name="state">The state to set</param> /// <param name="stateDescription">Optional description</param> public virtual void UpdatePhaseState(string phaseName, PhaseStateType state, string stateDescription = null) { PhaseState s = Phases[phaseName].UpdateState(state, stateDescription); LastModified = s.LastModified; }
/// <summary> /// Constructor that takes a phase name, if it's required, a set of rights information, and initial state information. /// </summary> /// <param name="phaseName">The name of the phase</param> /// <param name="required">If this phase is required to complete for the job to complete</param> /// <param name="rights">Access rights for the phase</param> /// <param name="stateRights">Access rights for the states on this phase</param> /// <param name="phaseState">The initial state of the phase</param> /// <param name="stateDescription">The initial state descritpion for the phase</param> public Phase(string phaseName, Boolean required, IDictionary <string, Right> rights = null, IDictionary <string, Right> stateRights = null, PhaseStateType phaseState = PhaseStateType.NOTAPPLICABLE, string stateDescription = "Not applicable") : this(phaseName, required) { if (rights != null) { Rights = rights; } if (stateRights != null) { StatesRights = stateRights; } UpdateState(phaseState, stateDescription); }
/// <summary> /// Constructor that takes a phase type and optional description arguments /// </summary> public PhaseState(PhaseStateType type, string description = null) : this() { Type = type; Description = description; }