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应用js
http://blog.csdn.net/carson_ho/article/details/64904691 通过 WebViewClient 的方法shouldOverrideUrlLoading ...
- MUI实现上拉加载和下拉刷新
编写存储过程分页(此处使用T-SQL) CREATE PROC [dbo].[Common_PageList] ( @tab nvarchar(max),---表名 @strFld nvarchar( ...
- RabbitMQ 启动
1.使用Rabbit MQ 管理插件,可以更好的可视化方式查看Rabbit MQ 服务器实例的状态,你可以在命令行中使用下面的命令激活: C:\Program Files\RabbitMQ Serve ...
- Python初学者第九天 字符串、列表、字典练习
# -*- coding: utf-8 -*-写代码,有如下字典,按要求实现每个功能dic={'k1':'v1','k2':'v2','k3':'v3'}1.请循环遍历出所有的key:dic={'k1 ...
- 设置dedecms标签 [field:global.autoindex/] 初始值{class递增}
在{dede:arclist/}这个标签中有个[field:global.autoindex/],是从0开始自增,如果我们想自定义一个数值,比如自定义从2开始.那么就可以写成下面代码: [field: ...
- c++11 实现RAII特性
参考文章https://blog.csdn.net/pongba/article/details/7911997 什么是RAII 技术?(参见百度百科相关条目) RAII(Resource Acqui ...
- Android进阶笔记16:onInterceptTouchEvent、onTouchEvent与onTouch
1. onTouch方法:onTouch方法是View的 OnTouchListener借口中定义的方法,处理View及其子类被touch是的事件处理.当一个View绑定了OnTouchLister后 ...
- Ubuntu14.04.3,apt-get出现dpkg: error processing package xxx (--configure)和cups-daemon错误的解决方案
Ubuntu14.04.3,使用apt-get安装软件的时候,报个莫名其妙的错误: dpkg: error processing package xxx (--configure): balabala ...
- Android中跑马灯效果
<com.randy.test1.self.MarqueeText android:id="@+id/btn1" android:layout_width="mat ...
- 2.为ADF应用添加安全性认证
1.打开ADF应用之后,选择Application==>Secure==>Configure ADF Security 2.在弹出框中选择ADF Authentication,一直Next ...