public bool VenueIsValid(int value)
{
// Event not initalised yet, temp. set it to true.
if (this.DBObj.Event == null)
return true;
Console.WriteLine("Clash: " + value + " " + this.Start + " " + this.End);
List<DBLayer.SubEvent> list = DBLayer.DomainModels.SubEventModel.getAllByVenueIDAndTime(value, this.Start, this.End, this.DBObj.Event.Id);
bool noClashResult = false;
if (list != null && list.Count > 0)
{
base.AddError("VenueId", VENUE_ERROR_SLASH, false);
noClashResult = false;
}
else
{
base.RemoveError("VenueId", VENUE_ERROR_SLASH);
noClashResult = true;
}
DBLayer.Venue v = DBLayer.DomainModels.VenueModel.getByID(value);
bool capResult = v.Capacity >= this.DBObj.Event.Capacity;
if (!capResult)
{
base.AddError("VenueId", VENUE_ERROR_CAP, false);
}
else
{
base.RemoveError("VenueId", VENUE_ERROR_CAP);
}
Console.WriteLine("Clash: " + noClashResult + " Cap: " + capResult);
return noClashResult && capResult;
}