当前位置: 首页>>代码示例>>C#>>正文


C# ApiDateTime.CompareTo方法代码示例

本文整理汇总了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;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:14,代码来源:MailApi.Folders.cs

示例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;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:67,代码来源:MailApi.Conversations.cs

示例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;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:52,代码来源:MailApi.Messages.cs


注:本文中的ApiDateTime.CompareTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。