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/-- ...
随机推荐
- 学习笔记---Javascript事件Event、IE浏览器下的拖拽效果
学习笔记---Javascript事件Event.IE浏览器下的拖拽效果 1. 关于event常用属性有returnValue(是否允许事件处理继续进行, false为停止继续操作).srcE ...
- java word转pdf 工具类
package com.elitel.hljhr.comm.web.main.controller; import java.io.File; import java.io.FileOutputStr ...
- window 服务注册、卸载
1.以管理员身份打开 命令窗口 2.服务注册命令:sc create myServer binpath= path 3.服务卸载命令:sc delete myServer Topshelf 服务安装 ...
- Hadoop学习---Ubuntu中hadoop完全分布式安装教程
软件版本 Hadoop版本号:hadoop-2.6.0-cdh5.7.0: VMWare版本号:VMware 9或10 Linux系统:CentOS 6.4-6.5 或Ubuntu版本号:ubuntu ...
- antd Grid
import { Row, Col } from 'antd'; <Row type="flex" //内容布局(左靠齐,右靠齐,居中) justify="star ...
- 事件总线(Event Bus)
事件总线(Event Bus)知多少 源码路径:Github-EventBus简书同步链接 1. 引言 事件总线这个概念对你来说可能很陌生,但提到观察者(发布-订阅)模式,你也许就很熟悉.事件总线是对 ...
- Intellij IDEA快速补全System.out.print : sout
- eclipse去掉xml验证的方法
eclipse Multiple annotations found at this line错误,eclipse开发过程中,一些XML配置文件会报错,但是这些其实不是错,飘红的原因是因为eclips ...
- C# Hadoop学习笔记(七)—C#的云计算框架借鉴(下)
转自:http://blog.csdn.net/black0707/article/details/12853049 在上篇里,我们主要讨论了,这个系统怎样处理大数据的“读”操作,当然还有一些细节没有 ...
- PHP使用in_array函数检查数组中是否存在某个值
PHP使用 in_array() 函数检查数组中是否存在某个值,如果存在则返回 TRUE ,否则返回 FALSE. bool in_array( mixed needle, array array [ ...