using System;

    using Microsoft.Xrm.Sdk;

    using Microsoft.Xrm.Sdk.Query;

    using Microsoft.Crm.Sdk.Messages;

/// <summary>

    /// 销售订单

    /// </summary>

    public class SoleOrderHelper

    {

        public static readonly string entityName = "salesorder";

        public Guid soleorderId = 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 };

            soleorderId = 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 = soleorderId };

            request.Assignee = assignee;

            AssignResponse response = (AssignResponse)service.Execute(request);

        }

/// <summary>

        /// 取消销售订单

        /// </summary>

        /// <param name="status">取消的状态</param>

        public void CancelSalesOrder(int status)

        {

            CancelSalesOrderRequest request = new CancelSalesOrderRequest();

            request.OrderClose = new Entity() { LogicalName = entityName,Id = soleorderId };

            request.Status = new OptionSetValue(status);

            CancelSalesOrderResponse response = (CancelSalesOrderResponse)service.Execute(request);

        }

/// <summary>

        /// 将销售订单转换为发票

        /// </summary>

        public void ConvertSalesOrderToInvoice()

        {

            ConvertSalesOrderToInvoiceRequest request = new ConvertSalesOrderToInvoiceRequest();

            request.SalesOrderId = soleorderId;

            request.ColumnSet = new ColumnSet("name","accountid");

            ConvertSalesOrderToInvoiceResponse response = (ConvertSalesOrderToInvoiceResponse)service.Execute(request);

            Entity invoiceEn = response.Entity;

        }

/// <summary>

        /// 完毕销售订单

        /// </summary>

        /// <param name="status">完毕的状态</param>

        public void FulfillSalesOrder(int status)

        {

            FulfillSalesOrderRequest request = new FulfillSalesOrderRequest();

            request.OrderClose = new Entity() { LogicalName = entityName,Id = soleorderId };

            request.Status = new OptionSetValue(status);

            FulfillSalesOrderResponse response = (FulfillSalesOrderResponse)service.Execute(request);

        }

/// <summary>

        /// 从指定商机中检索销售订单的产品组

        /// </summary>

        /// <param name="opportunityId">商机id</param>

        public void GetSalesOrderProductsFromOpportunity(Guid opportunityId)

        {

            GetSalesOrderProductsFromOpportunityRequest request = new GetSalesOrderProductsFromOpportunityRequest();

            request.OpportunityId = opportunityId;

            request.SalesOrderId = soleorderId;

            GetSalesOrderProductsFromOpportunityResponse response =

                (GetSalesOrderProductsFromOpportunityResponse)service.Execute(request);

        }

/// <summary>

        /// 锁定销售订单定价

        /// </summary>

        public void LockSalesOrderPricing()

        {

            LockSalesOrderPricingRequest request = new LockSalesOrderPricingRequest();

            request.SalesOrderId = soleorderId;

            LockSalesOrderPricingResponse response = (LockSalesOrderPricingResponse)service.Execute(request); 


        }

/// <summary>

        /// 解锁指定的销售订单(订单)中产品的单位价格

        /// </summary>

        public void UnlockSalesOrderPricing()

        {

            UnlockSalesOrderPricingRequest request = new UnlockSalesOrderPricingRequest();

            request.SalesOrderId = soleorderId;

            UnlockSalesOrderPricingResponse response = (UnlockSalesOrderPricingResponse)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 = soleorderId };

            request.Revokee = revokee;

            RevokeAccessResponse response = (RevokeAccessResponse)service.Execute(request);

        }

/// <summary>

        /// 删除销售订单

        /// </summary>

        public void Delete()

        {

            service.Delete(entityName, soleorderId);

        }

    }

crm操作销售订单实体的更多相关文章

  1. crm操作知识库文章实体

    using System;     using Microsoft.Xrm.Sdk;     using Microsoft.Crm.Sdk.Messages;     using Microsoft ...

  2. crm操作报价单实体

    using System;     using Microsoft.Xrm.Sdk;     using Microsoft.Crm.Sdk.Messages;     using Microsoft ...

  3. Netsharp快速入门(之11) 销售管理(开发销售订单工作区)

    作者:秋时 杨昶   时间:2014-02-15  转载须说明出处 4.3     销售订单开发 4.3.1  部件工作区设置 1.创建部件工作区,建工作区向导中要注意勾选组合并系部分.具体要建立的部 ...

  4. Netsharp快速入门(之13) 销售管理(单据流转 销售订单生成发货单)

    作者:秋时 杨昶   转载须说明出处 4.5     单据流转 4.5.1  单据流转的目的 单据流转主要为了实现业务关系的流转,并记录相互之间的关系.例如从销售订单生成销货单,两张单据之间有对应的关 ...

  5. Odoo开源ERP:功能模块操作-销售功能篇

    客户基础资料 1. 所有的客户基础资料,智云ERP开账启用时,期初的客户数据如果大于200条,可以批量导入: 2. 点“销售/订单/客户”菜单可以查看.编辑修改.搜索所有的客户基础资料: 3. 多层级 ...

  6. [置顶]生鲜配送管理系统_升鲜宝V2.0 销售订单汇总_采购任务分配功能_操作说明

    做好生鲜供应链系统,要注意三个方面,1.分拣 2 采购  3 库存,市面上做的比较成熟的功能,还是分拣这一块(按客户分拣.按订单分拣.按商品分类分拣.按商品分拣.按线路分拣.客户自由组合分拣)[下篇文 ...

  7. 转载]SAP囚徒 - 通过销售订单领用到成本中心,FI替代

    转载]SAP囚徒 - 通过销售订单领用到成本中心,FI替代   原文地址:SAP囚徒 - 通过销售订单领用到成本中心,FI替代实现不同成本中心记账科目不同作者:SAP囚徒 物品领用通常是库存管理的范畴 ...

  8. AR_销售订单收款基本操作(流程)

    2014-06-04 Created By BaoXinjian

  9. 为什么S/4HANA的销售订单创建会触发生产订单的创建

    调用S/4HANA销售订单创建函数SD_SALES_DOCU_MAINTAIN创建一个销售订单时,会触发生产订单的创建. 销售订单的每个行项目对应一个独立的生产订单,SD_SALES_DOCU_MAI ...

随机推荐

  1. 将Linux下python默认版本切换成替代版本

    本文链接自http://www.myhack58.com/Article/48/66/2016/71806.htm 当你安装 Debian Linux 时,安装过程有可能同时为你提供多个可用的 Pyt ...

  2. 【BJOI2014/bzoj4530】大融合

    题意 有 $n$ 个点,初始没有连边,要求支持两个动态操作: 1. 加一条边(保证之前两点不连通) 2. 查询过一条边的简单路径数量(就是两边连通块的大小的乘积) $n,Q\le 100000$ 题解 ...

  3. vim的复制粘贴(包括系统剪贴板)

    1.vim常用复制粘贴命令 Vim的复制粘贴命令无疑是y (yank),p(paster),加上yy,P PS: vim有个很有意思的约定(我觉得是一种约定),就是某个命令的大小写都是实现某种功能,只 ...

  4. bzoj 4007 树形dp

    题目大意 脸哥最近来到了一个神奇的王国,王国里的公民每个公民有两个下属或者没有下属,这种关系刚好组成一个 n 层的完全二叉树.公民 i 的下属是 2 * i 和 2 * i +1.最下层的公民即叶子节 ...

  5. APUE 学习笔记(十一) 网络IPC:套接字

    1. 网络IPC 套接字接口既可以用于计算机之间进程通信,也可以用于计算机内部进程通信   套接字描述符在Unix系统中是用文件描述符实现的   /* 创建一个套接字 */ #include < ...

  6. C/C++ XMPP/Jabber 客户端类库对比/点评 (转)

    原文转自 http://blog.csdn.net/educast/article/details/31359835 1.gloox Ans. 老牌库,推荐 gloox是一个稳定功能完整的XMPP客户 ...

  7. os.system() 和 os.popen()

    1.os.popen(command[, mode[, bufsize]])  os.system(command) 2.os.popen() 功能强于os.system() , os.popen() ...

  8. HOJ - 2715最小费用流

    国庆八天乐,刷题也快乐. HOJ崩了,但是VJ可以把题目挂出来. 题目链接:https://vjudge.net/contest/188441#problem/A 涉及到矩阵里面的网络流,化为图来做. ...

  9. Latex algorithm

    方式一 需要包含的 \usepackage[noend]{algpseudocode} \usepackage{algorithmicx,algorithm} 源码 \begin{algorithm} ...

  10. (49)C# npoi-word

    //新建段落 XWPFParagraph p1 = doc.CreateParagraph(); //对齐方式 p1.SetAlignment(ParagraphAlignment.LEFT); p1 ...