Appointment Helper
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query; /// <summary>
/// 约会
/// </summary>
public class AppointmentHelper
{
public static readonly string entityName = "appointment";
public Guid appointmentId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建约会
/// </summary>
public void Create()
{
WhoAmIRequest userRequest = new WhoAmIRequest();
WhoAmIResponse userResponse = (WhoAmIResponse)service.Execute(userRequest);
Entity activitypartyEn = new Entity() { LogicalName = "activityparty" };
activitypartyEn["partyId"] = new EntityReference() { LogicalName = "systemuser", Id = userResponse.UserId }; Entity en = new Entity() { LogicalName = entityName };
en["subject"] = "约会测试";
en["scheduledstart"] = DateTime.Now.AddHours();
en["scheduledend"] = DateTime.Now.AddHours();
en["location"] = "办公室";
en["requiredattendees"] = new Entity[] { activitypartyEn };
en["organizer"] = new Entity[] { activitypartyEn };
appointmentId = service.Create(en);
} /// <summary>
/// 向现有约会中添加定期信息,以使其成为定期主约会
/// </summary>
/// <param name="target">目标信息</param>
public void AddRecurrence(Entity target)
{
AddRecurrenceRequest request = new AddRecurrenceRequest();
request.AppointmentId = appointmentId;
request.Target = target;
AddRecurrenceResponse response = (AddRecurrenceResponse)service.Execute(request);
Guid id = response.id;
} /// <summary>
/// 将约会分派给其他用户或团队
/// </summary>
/// <param name="assignee">用户或团队引用</param>
public void Assign(EntityReference assignee)
{
AssignRequest request = new AssignRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = appointmentId };
request.Assignee = assignee;
AssignResponse response = (AssignResponse)service.Execute(request);
} /// <summary>
/// 安排或预定约会
/// </summary>
public void Book()
{
BookRequest request = new BookRequest();
request.Target = new Entity() { LogicalName = entityName, Id = appointmentId };
BookResponse response = (BookResponse)service.Execute(request);
ValidationResult validationResult = response.ValidationResult;
} /// <summary>
/// 重新安排约会
/// </summary>
public void Reschedule()
{
RescheduleRequest request = new RescheduleRequest();
request.Target = new Entity() { LogicalName = entityName, Id = appointmentId };
RescheduleResponse response = (RescheduleResponse)service.Execute(request);
ValidationResult validationResult = response.ValidationResult;
} /// <summary> ///
/// 删除约会 ///
/// </summary>
public void Delete() { service.Delete(entityName, appointmentId); }
}
Appointment Helper的更多相关文章
- [C#] 简单的 Helper 封装 -- RegularExpressionHelper
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- handlebars自定义helper的写法
handlebars相对来讲算一个轻量级.高性能的模板引擎,因其简单.直观.不污染HTML的特性,我个人特别喜欢.另一方面,handlebars作为一个logicless的模板,不支持特别复杂的表达式 ...
- Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value '"*, Microsoft.AspNet.Mvc.TagHelpers"'
project.json 配置: { "version": "1.0.0-*", "compilationOptions": { " ...
- VS2015突然报错————Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with value 'Microsoft.AspNet.Mvc.Razor.TagHelpers.UrlResolutionTagHelper
Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper' with ...
- JavaScript模板引擎artTemplate.js——template.helper()方法
上一篇文章我们已经讲到了helper()方法,但是上面的例子只是一个参数的写法,如果是多个参数,写法就另有区别了. <div id="user_info"></d ...
- [ASP.NET MVC 小牛之路]13 - Helper Method
我们平时编程写一些辅助类的时候习惯用“XxxHelper”来命名.同样,在 MVC 中用于生成 Html 元素的辅助类是 System.Web.Mvc 命名空间下的 HtmlHelper,习惯上我们把 ...
- asp.net MVC helper 和自定义函数@functions小结
asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...
- C# random helper class
项目中经常需要模拟些假数据,来做测试.这个随机生成数据的helper类就应用而生: using System; using System.Text; using System.Windows.Me ...
- @helper函数使用方法
这个函数方法,我也是通过别人博客看到的,感觉不错和大家一起学习分享一下. 1.自定义函数方法,只在同一个view视图文件里调用 Controller public ActionResult Index ...
随机推荐
- androidwebview网页显示事件
@Overridepublic void onPageCommitVisible(WebView view, String url) { super.onPageCommitVisible(view, ...
- SQL Server ->> FileTable
FileTable是SQL Server 2012的新特性之一.它是基于SQL Server 2008的FILESTREAM特性上而来的,允许我们把Windows文件存储在SQL Server中,让S ...
- Struts2学习-自动
和ssh框架的基本一致. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...
- Simotion 凸轮同步,偏移凸轮起点
将同步对象的 SyncingMotion.camReferenceBySlaveModeRelative 修改为 POSITION_AT_START_OF_CAMMING myRetDINT := _ ...
- June 24th 2017 Week 25th Saturday
Who is able to be egotistical needs to be strong too. 有本事任性的人,也要有本事坚强. What is egotistical? Is it th ...
- ZT北大青鸟营业额超20亿到不值一提 衰落的背后
北大青鸟营业额超20亿到不值一提 衰落的背后 2013-10-18 08:18 王根旺 我要评论 (0) “北大青鸟是个悲剧!”说到曾经的IT培训业巨头,黑马导师.珍品网创始人曹允东惋惜道.在学大创 ...
- ROC曲线手画
绘图过程很简单:给定m个正例子,n个反例子,根据学习器预测结果进行排序,先把分类阈值设为最大,使得所有例子均预测为反例,此时TPR和FPR均为0,在(0,0)处标记一个点,再将分类阈值依次设为每个样例 ...
- webConfig详细跳转配置.[转]
站更换域名,把旧域名用301指到新域名来. 从iis中设置url永久转向就可以,看上去很容易,用了一会儿才发现,参数都没有带上. 从微软网站上找到如下说明,果然好使: 重定向参考 (IIS 6.0,7 ...
- PhoneGap API 之多媒体
一. MediaApi 简单介绍 PhoneGap API Media 对象提供录制和回放设备上的音频文件的能力 参数: var media = new Media(src, mediaSuccess ...
- CALayer & bitmap Content
Working with High-Resolution Images Layers do not have any inherent knowledge of the resolution of t ...