本文整理汇总了C#中Job.CalculateNextRunTime方法的典型用法代码示例。如果您正苦于以下问题:C# Job.CalculateNextRunTime方法的具体用法?C# Job.CalculateNextRunTime怎么用?C# Job.CalculateNextRunTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job.CalculateNextRunTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostUserGameConnectionData
public static object PostUserGameConnectionData(string ID, DataConnectionType TypeID, Hashtable Data)
{
try
{
GamervineDataContext dContext = new GamervineDataContext();
var gvUser = from usc in dContext.UserSocialConnections
where usc.ConnectionUserId == ID && usc.Type == TypeID.GetHashCode()
select usc;
if (gvUser.Count() > 0)
{
var dGamertag = from gt in dContext.Gamertags
where gt.Type == TypeID.GetHashCode() && gt.UserId == gvUser.First().UserId
select gt;
bool isStatusJobEnabled = false;
bool isSummaryJobEnabled = false;
bool isFacebookEnabled = false;
//bool isTagInsert = false;
if (Utility.ToInt(((Hashtable)((Hashtable)((Hashtable)Data["Data"])["Jobs"])["Status"])["Enabled"]) == 1)
isStatusJobEnabled = true;
if (Utility.ToInt(((Hashtable)((Hashtable)((Hashtable)Data["Data"])["Jobs"])["Summary"])["Enabled"]) == 1)
isSummaryJobEnabled = true;
if (Utility.ToInt(((Hashtable)((Hashtable)((Hashtable)Data["Data"])["GamertagSocialConnections"])["Facebook"])["Enabled"]) == 1)
isFacebookEnabled = true;
Gamertag gamertag = new Gamertag();
if (dGamertag.Count() == 0)
{
//isTagInsert = true;
gamertag = Insert(gvUser.First().UserId, TypeID.GetHashCode(), Data);
}
else
{
gamertag = dGamertag.First();
gamertag.Tag = Utility.ToString(((Hashtable)Data["Data"])["Tag"]);
var statusPost = from j in dContext.Jobs
where j.TagId == gamertag.TagId
&& j.Type == JobTypes.Status.GetHashCode()
select j;
var summaryPost = from j in dContext.Jobs
where j.TagId == gamertag.TagId
&& j.Type == JobTypes.Summary.GetHashCode()
select j;
var fbConnection = from gtsc in dContext.GamertagSocialConnections
where gtsc.TagId == gamertag.TagId
&& gtsc.UserSocialConnectionId == gvUser.First().UserSocialConnectionId
select gtsc;
if (isStatusJobEnabled)
{
Hashtable statusData = (Hashtable)((Hashtable)((Hashtable)Data["Data"])["Jobs"])["Status"];
Job statusJob = new Job();
//We have an existing status job and the enabled flag is true - persist settings
if (statusPost.Count() > 0)
statusJob = statusPost.First();
else
{
statusJob.JobId = Guid.NewGuid().ToString();
statusJob.LastRunTime = null;
statusJob.TagId = gamertag.TagId;
statusJob.PostFormat = string.Empty;
statusJob.Type = JobTypes.Status.GetHashCode();
dContext.Jobs.InsertOnSubmit(statusJob);
}
statusJob.Frequency = Utility.ToInt(statusData["Frequency"]);
statusJob.FrequencyUnits = Utility.ToInt(statusData["FrequencyUnits"]);
statusJob.NextRunTime = statusJob.CalculateNextRunTime();
}
else
{
//The enabled flag is false and if we have an existing status job - delete the job
if (statusPost.Count() > 0)
dContext.Jobs.DeleteOnSubmit(statusPost.First());
}
if (isSummaryJobEnabled)
{
Hashtable summaryData = (Hashtable)((Hashtable)((Hashtable)Data["Data"])["Jobs"])["Summary"];
Job summaryJob = new Job();
//We have an existing summary job and the enabled flag is true - persist settings
if (summaryPost.Count() > 0)
summaryJob = summaryPost.First();
else
{
summaryJob.JobId = Guid.NewGuid().ToString();
summaryJob.LastRunTime = null;
summaryJob.TagId = gamertag.TagId;
summaryJob.PostFormat = string.Empty;
summaryJob.Type = JobTypes.Summary.GetHashCode();
//.........这里部分代码省略.........