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 ...
随机推荐
- Oracle中用户和方案的区别
从定义中我们可以看出方案(Schema)为数据库对象的集合,为了区分各个集合,我们需要给这个集合起个名字,这些名字就是我们在企业管理器的方案下看到的许多类似用户名的节点,这些类似用户名的节点其实就是一 ...
- java面试题之----jdbc中使用的设计模式(桥接模式)
1.JDBC(JavaDatabase Connectivity) JDBC是以统一方式访问数据库的API. 它提供了独立于平台的数据库访问,也就是说,有了JDBC API,我们就不必为访问Oracl ...
- mongodb 3.4复制搭建
mongodb数据库主从复制的原理:在主从结构中,主节点的操作记录称为oplog(operation log).oplog存储在一个系统数据库local的集合oplog.$main中,这个集合的每个文 ...
- Oracle修改表名的几种方式
因为原来所在表不想被删除,但又需要新建立一个相同表名的表,故先把原来的表的表名更改为另一个临时表名. 查看当前用户下所有的表 select tname from tab where tabtype= ...
- 永中Office的ibus输入法问题
我在永中Office下无法调用ibus输入法,但是在其他窗口中都没有问题,如:gVIM,LeafPad,OpenOffice等等.我按照网上的方法在.bashrc文件中也添加了以下内容,可是还是不行. ...
- (转)C++ 自由存储区是否等价于堆?
“free store” VS “heap” 当我问你C++的内存布局时,你大概会回答: “在C++中,内存区分为5个区,分别是堆.栈.自由存储区.全局/静态存储区.常量存储区”. 如果我接着问你 ...
- CodeForces 91A Newspaper Headline
题目链接:CodeForces - 91A Newspaper Headline 官方题解: In this problem letters from s1 should be taken gree ...
- newcoder NOIP提高组模拟赛C题——保护
我是发了疯才来写这道题的 我如果用写这道题的时间去写dp,我估计我能写上三四道 可怕的数据结构题 题目 这道题的鬼畜之处在于实在是不太好写 我们看到要求离树根尽量的近,所以我们很容易就能想到树上倍增, ...
- WMIC常用
显示详细的进程信息 查找进程的具体路径 通过比较严查可疑文件 显示本机安装的软件
- PAT——1009. 说反话
给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出. 输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串.字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区 ...