Last active
December 17, 2015 06:09
-
-
Save Maarten88/5563624 to your computer and use it in GitHub Desktop.
Domain Entity class for the Cloud Auction project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Web; | |
using SqlFu; | |
namespace Auction.Web.Domain.Models | |
{ | |
[Table("Auction", PrimaryKey = "Id"/*default*/, AutoGenerated = true /*default*/)] | |
public class Auction : Entity<int> | |
{ | |
public Auction(Auction auction) : base(auction.Id) | |
{ | |
this.Title = auction.Title; | |
this.Start = auction.Start; | |
this.OpeningTime = auction.OpeningTime; | |
this.ClosingTime = auction.ClosingTime; | |
this.OpenOnSaturdays = auction.OpenOnSaturdays; | |
this.OpenOnSundays = auction.OpenOnSundays; | |
this.End = auction.End; | |
this.Type = auction.Type; | |
this.State = auction.State; | |
} | |
public Auction() | |
{ | |
} | |
[Required(ErrorMessage = "A title is required.")] | |
public string Title { get; set; } | |
[Required] | |
public DateTime Start { get; set; } | |
public DateTime? End { get; set; } | |
[Display(Name = "Dagelijkse openingstijd")] | |
[Required(ErrorMessage = "Dit is een verplicht veld. Vul 00:00 in als de veiling dag en nacht doorgaat")] | |
[DataType(DataType.Time)] | |
[DisplayFormat(DataFormatString = "{0:hh\\:mm}", ApplyFormatInEditMode = true)] | |
public TimeSpan OpeningTime { get; set; } | |
[Display(Name = "Dagelijkse sluitingstijd")] | |
[Required(ErrorMessage = "Dit is een verplicht veld. Vul 00:00 in als de veiling dag en nacht doorgaat")] | |
[DataType(DataType.Time)] | |
[DisplayFormat(DataFormatString = "{0:hh\\:mm}", ApplyFormatInEditMode = true)] | |
public TimeSpan ClosingTime { get; set; } | |
[Display(Name = "Open op zaterdag")] | |
public bool OpenOnSaturdays { get; set; } | |
[Display(Name = "Open op zondag")] | |
public bool OpenOnSundays { get; set; } | |
[Required] | |
public AuctionState State { get; set; } | |
[Required] | |
public AuctionType Type { get; set; } | |
} | |
public enum AuctionState : int | |
{ | |
[Description("Inactive")] | |
Inactive = 0, | |
[Description("Planned")] | |
Planned = 1, | |
[Description("Running")] | |
Running = 2, | |
[Description("Stopped")] | |
Stopped = 3, | |
[Description("Finished")] | |
Finished = 4 | |
} | |
public enum AuctionType : int | |
{ | |
[Description("Fire Sale")] | |
FireSale = 0, | |
[Description("Exit Auction")] | |
ExitAuction = 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment