crm操作销售订单实体
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操作销售订单实体的更多相关文章
- crm操作知识库文章实体
using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft ...
- crm操作报价单实体
using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft ...
- Netsharp快速入门(之11) 销售管理(开发销售订单工作区)
作者:秋时 杨昶 时间:2014-02-15 转载须说明出处 4.3 销售订单开发 4.3.1 部件工作区设置 1.创建部件工作区,建工作区向导中要注意勾选组合并系部分.具体要建立的部 ...
- Netsharp快速入门(之13) 销售管理(单据流转 销售订单生成发货单)
作者:秋时 杨昶 转载须说明出处 4.5 单据流转 4.5.1 单据流转的目的 单据流转主要为了实现业务关系的流转,并记录相互之间的关系.例如从销售订单生成销货单,两张单据之间有对应的关 ...
- Odoo开源ERP:功能模块操作-销售功能篇
客户基础资料 1. 所有的客户基础资料,智云ERP开账启用时,期初的客户数据如果大于200条,可以批量导入: 2. 点“销售/订单/客户”菜单可以查看.编辑修改.搜索所有的客户基础资料: 3. 多层级 ...
- [置顶]生鲜配送管理系统_升鲜宝V2.0 销售订单汇总_采购任务分配功能_操作说明
做好生鲜供应链系统,要注意三个方面,1.分拣 2 采购 3 库存,市面上做的比较成熟的功能,还是分拣这一块(按客户分拣.按订单分拣.按商品分类分拣.按商品分拣.按线路分拣.客户自由组合分拣)[下篇文 ...
- 转载]SAP囚徒 - 通过销售订单领用到成本中心,FI替代
转载]SAP囚徒 - 通过销售订单领用到成本中心,FI替代 原文地址:SAP囚徒 - 通过销售订单领用到成本中心,FI替代实现不同成本中心记账科目不同作者:SAP囚徒 物品领用通常是库存管理的范畴 ...
- AR_销售订单收款基本操作(流程)
2014-06-04 Created By BaoXinjian
- 为什么S/4HANA的销售订单创建会触发生产订单的创建
调用S/4HANA销售订单创建函数SD_SALES_DOCU_MAINTAIN创建一个销售订单时,会触发生产订单的创建. 销售订单的每个行项目对应一个独立的生产订单,SD_SALES_DOCU_MAI ...
随机推荐
- 【CF1027A】Palindromic Twist(模拟)
题意:输入T组字符串,每个字符串都必须改变一次,每个字母改变的规则是变成相邻的字母,字母a只能变b,z只能变y,判断改变后的字符依旧是否能够变成回文串 n<=1e2 思路: #include&l ...
- 【NOIP2015】信息传递(强连通分量)
题意:找一张图中的最小环 O(n) 思路:强连通分量tarjan即可 注意环中节点数>1 ..]of longint; n,i,ans,tot,id,top,time,x:longint; pr ...
- [LeetCode] Minimum Window Substring 散列映射问题
题目: Given a string S and a string T, find the minimum window in S which will contain all the charact ...
- 打印倒序NxN乘法表
一.实验要求: 给定任意一个字符N(N>0),然后打印NxN的倒序乘法表. 二.解决问题: #/!bin/bash# #define functionNxN_fun(){ local i=$1 ...
- php自动获取字符串编码函数mb_detect_encoding
当在php中使用mb_detect_encoding函数进行编码识别时,很多人都碰到过识别编码有误的问题,例如对与GB2312和UTF- 8,或者UTF-8和GBK(这里主要是对于cp936的判断), ...
- 最小生成树-prim算法模板
题目描述 如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出orz 输入输出格式 输入格式: 第一行包含两个整数N.M,表示该图共有N个结点和M条无向边.(N<=5000,M<= ...
- How to Mount a USB Drive in Ubuntu
Read more : http://www.ehow.com/how_6762235_mount-usb-drive-ubuntu.html Most USB drives will automou ...
- [BZOJ5286][洛谷P4425][HNOI2018]转盘(线段树)
5286: [Hnoi2018]转盘 Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 15 Solved: 11[Submit][Status][Di ...
- 359. Logger Rate Limiter
/* * 359. Logger Rate Limiter * 2016-7-14 by Mingyang * 很简单的HashMap,不详谈 */ class Logger { HashMap< ...
- Eclipse工程中Java Build Path中的JDK版本和Java Compiler Compiler compliance level的区别(转)
在这里记录一下在eclipse中比较容易搞混淆和设置错误的地方.如下图所示的功能: 最精准的解释如下: Build Path是运行时环境 Compiler是编译时环境 假设,你的代码用到泛型,Bu ...