本文整理汇总了C#中ApiDateTime类的典型用法代码示例。如果您正苦于以下问题:C# ApiDateTime类的具体用法?C# ApiDateTime怎么用?C# ApiDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApiDateTime类属于命名空间,在下文中一共展示了ApiDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PageWrapper
public PageWrapper(Page page)
{
Name = page.PageName;
Content = page.Body;
UpdatedBy = EmployeeWraper.Get(Core.CoreContext.UserManager.GetUsers(page.UserID));
Updated = (ApiDateTime)page.Date;
}
示例2: MilestoneWrapper
public MilestoneWrapper(Milestone milestone)
{
Id = milestone.ID;
ProjectOwner = new SimpleProjectWrapper(milestone.Project);
Title = milestone.Title;
Description = milestone.Description;
Created = (ApiDateTime)milestone.CreateOn;
CreatedBy = EmployeeWraper.Get(milestone.CreateBy);
Updated = (ApiDateTime)milestone.LastModifiedOn;
if (milestone.CreateBy != milestone.LastModifiedBy)
{
UpdatedBy = EmployeeWraper.Get(milestone.LastModifiedBy);
}
if (!milestone.Responsible.Equals(Guid.Empty))
{
Responsible = EmployeeWraper.Get(milestone.Responsible);
}
Status = (int)milestone.Status;
Deadline = new ApiDateTime(milestone.DeadLine, TimeZoneInfo.Local);
IsKey = milestone.IsKey;
IsNotify = milestone.IsNotify;
CanEdit = ProjectSecurity.CanEdit(milestone);
CanDelete = ProjectSecurity.CanDelete(milestone);
ActiveTaskCount = milestone.ActiveTaskCount;
ClosedTaskCount = milestone.ClosedTaskCount;
}
示例3: SaveReportTemplate
public ReportTemplateWrapper SaveReportTemplate(string name, string period, int periodItem, int hour, bool autoGenerated, ReportType reportType,
int tag, int project, TaskStatus? status, Guid departament, Guid userId, ReportTimeInterval reportTimeInterval,
ApiDateTime fromDate, ApiDateTime toDate, int viewType, bool noResponsible)
{
ProjectSecurity.DemandAuthentication();
if (name == null || name.Trim().Length == 0) throw new ArgumentNullException("name");
var filter = new TaskFilter
{
TagId = tag,
DepartmentId = departament,
UserId = userId,
TimeInterval = reportTimeInterval,
FromDate = fromDate,
ToDate = toDate,
ViewType = viewType,
NoResponsible = noResponsible
};
if (project != 0)
filter.ProjectIds.Add(project);
if (status != null)
filter.TaskStatuses.Add((TaskStatus)status);
var template = new ReportTemplate(reportType) { Filter = filter };
SaveOrUpdateTemplate(template, name, period, periodItem, hour, autoGenerated);
return new ReportTemplateWrapper(template);
}
示例4: SimpleTaskWrapper
public SimpleTaskWrapper(Task task)
{
ID = task.ID;
Title = task.Title;
Description = task.Description;
Deadline = (ApiDateTime)task.Deadline;
}
示例5: BuildContactPopulateReport
public ReportWrapper BuildContactPopulateReport(
ApiDateTime fromDate,
ApiDateTime toDate,
bool? isCompany,
string tagName,
int contactType)
{
var reportData = DaoFactory.GetReportDao().BuildContactPopulateReport(fromDate, toDate, isCompany, tagName, contactType);
var report = new ReportWrapper
{
ReportTitle = CRMReportResource.Report_ContactPopulate_Title,
ReportDescription = CRMReportResource.Report_ContactPopulate_Description,
Data = reportData.ConvertAll(row => new
{
Date = (ApiDateTime)TenantUtil.DateTimeFromUtc(DateTime.Parse(Convert.ToString(row[0]))),
Count = row[1]
}),
Lables = new List<string>
{
CRMCommonResource.Date,
CRMCommonResource.Count
}
};
return report;
}
示例6: GetMessageByFilter
public IEnumerable<MessageWrapper> GetMessageByFilter(int projectid, int tag, Guid departament, Guid participant,
ApiDateTime createdStart, ApiDateTime createdStop, int lastId,
bool myProjects, bool follow, MessageStatus? status)
{
var messageEngine = EngineFactory.GetMessageEngine();
var taskFilter = new TaskFilter
{
DepartmentId = departament,
UserId = participant,
FromDate = createdStart,
ToDate = createdStop,
SortBy = _context.SortBy,
SortOrder = !_context.SortDescending,
SearchText = _context.FilterValue,
TagId = tag,
Offset = _context.StartIndex,
Max = _context.Count,
MyProjects = myProjects,
LastId = lastId,
Follow = follow,
MessageStatus = status
};
if (projectid != 0)
taskFilter.ProjectIds.Add(projectid);
_context.SetDataPaginated();
_context.SetDataFiltered();
_context.SetDataSorted();
_context.TotalCount = messageEngine.GetByFilterCount(taskFilter);
return messageEngine.GetByFilter(taskFilter).NotFoundIfNull().Select(r => new MessageWrapper(r)).ToSmartList();
}
示例7: GetTaskTimeByFilter
public IEnumerable<TimeWrapper> GetTaskTimeByFilter(int projectid, bool myProjects, int? milestone, bool myMilestones, int tag,
Guid departament, Guid participant, ApiDateTime createdStart, ApiDateTime createdStop, int lastId, PaymentStatus? status)
{
var taskFilter = new TaskFilter
{
DepartmentId = departament,
UserId = participant,
FromDate = createdStart,
ToDate = createdStop,
SortBy = _context.SortBy,
SortOrder = !_context.SortDescending,
SearchText = _context.FilterValue,
TagId = tag,
Offset = _context.StartIndex,
Max = _context.Count,
LastId = lastId,
MyProjects = myProjects,
MyMilestones = myMilestones,
Milestone = milestone
};
if (projectid != 0)
taskFilter.ProjectIds.Add(projectid);
if (status.HasValue)
taskFilter.PaymentStatuses.Add(status.Value);
_context.SetDataPaginated();
_context.SetDataFiltered();
_context.SetDataSorted();
return EngineFactory.GetTimeTrackingEngine().GetByFilter(taskFilter).NotFoundIfNull().Select(r => new TimeWrapper(r)).ToSmartList();
}
示例8: TestLocal
public void TestLocal()
{
var apiDateTime1 = new ApiDateTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"));
var dateTime = (DateTime)apiDateTime1;
var utcTime = apiDateTime1.UtcTime;
Assert.AreEqual(dateTime.Kind, utcTime.Kind);
Assert.AreEqual(dateTime, utcTime);
}
示例9: TestUtc
public void TestUtc()
{
var apiDateTime1 = new ApiDateTime(DateTime.Now,TimeZoneInfo.Utc);
var dateTime = (DateTime)apiDateTime1;
var utcTime = apiDateTime1.UtcTime;
Assert.AreEqual(dateTime.Kind, utcTime.Kind);
Assert.AreEqual(dateTime, utcTime);
}
示例10: SearchItemWrapper
public SearchItemWrapper(SearchItem searchItem)
{
Id = searchItem.ID;
Title = searchItem.Title;
EntityType = searchItem.EntityType;
Created = (ApiDateTime) searchItem.CreateOn;
Description = searchItem.Description;
}
示例11: Test00
public void Test00()
{
var apiDateTime1 = new ApiDateTime(DateTime.Now);
var stringrep = apiDateTime1.ToString();
var dateTime = (DateTime)apiDateTime1;
var utcTime = apiDateTime1.UtcTime;
Assert.AreEqual(dateTime.Kind, utcTime.Kind);
Assert.AreEqual(dateTime, utcTime);
}
示例12: GetEventWrappers
public static List<EventWrapper> GetEventWrappers(this BaseCalendar calendar, Guid userId, ApiDateTime startDate, ApiDateTime endDate)
{
var result = new List<EventWrapper>();
if (calendar != null)
{
var events = calendar.LoadEvents(userId, startDate.UtcTime, endDate.UtcTime);
events.ForEach(e => result.AddRange(new EventWrapper(e, userId, calendar.TimeZone).GetList(startDate.UtcTime, endDate.UtcTime)));
}
return result;
}
示例13: 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),
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_rez = api_date.CompareTo(last_check_date);
if (compare_rez == 0) // equals
return null;
if (compare_rez == -1) // less
return new List<MailMessageItem>();
}
long total_messages;
var messages = GetFilteredMessages(filter, filter.Page, filter.PageSize, out total_messages);
CorrectPageValue(filter, total_messages);
_context.SetTotalCount(total_messages);
return messages;
}
示例14: GetFeed
public object GetFeed(
string product,
ApiDateTime from,
ApiDateTime to,
Guid? author,
bool? onlyNew,
ApiDateTime timeReaded)
{
var filter = new FeedApiFilter
{
Product = product,
From = from != null ? from.UtcTime : DateTime.MinValue,
To = to != null ? to.UtcTime : DateTime.MaxValue,
Offset = (int)context.StartIndex,
Max = (int)context.Count - 1,
Author = author ?? Guid.Empty,
SearchKeys = context.FilterValues,
OnlyNew = onlyNew.HasValue && onlyNew.Value
};
var feedReadedProvider = new FeedReadedDataProvider();
var lastTimeReaded = feedReadedProvider.GetTimeReaded();
var readedDate = timeReaded != null ? (ApiDateTime)timeReaded.UtcTime : (ApiDateTime)lastTimeReaded;
var commentReadedDate = (ApiDateTime)feedReadedProvider.GetTimeReaded("comments");
if (filter.OnlyNew)
{
filter.From = (ApiDateTime)lastTimeReaded;
filter.Max = 100;
}
else if (timeReaded == null)
{
feedReadedProvider.SetTimeReaded();
feedReadedProvider.SetTimeReaded("comments");
}
var feeds = FeedAggregateDataProvider
.GetFeeds(filter)
.GroupBy(n => n.GroupId,
n => new FeedWrapper(n),
(n, group) =>
{
var firstFeed = group.First();
firstFeed.GroupedFeeds = group.Skip(1);
return firstFeed;
})
.ToList();
context.SetDataPaginated();
return new {feeds, readedDate, commentReadedDate};
}
示例15: VoipCallWrapper
public VoipCallWrapper(VoipCall call, ContactWrapper contact = null)
{
Id = call.Id;
From = call.From;
To = call.To;
Status = call.Status;
AnsweredBy = EmployeeWraper.Get(call.AnsweredBy);
DialDate = new ApiDateTime(call.DialDate);
DialDuration = call.DialDuration;
Cost = call.TotalPrice;
Contact = contact;
History = call.History.Select(h => new VoipCallHistoryWrapper(h));
}