Csharp/C#教程:获取DateTime CRM 2011分享


获取DateTime CRM 2011

我在使用DateTime时遇到了一些问题:使用Fetch

   

认为这有点错了….

  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); } 

任何想法如何使用来自fetch的AliasedValue编写DateTime? 或者更好的方法来做到这一点>

谢谢

我曾经讨厌处理别名值,但后来我写了一些扩展方法,现在我不再担心它们了。 查看我的博客简化CRM 2011中的别名值检索 。 我认为它将有助于解决您当前的问题。

感谢您的帮助,我决定只使用单独的fetch来获取日期值

 string Date_Gather = string.Format(@"     ", entity.Id); foreach (var b in Date_Gather_result.Entities) { if (b.Attributes.Contains("new_enddate")) { enddate = ((DateTime)(b["new_enddate"])); Entity.Attributes.Add("scheduledend", enddate); } } 

谢谢,无论如何希望它能帮助别人

上述就是C#学习教程:获取DateTime CRM 2011分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

www.ctvol.com true Article Csharp/C#教程:获取DateTime CRM 2011分享

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/1027248.html

(0)
上一篇 2022年1月9日 下午10:15
下一篇 2022年1月9日 下午10:16

精彩推荐