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
{
///
/// Represents information about one Project of any Mix.
///
[BsonIgnoreExtraElements]
[Serializable]
public class MixProject
{
public Guid Id { get; set; }
public string Name { get; set; }
public MixScenario Scenario { get; set; }
public List Teams { get; set; }
public Boolean Pinned { get; set; }
public MixProject()
{
Teams = new List();
}
public static explicit operator MixProject(MixProjectModel project)
{
if (project == null)
return null;
return new MixProject()
{
Id = project.Id,
Name = project.Name,
Scenario = (MixScenario)project.Scenario,
Teams = project.Teams,
Pinned = project.Pinned
};
}
}
[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 decimal? ProjectedRevenue { get; set; }
public bool GrowthScenario { get; set; }
public ScenarioType Type { get; set; }
public bool UseLMMargin { get; set; }
public decimal? GrossMargin { get; set; }
public decimal? LMMargin { get; set; }
public decimal? TDDirectCosts { get; set; }
public int Duration { get; set; }
public decimal CGSplit { get; set; }
public decimal EFXSplit { get; set; }
public CostSavingSnapshotModel CostSavings { get; set; }
public List Rates { get; set; }
public bool IsNew { get; set; } // SA. ENV-1159
public static explicit operator MixScenario(ScenarioCalendarMixModel scenario)
{
if (scenario == null)
return null;
return new MixScenario()
{
Id = scenario.Id,
ParentId = scenario.ParentId,
StartDate = scenario.StartDate,
EndDate = scenario.EndDate,
TemplateId = scenario.TemplateId,
ProjectedRevenue = scenario.ProjectedRevenue,
GrowthScenario = scenario.GrowthScenario,
Type = scenario.Type,
UseLMMargin = scenario.UseLMMargin,
GrossMargin = scenario.GrossMargin,
LMMargin = scenario.LMMargin,
TDDirectCosts = scenario.TDDirectCosts,
Duration = scenario.Duration,
CGSplit = scenario.CGSplit,
EFXSplit = scenario.EFXSplit,
CostSavings = scenario.CostSavings,
Rates = scenario.Rates,
IsNew = scenario.IsNew // SA. ENV-1159
};
}
}
}