EnVisageOnline/Main/Source/EnVisage/Models/NonProjectTimeCategoryModel.cs

78 lines
2.0 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
namespace EnVisage.Models
{
public class NonProjectTimeCategoryModel
{
public Guid Id { get; set; }
public string Name { get; set; }
/// <summary>Count of non-ptoject times related to this category</summary>
public int Scheduled { get; set; }
public bool CanBeDeleted
{
get
{
return Scheduled <= 0;
}
}
}
public class NonProjectTimeCategoryEditModel : IBaseModel<NonProjectTimeCategory>
{
public Guid Id { get; set; }
[Required]
[StringLength(25)]
[Display(Name = "Allocation Category Name")]
public string Name { get; set; }
#region IBaseModel Methods
/// <summary>
/// Copies data from model to DAL object.
/// </summary>
/// <param name="dbObj">A target DAL object.</param>
public void CopyTo(NonProjectTimeCategory dbObj)
{
if (dbObj == null)
throw new ArgumentNullException();
dbObj.Name = Name;
}
#endregion
}
public class NonProjectTimeCategoryReallocateModel : IBaseModel<NonProjectTimeCategory>
{
public Guid Id { get; set; }
[Required]
[StringLength(25)]
[Display(Name = "Allocation Category Name")]
public string Name { get; set; }
[Required]
[Display(Name = "Select Category to Reallocate To")]
public Guid CategoryId { get; set; }
#region IBaseModel Methods
/// <summary>
/// Copies data from model to DAL object.
/// </summary>
/// <param name="dbObj">A target DAL object.</param>
public void CopyTo(NonProjectTimeCategory dbObj)
{
if (dbObj == null)
throw new ArgumentNullException();
dbObj.Name = Name;
dbObj.Id = CategoryId;
}
#endregion
}
}