Invoice Helper
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Crm.Sdk.Messages; /// <summary>
/// 发票
/// </summary>
public class InvoiceHelper
{
public static readonly string entityName = "invoice";
public Guid invoiceId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建发票
/// </summary>
public void Create(Guid accountId)
{
Entity en = new Entity() { LogicalName = entityName, Id = accountId };
en["name"] = "发票测试";
en["accountid"] = new EntityReference() { LogicalName = "account", Id = accountId };
invoiceId = service.Create(en);
} /// <summary>
/// 将发票分派给其他用户或团队
/// </summary>
/// <param name="assignee">用户或团队引用</param>
public void Assign(EntityReference assignee)
{
AssignRequest request = new AssignRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = invoiceId };
request.Assignee = assignee;
AssignResponse response = (AssignResponse)service.Execute(request);
} /// <summary>
/// 锁定指定发票中产品的单价
/// </summary>
public void LockInvoicePricing()
{
LockInvoicePricingRequest request = new LockInvoicePricingRequest();
request.InvoiceId = invoiceId;
LockInvoicePricingResponse response = (LockInvoicePricingResponse)service.Execute(request);
} /// <summary>
/// 解锁指定发票中产品的单价
/// </summary>
public void UnlockInvoicePricing()
{
UnlockInvoicePricingRequest request = new UnlockInvoicePricingRequest();
request.InvoiceId = invoiceId;
UnlockInvoicePricingResponse response = (UnlockInvoicePricingResponse)service.Execute(request);
} /// <summary>
/// 取消指定安全主体(用户或团队)对发票的所有访问权限
/// </summary>
/// <param name="revokee">用户或团队引用</param>
public void RevokeAccess(EntityReference revokee)
{
RevokeAccessRequest request = new RevokeAccessRequest();
request.Target = new EntityReference() { LogicalName = entityName, Id = invoiceId };
request.Revokee = revokee;
RevokeAccessResponse response = (RevokeAccessResponse)service.Execute(request);
} /// <summary> ///
/// 删除发票 ///
/// </summary>
public void Delete() { service.Delete(entityName, invoiceId); }
}
Invoice 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 ...
随机推荐
- shell链接
5个实用的shell脚本面试题和答案: http://www.cnblogs.com/xinjie10001/p/6395945.html linux shell 逻辑运算符.逻辑表达式详细介绍: h ...
- Linux统计文件个数或是代码行数
统计指定后缀名的文件总个数命令: find . -name *.cpp | wc -l 统计一个目录下代码总行数以及单个文件行数: find . -name *.h | xargs wc -l lin ...
- 关于 Windows 7 语言包
在对IE浏览器进行多语言对应的时候,网页会检测当前系统的语言,来判断网页需要以哪种语言显示.但是,在给系统安装指定语言包时,可能会遇到安装失败的情况,原因就是需要在你的电脑上安装必需的基本语言包.请看 ...
- MapReduce过程详解(基于hadoop2.x架构)
本文基于hadoop2.x架构详细描述了mapreduce的执行过程,包括partition,combiner,shuffle等组件以及yarn平台与mapreduce编程模型的关系. mapredu ...
- 理解Underscore中的_.template函数
Underscore中提供了_.template函数实现模板引擎功能,它可以将JSON数据源中的数据对应的填充到提供的字符串中去,类似于服务端渲染的模板引擎.接下来看一下Underscore是如何实现 ...
- 理解JavaScript中的去抖函数
何为去抖函数?在学习JavaScript去抖函数之前我们需要先弄明白这个概念.很多人都会把去抖跟节流两个概念弄混,但是这两个概念其实是很好理解的. 去抖函数(Debounce Function),是一 ...
- yii 使用小技巧
1.db组件 'schemaCachingDuration'=>3600, 为什么不起做用? 需要开缓存 2.如何在页面下边显示sql的查询时间,在log组件的routes中加入 array( ...
- 20145223 杨梦云 《网络对抗》 Web基础
20145223 杨梦云 <网络对抗> Web基础 1.实验后回答问题 (1)什么是表单 表单在网页中主要负责数据采集功能.一个表单有三个基本组成部分:(1) 表单标签:这里面包含了处理表 ...
- 敏捷开发系列之旅 第五站(不一样的RUP统一软件开发过程)
概述 RUP,统一软件开发过程,是一个面向对象且基于网络的程序开发方法论.根据Rational的说法,RUP就好像一个在线的指导者,他可以为所有方面和层次的程序开发提供指导方针.模板以及事例支持. ...
- C#通过指针读取文件
// readfile.cs // 编译时使用:/unsafe // 参数:readfile.txt // C#通过指针读取文件.使用该程序读并显示文本文件. using System; using ...