Case Helper
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query; /// <summary>
/// 案例
/// </summary>
public class IncidentHelper
{
public static readonly string entityName = "incident";
public Guid incidentId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建案例
/// </summary>
public void Create()
{
Entity en = new Entity() { LogicalName = entityName };
en["name"] = "案例测试";
incidentId = service.Create(en);
} /// <summary>
/// 计算在案例上花费的总时间
/// </summary>
public void CalculateTotalTimeIncident()
{
CalculateTotalTimeIncidentRequest request = new CalculateTotalTimeIncidentRequest();
request.IncidentId = incidentId;
CalculateTotalTimeIncidentResponse response = (CalculateTotalTimeIncidentResponse)service.Execute(request);
long time = response.TotalTime;
} /// <summary>
/// 将案例的状态设置为“已结束”
/// </summary>
/// <param name="status">结束的状态</param>
public void CloseIncident(int status)
{
CloseIncidentRequest request = new CloseIncidentRequest();
request.IncidentResolution = new Entity() { LogicalName = entityName, Id = incidentId };
request.Status = new OptionSetValue(status);
CloseIncidentResponse response = (CloseIncidentResponse)service.Execute(request);
} /// <summary>
/// 验证是否可随时结束案例
/// </summary>
/// <param name="state">Active,Resolved,Canceled</param>
/// <param name="status">InProgress:1,OnHold:2,WaitingforDetails:3,Researching:4</param>
/// <param name="status">ProblemSolved:5,InformationProvided:1000,Canceled:6</param>
public void IsValidStateTransition(string state, int status)
{
IsValidStateTransitionRequest request = new IsValidStateTransitionRequest();
request.Entity = new EntityReference() { LogicalName = entityName, Id = incidentId };
request.NewState = state;
request.NewStatus = status;
IsValidStateTransitionResponse response = (IsValidStateTransitionResponse)service.Execute(request);
bool isValid = response.IsValid;
} /// <summary>
/// 删除指定安全主体(用户或团队)对案例的所有访问权限
/// </summary>
/// <param name="revokee">用户或团队引用</param>
public void RevokeAccess(EntityReference revokee)
{
RevokeAccessRequest request = new RevokeAccessRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = incidentId };
request.Revokee = revokee;
RevokeAccessResponse response = (RevokeAccessResponse)service.Execute(request);
} /// <summary> ///
/// 删除案例 ///
/// </summary>
public void Delete() { service.Delete(entityName, incidentId); }
}
Case Helper的更多相关文章
- Delphi -- Compiler helper for initializing/finalizing variable
it CompilerhelperForInitializingFinalizingVariable; interface { Compiler helper for initializing/fin ...
- IEHelper - Internet Explorer Helper Class
http://www.codeproject.com/Articles/4411/IEHelper-Internet-Explorer-Helper-Class Discussions (81) IE ...
- NPOI使用教程附Helper
1 NPOI简介 1.1 NPOI是什么 NPOI是POI的.NET版本,POI是一套用Java写成的库,我们在开发中经常用到导入导出表格.文档的情况,NPOI能够帮助我们在没有安装微软Office的 ...
- 高盛昂赛 算法题先写corner case
[方法] 字写大点,先注释框架 链表:指针走就行了,最多是两个同时一起走. 两个链表求交点 //corner case if (headA == null || headB == null) { re ...
- Creating Your Own PHP Helper Functions In Laravel
By Hamza Ali LAST UPDATED AUG 26, 2018 12,669 104 Laravel provides us with many built-in helper fun ...
- 784. Letter Case Permutation 字符串中字母的大小写组合
[抄题]: Given a string S, we can transform every letter individually to be lowercase or uppercase to c ...
- handlebars Helper用法
handlebars Helper用法: http://www.cnblogs.com/iyangyuan/archive/2013/12/12/3471357.html 逻辑运算符在handle ...
- Attacking JavaScript Engines: A case study of JavaScriptCore and CVE-2016-4622(转)
转:http://phrack.org/papers/attacking_javascript_engines.html Title : Attacking JavaScript Engines: A ...
- 微软原版SQL Helper
代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- ...
随机推荐
- ASPNET MVC Error 500.19
今天创建了一个新的ASPNET MVC 项目部署到本地, 生成成功后在浏览器中输入URL却发现报这个错 参照下面的文章我给IIS_IUSRS和IUSR(我比较懒直接everyone)赋予虚拟目录读写权 ...
- 【Leetcode】【Medium】Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...
- 浅析tnsping
首先,先弄清楚tnsping是什么: Oracle Net 工具(命令)tnsping,是一个OSI会话层的工具,测试数据库服务的命令,用来决定是否一个Oracle Net 网络服务(service) ...
- Redis添加访问密码
进入Redis的安装目录,找到redis.conf文件. 1.修改密码:使用vi命令打开redis.conf文件,先使用字符匹配查找到requirepass foobared对应的位置, 然后修改fo ...
- xtrabackup在线迁移mysql并搭建为主主同步
一.背景 工作中有需求数据库需要迁移,但是不能停服,不能锁库锁表影响业务的正常运行,所以使用XtraBackup 二.环境: 操作系统:CentOS Linux release 7.4.1708 (C ...
- July 13th 2017 Week 28th Thursday
No dream is too big, and no dreamer is too small. 梦想再大也不嫌大,追梦的人再小也不嫌小. Hold on to your dreams, but b ...
- CIKM 2013推荐系统论文总结
这几天在家没事,介绍几篇CIKM上关于推荐系统的文章, Personalized Influence Maximization on Social Networks Social Recommenda ...
- 使用jMeter构造逻辑上有依赖关系的一系列并发请求
相信前端开发工程师对CSRF(Cross-site request forgery)跨站请求伪造这个概念都非常熟悉,有的时候也简写成XSRF,是一种对网站的恶意利用. 尽管听起来像跨站脚本(XSS), ...
- 轻松bypass360网站卫士WAFSQL注入防护
随便网上找了一个网站,只是测试一下,没有干非法的事情! code 区域 http://www.py-guanyun.com/CompHonorBig.asp?id=49 code 区域 http:// ...
- tp 查询数据库时报错 A non well formed numeric value encountered
在database.php中配置或修改 'datetime_format' => false,