zoukankan      html  css  js  c++  java
  • 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); }
    }
  • 相关阅读:
    LeetCode 4. Median of Two Sorted Arrays
    LeetCode 67. Add Binary
    LeetCode 66. Plus One
    Linux驱动之平台设备驱动模型简析(驱动分离分层概念的建立)
    Linux驱动之一个简单的输入子系统程序编写
    Linux驱动之输入子系统简析
    Linux驱动之定时器在按键去抖中的应用
    Linux驱动之同步、互斥、阻塞的应用
    Linux驱动之异步OR同步,阻塞OR非阻塞概念介绍
    Linux驱动之异步通知的应用
  • 原文地址:https://www.cnblogs.com/bennylam/p/9920870.html
Copyright © 2011-2022 走看看