yavsc/Yavsc.Server/Models/IT/Project.cs

68 lines
1.7 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
6 years ago
using System.Linq;
using Yavsc.Abstract.IT;
using Yavsc.Billing;
using Yavsc.Models.Billing;
using Yavsc.Server.Models.IT.SourceCode;
namespace Yavsc.Server.Models.IT
{
6 years ago
public class Project : NominativeServiceCommand, IProject
{
[Key]
6 years ago
public override long Id { get; set; }
public string OwnerId { get; set; }
6 years ago
/// <summary>
/// This field is something like a key,
/// since it is required non null,
/// and is the key of the foreign GitRepositoryReference entity.
///
/// As a side effect, there's no project without valid git reference in db.
/// </summary>
/// <returns></returns>
[Required]
public string Name { get; set; }
public string Version { get; set; }
[InverseProperty("TargetProject")]
public virtual List<ProjectBuildConfiguration> Configurations { get; set; }
[ForeignKey("Name")]
public virtual GitRepositoryReference Repository { get; set; }
6 years ago
List<IBillItem> bill = new List<IBillItem>();
public void AddBillItem(IBillItem item)
{
bill.Add(item);
6 years ago
}
public override List<IBillItem> GetBillItems()
{
return bill;
}
6 years ago
public IEnumerable<string> GetConfigurations()
{
return Configurations.Select(c => c.Name);
}
6 years ago
string description;
public override string Description
{
get { return description; }
set { description = value; }
}
public Project()
{
6 years ago
}
}
}