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