117 lines
3.2 KiB
C#
117 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Xml.Serialization;
|
|
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using EnVisage.Models;
|
|
|
|
namespace EnVisage.Code.DAL.Mongo
|
|
{
|
|
/// <summary>
|
|
/// Represents information about one Project of any Mix.
|
|
/// </summary>
|
|
[BsonIgnoreExtraElements]
|
|
[Serializable]
|
|
public class MixProject
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string Name { get; set; }
|
|
public MixScenario Scenario { get; set; }
|
|
public List<Guid> Teams { get; set; }
|
|
public Boolean Pinned { get; set; }
|
|
|
|
public MixProject()
|
|
{
|
|
Teams = new List<Guid>();
|
|
}
|
|
|
|
public MixProject(MixProjectModel project)
|
|
: this()
|
|
{
|
|
if (project == null)
|
|
return;
|
|
|
|
Id = project.Id;
|
|
Name = project.Name;
|
|
Pinned = project.Pinned;
|
|
|
|
if (project.Scenario != null)
|
|
Scenario = (new MixScenario(project.Scenario));
|
|
|
|
if (project.Teams != null)
|
|
Teams = project.Teams;
|
|
}
|
|
}
|
|
|
|
[BsonIgnoreExtraElements]
|
|
[Serializable]
|
|
public class MixScenario
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid? ParentId { get; set; }
|
|
public long StartDate { get; set; }
|
|
public long EndDate { get; set; }
|
|
public Guid TemplateId { get; set; }
|
|
public bool GrowthScenario { get; set; }
|
|
public ScenarioType Type { get; set; }
|
|
public int Duration { get; set; }
|
|
public List<ScenarioCalendarRateModel> Rates { get; set; }
|
|
public bool IsNew { get; set; }
|
|
public bool IsBottomUp { get; set; }
|
|
public MixItemVersionInfo VersionInfo { get; set; }
|
|
public ScenarioCalendarMixFinInfoModel FinInfo { get; set; }
|
|
|
|
#region Constructors
|
|
|
|
public MixScenario()
|
|
{
|
|
|
|
}
|
|
|
|
public MixScenario(ScenarioCalendarMixModel scenario)
|
|
{
|
|
if (scenario == null)
|
|
return;
|
|
|
|
Id = scenario.Id;
|
|
ParentId = scenario.ParentId;
|
|
StartDate = scenario.StartDate;
|
|
EndDate = scenario.EndDate;
|
|
TemplateId = scenario.TemplateId;
|
|
GrowthScenario = scenario.GrowthScenario;
|
|
Type = scenario.Type;
|
|
Duration = scenario.Duration;
|
|
Rates = scenario.Rates;
|
|
IsNew = scenario.IsNew;
|
|
IsBottomUp = scenario.IsBottomUp;
|
|
VersionInfo = new MixItemVersionInfo()
|
|
{
|
|
SourceVersion = scenario.VersionInfo.SourceVersion,
|
|
RmoVersion = scenario.VersionInfo.RmoVersion
|
|
};
|
|
FinInfo = scenario.FinInfo != null ? scenario.FinInfo.Clone() : null;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// Information about versions of ralated item
|
|
/// </summary>
|
|
/// <remarks>SA. ENV-1085</remarks>
|
|
[BsonIgnoreExtraElements]
|
|
[Serializable]
|
|
public class MixItemVersionInfo
|
|
{
|
|
public MixItemVersionInfo()
|
|
{
|
|
RmoVersion = 1;
|
|
}
|
|
|
|
public ulong? SourceVersion { get; set; }
|
|
public ulong RmoVersion { get; set; }
|
|
}
|
|
|
|
} |