本文整理汇总了C#中TaskItem.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TaskItem.ToString方法的具体用法?C# TaskItem.ToString怎么用?C# TaskItem.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskItem
的用法示例。
在下文中一共展示了TaskItem.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncTask
public void SyncTask(Case fogbugzCase, TaskItem outlookTask)
{
try
{
//Associate the case and task
outlookTask.SetFogbugzCaseId(fogbugzCase.CaseId);
Log.DebugFormat("Setting task metadata case id to {0}", fogbugzCase.CaseId);
var subjectWithCaseId = fogbugzCase.GetTitleWithCaseToken();
var taskNewer = false;
//Determine which is newer
var taskLastModified = outlookTask.GetLastModifiedDate();
if (taskLastModified != null && taskLastModified > fogbugzCase.LastUpdated)
taskNewer = true;
Log.DebugFormat("Fogbugz case last update: {0}", fogbugzCase.LastUpdated);
Log.DebugFormat("Outlook task last update: {0}", taskLastModified);
if (taskNewer)
{
Log.Debug("Task is newer than the fogbugz case");
fogbugzCase.PercentComplete = outlookTask.PercentComplete;
fogbugzCase.Subject = outlookTask.Subject;
if (outlookTask.DueDate != OutlookConnector.EmptyDate)
{
if (fogbugzCase.Due != null && fogbugzCase.Due.Value.Date == outlookTask.DueDate.Date)
{
//Don't update fogbugz in this case, because we'll only be dropping the time component.
//In other words, the fogbugz due date will be reset to midnight since Outlook doesn't store the time.
}
else
{
fogbugzCase.Due = outlookTask.DueDate;
}
}
//Not sure how to translate priorities back to fogbugz
}
else
{
Log.Debug("Fogbugz case is newer than the task");
outlookTask.PercentComplete = fogbugzCase.PercentComplete;
outlookTask.Subject = subjectWithCaseId;
if (fogbugzCase.Due != null)
{
outlookTask.DueDate = fogbugzCase.Due.Value;
//Only populate the start date if there is a due date, otherwise
//the task will have a due date the same as the start (stupid)
outlookTask.StartDate = fogbugzCase.Opened;
}
if (fogbugzCase.Priority == 1 || fogbugzCase.Priority == 2)
outlookTask.Importance = OlImportance.olImportanceHigh;
else if (fogbugzCase.Priority == 4 || fogbugzCase.Priority == 5 || fogbugzCase.Priority == 6)
outlookTask.Importance = OlImportance.olImportanceLow;
else
outlookTask.Importance = OlImportance.olImportanceNormal;
}
var tokens = new List<KeyValuePair<string, string>>
{
//Note; tokens must be lower case
new KeyValuePair<string, string>("caseid", fogbugzCase.CaseId.ToString()),
new KeyValuePair<string, string>("emailsubject", Uri.EscapeUriString(subjectWithCaseId))
};
outlookTask.RTFBody = Encoding.ASCII.GetBytes(GenerateTaskBody(tokens));
}
catch (Exception ex)
{
if(fogbugzCase != null)
Log.Info(fogbugzCase.ToString());
if(outlookTask != null)
Log.Info(outlookTask.ToString());
Log.Error("Error synchronizing tasks", ex);
throw;
}
}