312 lines
11 KiB
C#
312 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using EnVisage.Code;
|
|
|
|
namespace EnVisage.Models
|
|
{
|
|
public class ActivityCalendarRequestModel
|
|
{
|
|
public enum ActivityCalendarEntityType
|
|
{
|
|
Team = 1,
|
|
View = 2,
|
|
Company = 3,
|
|
Resource = 4
|
|
}
|
|
|
|
public Guid EntityId { get; set; }
|
|
public ActivityCalendarEntityType EntityType { get; set; }
|
|
public DateTime StartDate { get; set; }
|
|
public DateTime EndDate { get; set; }
|
|
}
|
|
|
|
public class ActivityCalendarScenarioModel
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; }
|
|
public bool IsBottomUp { get; set; }
|
|
public long StartDate { get; set; }
|
|
public long EndDate { get; set; }
|
|
}
|
|
|
|
public class ActivityCalendarProjectModel
|
|
{
|
|
public Guid ProjectId { get; set; }
|
|
public Guid CompanyId { get; set; }
|
|
public Guid ClientId { get; set; }
|
|
public Guid? ParentProjectId { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a name of the master project if any
|
|
/// </summary>
|
|
public string ParentName { get; set; }
|
|
public Guid? PartId { get; set; }
|
|
public string Name { get; set; }
|
|
public string Color { get; set; }
|
|
public bool ReadOnly { get; set; }
|
|
|
|
public ActivityCalendarScenarioModel ActiveScenario { get; set; }
|
|
public List<ActivityCalendarScenarioModel> InactiveScenarios { get; set; }
|
|
|
|
/// <summary>Contains intersection of project's and filtered teams</summary>
|
|
public Dictionary<string, ActivityCalendarProjectTeamWithAssignedResourcesModel> Teams { get; set; }
|
|
public decimal Priority { get; set; }
|
|
public long DeadlineMs { get; set; }
|
|
public string TypeName { get; set; }
|
|
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarProjectModel()
|
|
{
|
|
InactiveScenarios = new List<ActivityCalendarScenarioModel>();
|
|
Teams = new Dictionary<string, ActivityCalendarProjectTeamWithAssignedResourcesModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarModel
|
|
{
|
|
/// <summary>Contains Years->Months->Days</summary>
|
|
public List<SelectListItem> CostCenters { get; set; }
|
|
public List<ActivityCalendarFilterOptions.ProjectRoleItem> ProjectRoles { get; set; }
|
|
public Dictionary<string, Dictionary<string, List<int>>> WeekEndings { get; set; }
|
|
public Dictionary<string, ActivityCalendarProjectModel> Projects { get; set; }
|
|
public Dictionary<string, TeamSummaryInfoModel> Teams { get; set; }
|
|
public Dictionary<string, ActivityCalendarAllocationsByECModel> NeedAllocations { get; set; }
|
|
public Dictionary<string, ActivityCalendarAllocationsByECModel> UnassignedNeed { get; set; }
|
|
public Dictionary<string, ActivityCalendarTeamAllocationsModel> TeamAllocations { get; set; }
|
|
public Dictionary<string, ActivityCalendarPeopleResourceAllocationsByScenarioModel> ResourceAllocations { get; set; }
|
|
public Dictionary<string, ActivityCalendarPeopleResourceAllocationsByScenarioModel> ResourceActuals { get; set; }
|
|
public List<ActivityCalWorkFlowCommand> WorkFlowActions { get; set; }
|
|
public ActivityCalendarRestData RestData { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarModel()
|
|
{
|
|
CostCenters = new List<SelectListItem>();
|
|
ProjectRoles = new List<ActivityCalendarFilterOptions.ProjectRoleItem>();
|
|
WeekEndings = new Dictionary<string, Dictionary<string, List<int>>>();
|
|
Projects = new Dictionary<string, ActivityCalendarProjectModel>();
|
|
Teams = new Dictionary<string, TeamSummaryInfoModel>();
|
|
NeedAllocations = new Dictionary<string, ActivityCalendarAllocationsByECModel>();
|
|
TeamAllocations = new Dictionary<string, ActivityCalendarTeamAllocationsModel>();
|
|
ResourceAllocations = new Dictionary<string, ActivityCalendarPeopleResourceAllocationsByScenarioModel>();
|
|
ResourceActuals = new Dictionary<string, ActivityCalendarPeopleResourceAllocationsByScenarioModel>();
|
|
WorkFlowActions = new List<ActivityCalWorkFlowCommand>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarAllocationsModel
|
|
{
|
|
public Dictionary<string, decimal> Allocations { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarAllocationsModel()
|
|
{
|
|
Allocations = new Dictionary<string, decimal>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarAllocationsByECModel
|
|
{
|
|
public Dictionary<string, ActivityCalendarAllocationsModel> Expenditures { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarAllocationsByECModel()
|
|
{
|
|
Expenditures = new Dictionary<string, ActivityCalendarAllocationsModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarTeamAllocationsModel
|
|
{
|
|
public Dictionary<string, ActivityCalendarAllocationsByECModel> Scenarios { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarTeamAllocationsModel()
|
|
{
|
|
Scenarios = new Dictionary<string, ActivityCalendarAllocationsByECModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarPeopleResourceAllocationsByTeamModel
|
|
{
|
|
public Dictionary<string, ActivityCalendarAllocationsByECModel> Teams { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarPeopleResourceAllocationsByTeamModel()
|
|
{
|
|
Teams = new Dictionary<string, ActivityCalendarAllocationsByECModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarPeopleResourceAllocationsByScenarioModel
|
|
{
|
|
public Dictionary<string, ActivityCalendarPeopleResourceAllocationsByTeamModel> Scenarios { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarPeopleResourceAllocationsByScenarioModel()
|
|
{
|
|
Scenarios = new Dictionary<string, ActivityCalendarPeopleResourceAllocationsByTeamModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarProjectTeamWithAssignedResourcesModel
|
|
{
|
|
// key - expenditure category id, value - list with resources ids
|
|
public Dictionary<string, List<Guid>> Resources { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarProjectTeamWithAssignedResourcesModel()
|
|
{
|
|
Resources = new Dictionary<string, List<Guid>>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
public class ActivityCalendarRestData
|
|
{
|
|
/// <summary>Team allocations by rest teams that do not visible for users, but need for project unallocated calculation, key - scenario id</summary>
|
|
public Dictionary<string, ActivityCalendarAllocationsByECModel> TeamAllocations { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public ActivityCalendarRestData()
|
|
{
|
|
TeamAllocations = new Dictionary<string, ActivityCalendarAllocationsByECModel>();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region New Activity Calendar Save models
|
|
|
|
public class ActivityCalendarSaveModel
|
|
{
|
|
#region Scenario data save model
|
|
|
|
public class ScenarioSaveModel
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether to update projections based on entered allocations or not.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// If <b>true</b> then Team allocations (team need) will be recalculated based on entered resource allocations.
|
|
/// If <b>true</b> then Scenario Details (project need) will be recalculated based on entered resource allocations and team allocations.
|
|
/// </remarks>
|
|
public bool UpdateProjections { get; set; }
|
|
public bool isNew { get; set; }
|
|
public Dictionary<string, ScenarioExpenditureDataModel> Expenditures { get; set; }
|
|
|
|
public ScenarioSaveModel()
|
|
{
|
|
Expenditures = new Dictionary<string, ScenarioExpenditureDataModel>();
|
|
}
|
|
}
|
|
|
|
public class ScenarioExpenditureDataModel
|
|
{
|
|
public Dictionary<string, ScenarioTeamDataModel> Teams { get; set; }
|
|
|
|
public ScenarioExpenditureDataModel()
|
|
{
|
|
Teams = new Dictionary<string, ScenarioTeamDataModel>();
|
|
}
|
|
}
|
|
|
|
public class ScenarioTeamDataModel
|
|
{
|
|
public Dictionary<string, decimal> Allocations { get; set; }
|
|
public Dictionary<string, ScenarioResourceDataModel> Resources { get; set; }
|
|
|
|
public ScenarioTeamDataModel()
|
|
{
|
|
Allocations = new Dictionary<string, decimal>();
|
|
Resources = new Dictionary<string, ScenarioResourceDataModel>();
|
|
}
|
|
}
|
|
|
|
public class ScenarioResourceDataModel
|
|
{
|
|
public bool IsRemoved { get; set; }
|
|
public Dictionary<string, decimal> ForecastAllocations { get; set; }
|
|
public Dictionary<string, decimal> ActualAllocations { get; set; }
|
|
|
|
public ScenarioResourceDataModel()
|
|
{
|
|
ForecastAllocations = new Dictionary<string, decimal>();
|
|
ActualAllocations = new Dictionary<string, decimal>();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
#region Non-Project time data save model
|
|
|
|
public class NonProjectTimeSaveModel
|
|
{
|
|
public Dictionary<string, NptEntityDataModel> Resources { get; set; }
|
|
// Allocations for team-wide NPTs
|
|
public Dictionary<string, decimal> TeamWideNptAllocations { get; set; }
|
|
|
|
public NonProjectTimeSaveModel()
|
|
{
|
|
Resources = new Dictionary<string, NptEntityDataModel>();
|
|
TeamWideNptAllocations = new Dictionary<string, decimal>();
|
|
}
|
|
}
|
|
|
|
public class NptEntityDataModel
|
|
{
|
|
public Dictionary<string, decimal> Allocations { get; set; }
|
|
|
|
public NptEntityDataModel()
|
|
{
|
|
Allocations = new Dictionary<string, decimal>();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public SaveAsScenario SaveAction { get; set; }
|
|
public string NewName { get; set; }
|
|
public ScenarioSaveType ScenarioType { get; set; }
|
|
public bool SetActive { get; set; }
|
|
public ActivityCalendarRequestModel.ActivityCalendarEntityType CalendarDisplayMode { get; set; }
|
|
public Guid? FilterEntityId { get; set; }
|
|
|
|
public Dictionary<string, ScenarioSaveModel> Scenarios { get; set; }
|
|
public Dictionary<string, NonProjectTimeSaveModel> NonProjectTime { get; set; }
|
|
public List<ActivityCalWorkFlowCommand> WorkFlowActions { get; set; }
|
|
public ActivityCalendarSaveModel()
|
|
{
|
|
Scenarios = new Dictionary<string, ScenarioSaveModel>();
|
|
NonProjectTime = new Dictionary<string, NonProjectTimeSaveModel>();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
} |