Product Helper
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages; /// <summary>
/// 产品
/// </summary>
public class ProductHelper
{
public static readonly string entityName = "product";
public Guid productId = Guid.Empty;
public IOrganizationService service; /// <summary>
/// 创建产品
/// </summary>
public void Create()
{
Entity en = new Entity() { LogicalName = entityName };
en["name"] = "产品测试";
productId = service.Create(en);
} /// <summary>
/// 向配套件中添加产品。配套件是包含一个或多个产品的产品目录项
/// </summary>
/// <param name="kitId">配套件id</param>
public void AddProductToKit(Guid kitId)
{
AddProductToKitRequest request = new AddProductToKitRequest();
request.KitId = kitId;
request.ProductId = productId;
AddProductToKitResponse response = (AddProductToKitResponse)service.Execute(request);
} /// <summary>
/// 将配套件转换为产品
/// </summary>
/// <param name="kitId">配套件id</param>
public void ConvertKitToProduct(Guid kitId)
{
ConvertKitToProductRequest request = new ConvertKitToProductRequest();
request.KitId = kitId;
ConvertKitToProductResponse response = (ConvertKitToProductResponse)service.Execute(request);
} /// <summary>
/// 将产品转换为配套件
/// </summary>
public void ConvertProductToKit()
{
ConvertProductToKitRequest request = new ConvertProductToKitRequest();
request.ProductId = productId;
ConvertProductToKitResponse response = (ConvertProductToKitResponse)service.Execute(request);
} /// <summary>
/// 从配套件中删除产品
/// </summary>
/// <param name="kitId">配套件id</param>
public void RemoveProductFromKit(Guid kitId)
{
RemoveProductFromKitRequest request = new RemoveProductFromKitRequest();
request.KitId = kitId;
request.ProductId = productId;
RemoveProductFromKitResponse response = (RemoveProductFromKitResponse)service.Execute(request);
} /// <summary> ///
/// 删除产品 ///
/// </summary>
public void Delete() { service.Delete(entityName, productId); }
}
Product Helper的更多相关文章
- 实现Magento多文件上传代码功能开发
在Magento中上传单个文件很简单,可以直接在继承的Mage_Adminhtml_Block_Widget_Form类中直接添加如下组件Field: 对于图片: $fieldset->a ...
- 12月16日 增加一个购物车内product数量的功能, 自定义method,在helper中定义,计算代码Refactor到Model中。
仿照Rails实战:购物网站 教材:5-6 step5:计算总价,做出在nav上显示购物车内product的数量. 遇到的❌: 1. <% sum = 0 %> <% current ...
- ASP.NET MVC 3 and the @helper syntax within Razor
Friday, May 13, 2011 ASP.NET MVC 3 supports a new view-engine option called “Razor” (in addition to ...
- [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 ...
- uva 11059 maximum product(水题)——yhx
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB1QAAAMcCAIAAABo0QCJAAAgAElEQVR4nOydW7msuhKF2wIasIAHJK
- [LeetCode] Product of Array Except Self 除本身之外的数组之积
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equ ...
随机推荐
- bitekind
xrp这个人到SNT家坐在IOST的椅子上,喝着THETA. 武之巅峰,是孤独,是寂寞,是漫漫求索,是高处不胜寒 逆境中成长,绝地里求生,不屈不饶,才能堪破武之极道. 凌霄阁试炼弟子兼扫地 ...
- Oracle案例05——ORA-12162: TNS:net service name is incorrectly specified
最近在梳理环境,发现环境真的不是一般的复杂,配置不是一般的乱,刚在梳理环境的时候发现一个库通过conn /as sysdba无法连接,具体处理过程如下: 一.错误信息 [oracle@ ~]$ sql ...
- 【Leetcode】【Medium】Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...
- February 8 2017 Week 6 Wednesday
Goals determine what you are going to be. 目标决定你将成为什么样的人. Owning some goals in life means you will ha ...
- AngularJs学习笔记--Understanding Angular Templates
原版地址:http://docs.angularjs.org/guide/dev_guide.mvc.understanding_model angular template是一个声明规范,与mode ...
- gulp使用方法总结
gulp是用于前端构建的基于文件流的一套工具.可以用于压缩.编译.合并.检查文件等操作.可以节省大量的用于繁琐重复操作的人力.最开始就是安装gulp工具了,在命令行中切换到工作的文件目录下,安装gul ...
- POJ-2429 GCD & LCM Inverse---给出gcd和lcm求原来两个数
题目链接: https://cn.vjudge.net/problem/POJ-2429 题目大意: 给出两个数的gcd和lcm,求原来的这两个数(限定两数之和最小). 解题思路: 首先,知道gcd和 ...
- 代码阅读:AFNetworking背后的思想
1.一切皆文件:流与操作封装. 2.通信会话:
- NGSQC toolkit
一.NGSQCTooklit 使用 主要是去除dapter和低质量的碱基,并有统计结果 可以得到如下的结果 1,每个位置的碱基的平均质量 2,每个GC值对应的reads数 3,每个质量值对应的read ...
- Kali Linux重设root密码
许久不用的Kali,某天打开竟忘了密码! 网上的方法颇为简单,遂准备亲自试一下. #光标移动到第二行的“恢复模式”,按E进入[编辑模式] ...