本文整理汇总了C#中PluginProfileErrorCollection.Any方法的典型用法代码示例。如果您正苦于以下问题:C# PluginProfileErrorCollection.Any方法的具体用法?C# PluginProfileErrorCollection.Any怎么用?C# PluginProfileErrorCollection.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginProfileErrorCollection
的用法示例。
在下文中一共展示了PluginProfileErrorCollection.Any方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResponse
private static string GetResponse(string args)
{
var profile = args.DeserializeProfile();
var settings = (ConnectionSettings) profile.Settings;
var errors = new PluginProfileErrorCollection();
settings.ValidateConnection(errors);
if (errors.Any())
{
return errors.Serialize();
}
CheckConnection(settings, errors);
return errors.Any() ? errors.Serialize() : string.Empty;
}
示例2: Execute
public void Execute(PluginProfileErrorCollection errors)
{
if (errors.Any())
return;
ExecuteConcreate(errors);
}
示例3: CheckConnection
public bugzilla_properties CheckConnection(BugzillaProfile profile)
{
var errors = new PluginProfileErrorCollection();
try
{
SetServerCertificateValidationCallback(profile);
var validators = new Queue<Validator>();
var connectionValidator = new ConnectionValidator(profile);
validators.Enqueue(connectionValidator);
var scriptValidator = new ScriptValidator(profile);
validators.Enqueue(scriptValidator);
var responseValidator = new ResponseValidator(profile, scriptValidator);
validators.Enqueue(responseValidator);
var deserializeValidator = new DeserializeValidator(profile, responseValidator);
validators.Enqueue(deserializeValidator);
var settingsValidator = new SettingsValidator(profile, deserializeValidator);
validators.Enqueue(settingsValidator);
var savedQueryValidator = new SavedQueryValidator(profile);
validators.Enqueue(savedQueryValidator);
while (validators.Count > 0)
{
var validator = validators.Dequeue();
validator.Execute(errors);
}
if (errors.Any())
{
throw new BugzillaPluginProfileException(profile, errors);
}
return deserializeValidator.Data;
}
catch (BugzillaPluginProfileException)
{
throw;
}
catch (Exception ex)
{
errors.Add(new PluginProfileError
{
FieldName = BugzillaProfile.ProfileField,
Message = string.Format("The connection with {0} is failed. {1}", profile, ex.Message)
});
throw new BugzillaPluginProfileException(profile, errors);
}
}
示例4: Execute
public PluginCommandResponseMessage Execute(string args, UserDTO user)
{
var errors = new PluginProfileErrorCollection();
var profile = args.DeserializeProfile();
var settings = (BugzillaProfile) profile.Settings;
var properties = GetBugzillaProperties(settings, errors);
return errors.Any()
? new PluginCommandResponseMessage
{PluginCommandStatus = PluginCommandStatus.Fail, ResponseData = errors.Serialize()}
: new PluginCommandResponseMessage
{PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = properties.Serialize()};
}
示例5: CheckVersions
private static void CheckVersions(bugzilla_properties bugzillaProperties, PluginProfileErrorCollection errors)
{
if (!ScriptVersionIsValid(bugzillaProperties.script_version))
{
errors.Add(
new PluginProfileError
{
Message = string.Format(
TP2_CGI_IS_NOT_SUPPORTED_BY_THIS_PLUGIN,
string.IsNullOrEmpty(bugzillaProperties.script_version) ? "undefined" : bugzillaProperties.script_version),
AdditionalInfo = ValidationErrorType.InvalidTpCgiVersion.ToString()
});
}
if (!errors.Any() && !BugzillaVersionIsSupported(bugzillaProperties.version))
{
errors.Add(new PluginProfileError
{
Message = string.Format(
BUGZILLA_VERSION_IS_NOT_SUPPORTED_BY_PLUGIN,
bugzillaProperties.version),
AdditionalInfo = ValidationErrorType.InvalidBugzillaVersion.ToString()
});
}
if (!errors.Any() && !ScriptSupportsProvidedBugzillaVersion(bugzillaProperties.version, bugzillaProperties.supported_bugzilla_version))
{
errors.Add(new PluginProfileError
{
Message = string.Format(
BUGZILLA_VERSION_IS_NOT_SUPPORTED_BY_TP2_CGI,
bugzillaProperties.version),
AdditionalInfo = ValidationErrorType.InvalidTpCgiVersion.ToString()
});
}
}
示例6: ValidateNameUniqueness
protected void ValidateNameUniqueness(PluginProfileErrorCollection errors, MashupManagerProfile profile)
{
if (errors.Any())
return;
var existsSuchName = profile != null && profile.MashupNames
.Any(
m => m.Equals(Name, StringComparison.InvariantCultureIgnoreCase));
if (existsSuchName)
{
errors.Add(new PluginProfileError
{
FieldName = NameField,
Message = "Mashup with the same name already exists"
});
}
}
示例7: GetBugzillaProperties
public BugzillaProperties GetBugzillaProperties(BugzillaProfile profile, PluginProfileErrorCollection errors)
{
profile.ValidateCredentials(errors);
if (!errors.Any())
{
try
{
_logger.Info("Checking connection");
var bugzillaProperties = new BugzillaService().CheckConnection(profile);
_logger.Info("Connection success");
return new BugzillaProperties(bugzillaProperties);
}
catch (BugzillaPluginProfileException e)
{
e.ErrorCollection.ForEach(errors.Add);
_logger.WarnFormat("Connection failed: {0}", e);
}
}
return null;
}