private bool MatchesId(IProcessTemplateVersion currentversion) { if (string.IsNullOrWhiteSpace(this.TemplateTypeId)) { return(true); } return(currentversion.TypeId.Equals(new Guid(this.TemplateTypeId))); }
private bool MatchesMaxVersion(IProcessTemplateVersion currentversion) { if (string.IsNullOrWhiteSpace(this.MaxVersion)) { return(true); } var current = Version.Parse( string.Format(CultureInfo.InvariantCulture, "{0}.{1}", currentversion.Major, currentversion.Minor)); var max = Version.Parse(this.MaxVersion); return(current <= max); }
/// <summary> /// Checks whether this policy matches the request. /// </summary> /// <param name="currentRequestContext">The requestcontext of the TFS event</param> /// <param name="currentNotification">The notification holding the WorkItemChangedEvent.</param> /// <returns>true if the policy matches all supplied checks.</returns> public override ScopeMatchResult Matches(IRequestContext currentRequestContext, INotification currentNotification) { var res = new ScopeMatchResult(); var info = GetTemplateInfo(currentRequestContext, currentNotification); IProcessTemplateVersion currentversion = info.Item1; IProjectProperty templateNameProperty = info.Item2; string processTemplateDescription = string.Format( "{0} v{1}.{2} [{3}]", templateNameProperty?.Value, currentversion.Major, currentversion.Minor, currentversion.TypeId); res.Add(processTemplateDescription); res.Success = this.MatchesName(templateNameProperty) && this.MatchesId(currentversion) && this.MatchesMinVersion(currentversion) && this.MatchesMaxVersion(currentversion); return(res); }
private bool MatchesMaxVersion(IProcessTemplateVersion currentversion) { if (string.IsNullOrWhiteSpace(this.MaxVersion)) { return true; } var current = Version.Parse( string.Format(CultureInfo.InvariantCulture, "{0}.{1}", currentversion.Major, currentversion.Minor)); var max = Version.Parse(this.MaxVersion); return current <= max; }
private bool MatchesId(IProcessTemplateVersion currentversion) { if (string.IsNullOrWhiteSpace(this.TemplateTypeId)) { return true; } return currentversion.TypeId.Equals(new Guid(this.TemplateTypeId)); }