本文整理汇总了C#中IRequestContext.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# IRequestContext.Contains方法的具体用法?C# IRequestContext.Contains怎么用?C# IRequestContext.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRequestContext
的用法示例。
在下文中一共展示了IRequestContext.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtendThruDate
/// <summary>
/// If ThruDate is set to the minimum time (00:00),
/// set to the maximum time instead (23:59).
/// </summary>
/// <param name="context"></param>
private void ExtendThruDate(IRequestContext context)
{
bool have = context.Contains(App.THRU_DATE);
if (!have) return;
DateTime thruDate = DateTime.MinValue;
try
{
thruDate = (DateTime) context[App.THRU_DATE];
}
catch (Exception e)
{
if (e != null) return; // Placate Resharper
}
bool defaultTime = (thruDate.Hour == 0) && (thruDate.Minute == 0) && (thruDate.Second == 0) &&
(thruDate.Millisecond == 0);
if (defaultTime)
{
string strThruDate = thruDate.ToShortDateString() + LAST_TICK;
DateTime newThruDate = Convert.ToDateTime(strThruDate);
context.Remove(App.THRU_DATE);
context.Add(App.THRU_DATE, newThruDate);
}
}
示例2: ProcessRequired
private void ProcessRequired(IRequestContext context)
{
IList requiredIDs = context.CommandBin.RequiredIDs; // inner list
if (requiredIDs == null) return;
IList runtimeIDs = context.CommandBin.RuntimeIDs; // inner list
if (runtimeIDs != null)
{
IEnumerator runtime = runtimeIDs.GetEnumerator();
while (runtime.MoveNext())
{
string id = runtime.Current as string;
requiredIDs.Remove(id);
}
}
IEnumerator required = requiredIDs.GetEnumerator();
while (required.MoveNext())
{
string id = required.Current as string;
bool okay = (context.Contains(id) && (null != context[id]) && (!String.Empty.Equals(context[id].ToString())));
if (!okay)
{
context.AddAlertRequired(id);
}
}
}