本文整理汇总了C#中ApiDateTime.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# ApiDateTime.CompareTo方法的具体用法?C# ApiDateTime.CompareTo怎么用?C# ApiDateTime.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiDateTime
的用法示例。
在下文中一共展示了ApiDateTime.CompareTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFolders
public IEnumerable<MailBoxManager.MailFolderInfo> GetFolders(ApiDateTime last_check_time)
{
if (null != last_check_time)
{
var api_date = new ApiDateTime(mailBoxManager.GetMessagesModifyDate(TenantId, Username));
var compare_rez = api_date.CompareTo(last_check_time);
if (compare_rez < 1 && System.DateTime.MinValue != api_date) // if api_date == DateTime.MinValue then there are no folders in mail_folder
{
return null;
}
}
return FoldersList;
}
示例2: GetFilteredConversations
public IEnumerable<MailMessageItem> GetFilteredConversations(int? folder,
bool? unread,
bool? attachments,
long? period_from,
long? period_to,
bool? important,
string find_address,
int? mailbox_id,
IEnumerable<int> tags,
string search,
int? page_size,
ApiDateTime last_check_date,
string sortorder,
ApiDateTime from_date,
int? from_message,
bool? prev_flag
)
{
var filter = new MailFilter
{
PrimaryFolder = folder.GetValueOrDefault(MailFolder.Ids.inbox),
Unread = unread,
Attachments = attachments.GetValueOrDefault(false),
Period_from = period_from.GetValueOrDefault(0),
Period_to = period_to.GetValueOrDefault(0),
Important = important.GetValueOrDefault(false),
FindAddress = find_address,
MailboxId = mailbox_id,
CustomLabels = new ItemList<int>(tags),
SearchFilter = search,
PageSize = page_size.GetValueOrDefault(25),
SortOrder = sortorder
};
MailBoxManager.UpdateUserActivity(TenantId, Username);
if (null != last_check_date)
{
var date_time = MailBoxManager.GetFolderModifyDate(TenantId, Username, filter.PrimaryFolder);
var api_date = new ApiDateTime(date_time);
var compare_res = api_date.CompareTo(last_check_date);
switch (compare_res)
{
case 0:
return null;
case -1:
return new List<MailMessageItem>();
}
}
bool has_more;
var conversations = MailBoxManager.GetConversations(
TenantId,
Username,
filter,
from_date,
from_message.GetValueOrDefault(0),
prev_flag,
out has_more);
if (has_more)
_context.SetTotalCount(filter.PageSize + 1);
else
_context.SetTotalCount(conversations.Count);
return conversations;
}
示例3: GetFilteredMessages
public IEnumerable<MailMessageItem> GetFilteredMessages(int? folder,
bool? unread,
bool? attachments,
long? period_from,
long? period_to,
bool? important,
string find_address,
int? mailbox_id,
IEnumerable<int> tags,
string search,
int? page,
int? page_size,
ApiDateTime last_check_date,
string sort,
string sortorder
)
{
var filter = new MailFilter
{
PrimaryFolder = folder.GetValueOrDefault(MailFolder.Ids.inbox),
Unread = unread,
Attachments = attachments.GetValueOrDefault(false),
PeriodFrom = period_from.GetValueOrDefault(0),
PeriodTo = period_to.GetValueOrDefault(0),
Important = important.GetValueOrDefault(false),
FindAddress = find_address,
MailboxId = mailbox_id,
CustomLabels = new ItemList<int>(tags),
SearchFilter = search,
PageSize = page_size.GetValueOrDefault(25),
SortOrder = sortorder
};
if (null != last_check_date)
{
var dateTime = MailBoxManager.GetFolderModifyDate(TenantId, Username, filter.PrimaryFolder);
var apiDate = new ApiDateTime(dateTime);
var compareRez = apiDate.CompareTo(last_check_date);
if (compareRez == 0) // equals
return null;
if (compareRez == -1) // less
return new List<MailMessageItem>();
}
long totalMessages;
var messages = GetFilteredMessages(filter, filter.Page, filter.PageSize, out totalMessages);
CorrectPageValue(filter, totalMessages);
_context.SetTotalCount(totalMessages);
return messages;
}