//Public Function DateRequired(ByVal target As Object, ByVal e As BrokenRules.RuleArgs) As Boolean // e.Description = e.PropertyName & " is required" // Return Not DirectCast(CallByName(target, e.PropertyName, CallType.Get), SmartDate).IsEmpty //End Function static public bool DateRequired(object target, RuleArgs e) { e.Description = e.PropertyName + " is required"; SmartDate value = (SmartDate)Utilities.CallByName(target, e.PropertyName, CallType.Get); return !value.IsNull; //return ((string)Utilities.CallByName(target, e.PropertyName, CallType.Get)).Length > 0; }
public bool ValidSetScore(object target, RuleArgs e) { if (!_parent.LoserDefaulted && TiebreakPlayed) { e.Description = string.Format("The set {0} winner must have won the tiebreak.", _setNumber); return Math.Sign(_WGames.CompareTo(_LGames)) == Math.Sign(_WTiebreak.CompareTo(_LTiebreak)); } //commented out because the parent is responsible for checking the overall match score //i.e. the parent calls AddInstanceBusinessRule to register ValidMatchScore, so we don't // need to call it here //return _parent.ValidMatchScore(_parent, e); return true; }
private bool SetWinnerIsTiebreakWinner(object target, RuleArgs e) { return true; }
//[BrokenRules.Description("Match winner cannot also be the loser")] private bool WinnerNotLoser(object target, RuleArgs e) { //if the winner has not been selected, don't enforse this rule e.Description = "Match winner cannot also be the loser."; return _WinnerID == 0 || _WinnerID != _LoserID; }
private bool ValidMatchScore(object target, RuleArgs e) { //if loser didn't default, winner must have won more sets than loser e.Description = "Winner must have won more sets than loser."; return _LoserDefaulted || WSets > LSets; }
static public bool DateIsInPast(object target, RuleArgs e) { e.Description = e.PropertyName + " must be in the past"; return (System.DateTime)Utilities.CallByName(target, e.PropertyName, CallType.Get) < System.DateTime.Now; }
static public bool ComboRequired(object target, RuleArgs e) { e.Description = e.PropertyName + " is required"; return (int)Utilities.CallByName(target, e.PropertyName, CallType.Get) > 0; }