本文整理汇总了C#中IRequest.FindParameterStartingWith方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.FindParameterStartingWith方法的具体用法?C# IRequest.FindParameterStartingWith怎么用?C# IRequest.FindParameterStartingWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRequest
的用法示例。
在下文中一共展示了IRequest.FindParameterStartingWith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public IAction Create(IRequest request)
{
string actionParam = request.FindParameterStartingWith(DefaultUrlBuilder.ACTION_PARAMETER_PREFIX);
string actionName = actionParam == "" ? "" : actionParam.Substring(DefaultUrlBuilder.ACTION_PARAMETER_PREFIX.Length);;
if (actionName == "")
{
return giver.GiveObjectByType(typeof(DefaultAction)) as IAction;
}
IAction action = giver.GiveObjectById(actionName) as IAction;
if (action == null)
{
return new UnknownActionAction();
}
return action;
}
示例2: ForceBuildIfNecessary
private string ForceBuildIfNecessary(IRequest request)
{
if (request.FindParameterStartingWith("forcebuild") != string.Empty)
{
string forceBuildProject = request.GetText("forceBuildProject");
bool forceWasAllowed = false;
forceWasAllowed = farmService.ForceBuild(
new DefaultProjectSpecifier(
new DefaultServerSpecifier(request.GetText("forceBuildServer")),
forceBuildProject));
if (forceWasAllowed)
{
return string.Format("Build successfully forced for {0}", forceBuildProject);
}
else
{
return string.Format("Build was not allowed to be forced for {0}", forceBuildProject);
}
}
else
{
return "";
}
}
示例3: ForceBuildIfNecessary
private string ForceBuildIfNecessary(IRequest request, string sessionToken)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
foreach (string parameterName in HttpContext.Current.Request.Form.AllKeys)
{
if (parameterName.StartsWith("param_"))
{
parameters.Add(parameterName.Substring(6), HttpContext.Current.Request.Form[parameterName]);
}
}
// Make the actual call
if (request.FindParameterStartingWith("StopBuild") != string.Empty)
{
farmService.Stop(ProjectSpecifier(request), sessionToken);
return this.translations.Translate("Stopping project {0}", SelectedProject(request));
}
else if (request.FindParameterStartingWith("StartBuild") != string.Empty)
{
farmService.Start(ProjectSpecifier(request), sessionToken);
return this.translations.Translate("Starting project {0}", SelectedProject(request));
}
else if (request.FindParameterStartingWith("ForceBuild") != string.Empty)
{
farmService.ForceBuild(ProjectSpecifier(request), sessionToken, parameters);
return this.translations.Translate("Build successfully forced for {0}", SelectedProject(request));
}
else if (request.FindParameterStartingWith("AbortBuild") != string.Empty)
{
farmService.AbortBuild(ProjectSpecifier(request), sessionToken);
return this.translations.Translate("Abort successfully forced for {0}", SelectedProject(request));
}
else
{
return string.Empty;
}
}
示例4: ForceBuildIfNecessary
private string ForceBuildIfNecessary(IProjectSpecifier projectSpecifier, IRequest request, string sessionToken)
{
// Retrieve the parameters
var parameters = new Dictionary<string, string>();
foreach (string parameterName in HttpContext.Current.Request.Form.AllKeys)
{
if (parameterName.StartsWith("param_"))
{
parameters.Add(parameterName.Substring(6), HttpContext.Current.Request.Form[parameterName]);
}
}
if (!string.IsNullOrEmpty(request.FindParameterStartingWith("StopBuild")))
{
farmService.Stop(projectSpecifier, sessionToken);
return string.Format("Stopping project {0}", projectSpecifier.ProjectName);
}
else if (!string.IsNullOrEmpty(request.FindParameterStartingWith("StartBuild")))
{
farmService.Start(projectSpecifier, sessionToken);
return string.Format("Starting project {0}", projectSpecifier.ProjectName);
}
else if (!string.IsNullOrEmpty(request.FindParameterStartingWith("ForceBuild")))
{
farmService.ForceBuild(projectSpecifier, sessionToken, parameters);
return string.Format("Build successfully forced for {0}", projectSpecifier.ProjectName);
}
else if (!string.IsNullOrEmpty(request.FindParameterStartingWith("AbortBuild")))
{
farmService.AbortBuild(projectSpecifier, sessionToken);
return string.Format("Abort successfully forced for {0}", projectSpecifier.ProjectName);
}
else
{
return string.Empty;
}
}
示例5: SortAscending
private bool SortAscending(IRequest request)
{
return request.FindParameterStartingWith("ReverseSort") == string.Empty;
}