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 ...
随机推荐
- spring----面试题
1.什么是Spring beans? Spring beans 是那些形成Spring应用的主干的java对象.它们被Spring IOC容器初始化,装配,和管理.这些beans通过容器中配置的元数据 ...
- 解决因 RsFX devicer 而无法卸载 SQL Server 的问题
到卸载 SQL Server 2008 R2 安装程序支持文件时,遇到了问题:“警告 26003.无法卸载 Microsoft SQL Server 2008 R2 安装程序支持文件,因为安装了以下产 ...
- Go语言 map遍历
1 遍历顺序 Go语言里的map,是不保证遍历顺序的(这一点很好理解).甚至同样内容的map,两次遍历的顺序,也可能不一样.下面是一个例子: m := map[string]int{"a1& ...
- Elasticsearch 架构原理
为什么要学习架构? Elasticsearch的一些架构设计,对我们做性能调优.故障处理,具有非常重要的影响.下面将从Elasticsearch的准实时索引的实现.自动发现.rounting和repl ...
- spring的声明式事务,及redis事务。
Redis的事务功能详解 http://ghoulich.xninja.org/2016/10/12/how-to-use-transaction-in-redis/ MULTI.EXEC.DISCA ...
- 名词后变为复数+s,或者+es等怎么读
, 以ce,se,ze, (d)ge等结尾的词 加 -s 读 /iz/ license-licenses, office offices 最佳答案1: 当名词后加-e(-es)变成复数,动词单数第三人 ...
- 自开发Web应用和SAP Customer Data Cloud Identity服务的集成
今天的文章继续由SAP成都研究院的云时代女王,Aviva给大家分享关于SAP Customer Data Cloud的一些使用经验. Aviva之前的文章可以在本文末尾处获得. 下面是她的正文. 大家 ...
- 洛谷 P3175 [HAOI2015]按位或
题目分析 与hdu4336 Card Collector相似,使用min-max容斥. 设\(\max(S)\)表示集合\(S\)中最后一位出现的期望时间. 设\(\min(S)\)表示集合\(S\) ...
- What is Systems Architecture ?
What is Systems Architecture ? Systems Architecture is a generic discipline to handle objects (exi ...
- JDBC(4)PreparedStatement
PreparedStatement: 是一个预编译对象 是Statement的子接口 允许数据库预编译SQL 执行SQL的时候,无需重新传入SQL语句,它们已经编译SQL语句 执行SQL语句 :exe ...