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 ...
随机推荐
- android的系统设置界面
Intent 的 意图: Intent intent = new Inetnt(Setings); Setings: 1. ACTION_ACCESSIBILITY_SETTINGS : // 跳 ...
- Oracle从入门到精通 限定查询和排序查询的问题
视频课程:李兴华 Oracle从入门到精通视频课程 学习者:阳光罗诺 视频来源:51CTO学院 知识点 SQL语句的执行顺序 限定符号的使用. 具体内容: 如果想要对所选择的数据进行控制,就可以使 ...
- 如何使用Adobe Reader复制PDF文档上的文字
PDF文档大家常用,但是有没有简单的方法能够提取PDF文档上的文字,然后使用呢?除了将PDF转换成Word,这里介绍一种更为简单实用的方法复制PDF文本文字,Adobe Reader是大家都常用的PD ...
- MATLAB基础指令操作
由于课程实验需要学习使用了MATLAB,在此记录一下MATLAB的基本操作和命令,供参考与查阅. 学习过程中的资料也链接如下: MATLAB矩阵运算:https://wenku.baidu.com/v ...
- 随滚动条滚动,始终处于屏幕的中间类似qq的浮动窗口 (能看到运动的过程)
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- Redis客户端 Spring Data Redis(未完)
官网:http://projects.spring.io/spring-data-redis/ 1.0 参考之前的一片文章:Gradle入门实战(Windows版) 构建java applicati ...
- 编程三基:cpu:算法,总线(io):一切皆文件;内存:运行空间
编程三基:cpu:算法,总线:一切皆文件:内存:数据.运行空间 原文找不到了.
- UVa 12716 - GCD XOR(筛法 + 找规律)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- luogu P4231 三步必杀
嘟嘟嘟 这道题就是区间加一个等差数列,然后最后求每一个数的值. O(n)做法:二阶差分. 其实就是差分两遍.举个例子 0 0 0 0 0 0 0,变成了 0 2 4 6 8 0 0.第一遍差分:0 2 ...
- struts2不同版本在核心filter在web.xml中的配置
FilterDispatcher是struts2.0.x到2.1.2版本的核心过滤器.配置如下: <filter> <filter-name>struts2</filte ...