本文整理汇总了C#中JobStatus.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# JobStatus.ToString方法的具体用法?C# JobStatus.ToString怎么用?C# JobStatus.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JobStatus
的用法示例。
在下文中一共展示了JobStatus.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSelectCommand
/// <summary>
/// Creates a select command.
/// </summary>
/// <param name="connection">The connection to create the command with.</param>
/// <param name="status">The job status to filter results on.</param>
/// <param name="count">The maximum number of results to select.</param>
/// <param name="before">The queued-after date to filter on.</param>
/// <returns>A select command.</returns>
protected override DbCommand CreateSelectCommand(DbConnection connection, JobStatus status, int count, DateTime before)
{
const string SqlStart = "SELECT{0} * FROM {1} WHERE {2} = {3} AND {4} < {5} ORDER BY {4};";
DbCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Status"), status.ToString()));
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Before"), before));
string countString = String.Empty;
if (count > 0)
{
countString = String.Format(CultureInfo.InvariantCulture, " TOP ({0})", this.ParameterName("Count"));
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Count"), count));
}
command.CommandText = String.Format(
CultureInfo.InvariantCulture,
SqlStart,
countString,
this.TableName,
this.ColumnName("Status"),
this.ParameterName("Status"),
this.ColumnName("QueueDate"),
this.ParameterName("Before"));
return command;
}
示例2: GetStatusOption
public static StatusOption GetStatusOption(JobStatus status, DataAccessDataContext context)
{
return StatusService.GetStatuses(context)[StatusType.JobStatus].Where(s => s.SystemName == status.ToString()).SingleOrDefault();
}
示例3: LoadBy
public IEnumerable<Job> LoadBy(JobStatus status)
{
return
_connection.Query(
string.Format(
"select {0} from DependableJobs " +
"where Status = @Status and Suspended = 0 and InstanceName = @InstanceName",
Columns),
new {Status = status.ToString(), InstanceName = _instanceName})
.Select(Deserialize)
.ToArray();
}
示例4: GetJobStatusID
public int GetJobStatusID(JobStatus oJobStatus)
{
var iJobStatusID = 0;
var sCacheItemKey = "JobStatus-" + oJobStatus.ToString();
if (HttpContext.Current.Cache[sCacheItemKey] == null)
{
iJobStatusID = GetJobStatusFromDB(oJobStatus).IAJobStatusID;
HttpContext.Current.Cache.Add(sCacheItemKey, iJobStatusID, null, DateTime.Now.AddSeconds(3600), TimeSpan.Zero, CacheItemPriority.Normal, null);
}
else
{
iJobStatusID = (int) HttpContext.Current.Cache[sCacheItemKey];
}
return iJobStatusID;
}
示例5: GetJobStatusFromDB
/// <summary>
/// Retreives the apporpirate JobStatus object from the DB based on the enum value passed in
/// </summary>
/// <param name="oJobStatus"></param>
/// <returns></returns>
private IAJobStatus GetJobStatusFromDB(JobStatus oJobStatus)
{
IAJobStatus oIAJobStatus = null;
switch (oJobStatus)
{
case JobStatus.Incomplete:
oIAJobStatus = DataAccess.IAJobStatus.SingleOrDefault(row => row.Name == "Incomplete");
break;
case JobStatus.CompleteNeedsProduction:
oIAJobStatus = DataAccess.IAJobStatus.SingleOrDefault(row => row.Name == "Complete - Needs Production");
break;
case JobStatus.Complete:
oIAJobStatus = DataAccess.IAJobStatus.SingleOrDefault(row => row.Name == "Complete");
break;
case JobStatus.ReCutRequested:
oIAJobStatus = DataAccess.IAJobStatus.SingleOrDefault(row => row.Name == "Re-Cut Requested");
break;
default:
throw new ApplicationException(string.Format("Job status is undefined or doesn't exist: {0}", oJobStatus.ToString()));
}
return oIAJobStatus;
}
示例6: CreateSelectCommand
/// <summary>
/// Creates a select command.
/// </summary>
/// <param name="connection">The connection to create the command with.</param>
/// <param name="status">The job status to filter results on.</param>
/// <param name="count">The maximum number of results to select.</param>
/// <param name="before">The queued-after date to filter on.</param>
/// <returns>A select command.</returns>
protected virtual DbCommand CreateSelectCommand(DbConnection connection, JobStatus status, int count, DateTime before)
{
const string SqlStart = "SELECT * FROM {0} WHERE {1} = {2} AND {3} < {4} ORDER BY {3}";
const string SqlEnd = " LIMIT {0}";
DbCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Status"), status.ToString()));
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Before"), before));
StringBuilder sb = new StringBuilder();
sb.AppendFormat(
CultureInfo.InvariantCulture,
SqlStart,
this.TableName,
this.ColumnName("Status"),
this.ParameterName("Status"),
this.ColumnName("QueueDate"),
this.ParameterName("Before"));
if (count > 0)
{
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Count"), count));
sb.AppendFormat(CultureInfo.InvariantCulture, SqlEnd, this.ParameterName("Count"));
}
sb.Append(";");
command.CommandText = sb.ToString();
return command;
}