我在使用 DateTime 时遇到了一些问题:使用 Fetch
<attribute name='new_startdate' groupby='true' dategrouping='day' alias='new_startdate' />
<attribute name='new_enddate' groupby='true' dategrouping='day' alias='new_enddate' />
<attribute name='new_duedate' groupby='true' dategrouping='day' alias='new_duedate' />
认为这是错误的一点......
DateTime scheduledstart = ((DateTime)((AliasedValue)a["new_startdate"]).Value);
tracer.Trace("DateTime 1 Done");
DateTime enddate = ((DateTime)((AliasedValue)a["new_enddate"]).Value);
tracer.Trace("DateTime 2 Done");
DateTime scheduledend = ((DateTime)((AliasedValue)a["new_duedate"]).Value);
然后我添加到新实体...
if (scheduledstart != null)
{
Activity.Attributes.Add("scheduledstart", scheduledstart);
}
if (enddate != null)
{
Activity.Attributes.Add("scheduledend", enddate);
}
if (scheduledend != null)
{
Activity.Attributes.Add("scheduledend", scheduledend);
}
任何想法我如何使用提取的 AliasedValue 编写 DateTime?或者更好的方法>
谢谢
最佳答案
我以前讨厌处理别名值,但后来我写了一些扩展方法,现在我不再担心它们了。查看我的博客 Simplifying Retrieval of Aliased Values in CRM 2011 .我认为它会帮助您解决当前的问题。
关于c# - 获取日期时间 CRM 2011,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15290780/