using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using EnVisage.Code;
using System.Linq;
using System.Web.Mvc;
namespace EnVisage.Models
{
public class CapacityDetailsModel
{
public enum Spread
{
Notspecified = -1,
Equal = 0,
Less = 1,
Over = 2
}
public enum RowType
{
Project = 0,
ProjectExpenditureCategory = 1,
Vacation = 2,
Training = 3,
LoanOut = 4,
Total = 5,
Capacity = 6,
BottomCategory = 7,
Team = 8
}
public class ScenarioCalendarRowResource
{
public Guid Id { get; set; }
public Guid? ExpedentureCategoryId { get; set; }
public string Name { get; set; }
///
/// Gets or sets a weekly array of quantity values.
///
public decimal[] QuantityValues { get; set; }
///
/// Gets or sets a weekly array of cost values.
///
public decimal[] CostValues { get; set; }
///
/// Gets or sets a weekly array of resource availability (i.e. UOM-vacations-trainings-loanouts) values.
///
public decimal[] CapacityQuantityValues { get; set; }
///
/// Gets or sets an array of resource vacation weekly allocations.
///
public decimal[] VacationQuantityValues { get; set; }
///
/// Gets or sets an array of resource training weekly allocations.
///
public decimal[] TrainingQuantityValues { get; set; }
///
/// Gets or sets total resource cost for the row.
///
public decimal GrandTotalCost { get; set; }
///
/// Gets or sets a total resource quantity for the row.
///
public decimal GrandTotalQuantity { get; set; }
public Spread[] SpreadVal { get; set; }
///
/// Gets or sets a weekly array of resource capacity (i.e. UOM value).
///
public decimal[] QuantityTotalResValue { get; set; }
public bool ReadOnly { get; set; }
public Guid TeamId { get; set; }
public bool AssignedToTeam { get; set; }
public string Title { get; set; }
public Guid[] ProjectIds { get; set; }
public bool IsActiveEmployee { get; set; }
}
public class CalendarRow
{
public Guid? ProjectId { get; set; }
public string Name { get; set; }
public string Name1 { get; set; }
public string Color { get; set; }
public Guid? ScenarioId { get; set; }
public Guid? ExpCatId { get; set; }
public bool EmptyScenario { get; set; }
///
/// Gets or sets a start date of data in this row.
///
///
/// 1. Project. Start Date of the project.
/// 2. Expenditure Category. Min date where scenario details records contain non-zero values. Could be zero cells in the middle of this range.
/// 3. Resource. Min date where scenario details records contain non-zero values. Could be zero cells in the middle of this range.
///
public long? StartDate { get; set; }
///
/// Gets or sets an end date of data in this row.
///
///
/// 1. Project. End Date and End Date of project.
/// 2. Expenditure Category. Max date where scenario details records contain non-zero values. Could be zero cells in the middle of the row.
/// 3. Resource. Max date where scenario details records contain non-zero values. Could be zero cells in the middle of this range.
///
public long? EndDate { get; set; }
public Guid? ResourceToAssignId { get; set; }
public ExpenditureCategoryModel.UseTypes UseType { get; set; }
public decimal[] QuantityValues { get; set; }
public decimal QuantityResValue { get; set; }
///
/// Gets or sets a weekly array of expenditure category capacity (i.e. UOM value * number of resources).
///
public decimal[] QuantityTotalResValue { get; set; }
public decimal[] QuantityExpCatTotalValue { get; set; }
//public decimal[] CostValues { get; set; }
public Guid?[] DetailIds { get; set; }
public bool ProjectCollapsed { get; set; }
public bool ScenarioCollapsed { get; set; }
public bool ExpCatCollapsed { get; set; }
public string CollapsedClass { get; set; }
public decimal[] RestQuantity { get; set; }
public decimal[] RestCost { get; set; }
public bool IsParentCollapsed { get; set; }
public bool IsUpperHidden { get; set; }
public bool IsLowerHidden { get; set; }
public bool IsTotals { get; set; }
public RowType RowType { get; set; }
public Spread[] SpreadVal { get; set; }
public bool[] ReadOnly { get; set; }
public Guid? TeamId { get; set; }
public List Resources { get; set; }
public CalendarRow()
{
QuantityValues = new decimal[0];
DetailIds = new Guid?[0];
CollapsedClass = "fa-plus-square";
RestQuantity = new decimal[0];
RestCost = new decimal[0];
ScenarioCollapsed = true;
ExpCatCollapsed = true;
ProjectCollapsed = true;
IsParentCollapsed = true;
IsTotals = false;
RowType = RowType.ProjectExpenditureCategory;
SpreadVal = new Spread[0];
EmptyScenario = true;
ReadOnly = new bool[0];
}
}
public class Header
{
///
/// Gets or sets a number of milliseconds between month end date and 1/1/1970.
///
public long Milliseconds { get; set; }
///
/// Gets or sets an index of the related month cell.
///
public int MonthIndex { get; set; }
public int YearIndex { get; set; }
///
/// Gets or sets a values indicating whether the header cell is collapsed or not.
///
public bool Collapsed { get; set; }
///
/// Gets or sets a values indicating whether to show header cell.
///
public bool Show { get; set; }
///
/// Gets or sets a values indicating whether the header cell represents a month or a week.
///
public bool IsMonth { get; set; }
///
/// Gets or sets a CSS class used for the plus/minus icons in the month header.
///
public string CollapsedClass { get; set; }
///
/// Gets or sets a text of the header cell.
///
public string Title { get; set; }
public string Year { get; set; }
///
/// Gets or sets an array of indexes of children cells. I.e. week cells for month cell.
///
public int SpanCount { get; set; }
public List Weeks { get; set; }
public Header()
{
Collapsed = true;
Show = false;
CollapsedClass = "fa-plus-square";
SpanCount = 0;
}
}
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public Guid? CompanyId { get; set; }
public Guid? TeamId { get; set; }
public Guid? ViewId { get; set; }
public bool GrowthScenario { get; set; }
public Guid ParentId { get; set; }
public long ActualsEndDateMs { get; set; }
///
/// Indicates whether capacity management grid data is in Hours or in Resources.
/// null - data in Hours
/// true - data in Hours
/// false - data in Resources.
///
[Display(Name = "Resources Mode")]
public bool? IsUOMHours { get; set; }
public bool? GroupByTeam { get; set; }
//public decimal uomResourcesMultiplier { get; set; }
//public decimal uomHoursMultiplier { get; set; }
public List AvailableExpenditures { get; set; }
public List AllResources { get; set; }
///
/// Gets or sets a list of scenario details data for each expenditure category.
///
public List Calendar { get; set; }
public List Headers { get; set; }
public List YearHeaders { get; set; }
public CapacityDetailsModel()
{
AvailableExpenditures = new List();
Calendar = new List();
Headers = new List();
YearHeaders = new List();
//uomResourcesMultiplier =Utils.GetUOMMultiplier(false);
//uomHoursMultiplier = Utils.GetUOMMultiplier(true);
}
}
public class SaveCapacityDetailsChangesModel
{
public class ChangedRow
{
public Guid Id { get; set; }
public Guid ScenarioId { get; set; }
public List Values { get; set; }
public List Resources { get; set; }
public ChangedRow()
{
Values = new List();
}
}
public class ResourcesRow
{
public Guid Id { get; set; }
public List Values { get; set; }
public bool IsAdded { get; set; }
public bool IsRemoved { get; set; }
}
public class ChangedColumn
{
public Guid? Id { get; set; }
///
/// Number of milliseconds from 1/1/1970
///
public long Milliseconds { get; set; }
public decimal Cost { get; set; }
public decimal Quantity { get; set; }
}
//public Guid ScenarioId { get; set; }
public List ChangedExpCats { get; set; }
public CapacityDetailsModel ScenarioFilters { get; set; }
public SaveCapacityDetailsChangesModel()
{
ChangedExpCats = new List();
}
}
public class CapacityDetailsOptionsModel
{
public string MenuId { get; set; }
public string AdditionalFilterParams { get; set; }
public PagePreferencesList.PagePreferencesSource Source { get; set; }
}
}