crm操作发票实体
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);
}
}
最新文章
- MediaCodec Name &; Type
- 我总结的js性能优化的小知识
- LeetCode 263 Ugly Number
- android学习笔记54——ContentProvider
- 理解与模拟一个简单servlet容器
- ABAP程序中退出操作(CHECK, EXIT, RETURN, LEAVE PROGRAM)
- 改变placeholder颜色
- list.clear()和list=null的区别
- Iso language code table之(软件国际化)
- hdu 1839	Delay Constrained Maximum Capacity Path
- mysql trouble shooting---- 从库停止同步lock_wait_timeout_exceeded_try_restarting_transaction
- Javascript中变量作用域(2)
- C语言函函数嵌套
- 开发技巧(3-1)Eclipse查找关键字
- Canvas绘制五角星
- Python的logging日志
- Anatomy of a Database System学习笔记 - 公共模块、结语
- [转]Database Transactions in Laravel
- nginx.conf配置文件详解
- iptables filter表 案例、iptables nat表的路由功能 、端口映射