public void UpdatePeriod(int id, Period period) { if (DateTime.Compare(period.PickStartDateTime, period.PickEndDateTime) >= 0) { throw new Exception($"Registration start date must be after its end date."); } if (DateTime.Compare(period.ReportStartDateTime, period.ReportEndDateTime) >= 0) { throw new Exception($"Play start date must be after its end date."); } var entity = _prdRepo.GetSingle(prd => prd.GameId == id && prd.Id == period.Id); if (entity == null) { throw new Exception($"Cannot find game for Id {id} or period Id {period.Id}"); } var hasChanged = !period.CompareTo(entity, "GameId"); if (hasChanged) { period.CopyTo(entity, "GameId"); _prdRepo.Update(entity); } }
public int CompareTo(Occurrence other) { if (Period != null && other.Period != null) { return(Period.CompareTo(other.Period)); } return(0); }
public int CompareTo(Key other) { var c = String.Compare(Name, other.Name, StringComparison.Ordinal); if (c != 0) { return(c); } c = Role.CompareTo(other.Role); if (c != 0) { return(c); } return(Period.CompareTo(other.Period)); }