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 ...
随机推荐
- 微软发布SQL Server on Linux
本文参考并翻译自:微软云计算与企业执行副总裁Scott Guthrie的博客. 过去的一年,不管是对于微软的数据业务,还是整个行业,都是令人惊喜的一年.在周四刚于纽约举行的Data Driven活动中 ...
- mysql 免安装版文件含义及作用
相信很多同学在首次安装mysql 免安装版时,对其中的文件不解,下面以 5.6.24为例讲解这里个文件代表什么: bin: 存放编译好的工具 data:存放数据库数据的位置(就是我们数据库存放的地方) ...
- C# Request获取URL常见用法
如果测试的url地址是http://www.test.com/testweb/default.aspx, 结果如下: Request.ApplicationPath: /testweb Request ...
- nodepad++通过正则表达式,删除带有特殊字符的某一行
我是VS项目不小心生成了x64平台的sln文件,想把sln文件中带有x64的给删除,一共搜索到500多行,怎么办呢,一个一个删除太费劲儿了. 通过nodepad++ 的正则表达式替换: 我是想删除带X ...
- 哈夫曼树算法及C++实现
一.相关概念 1.叶子结点的权值(weight)是对叶子结点赋予的一个有意义的数值量. 2.设二叉树有n个带权值的叶子结点,从根节点到各个叶子结点的路径长度与相应叶子结点权值的乘积之和叫做二叉树的带权 ...
- WSDM 2014推荐系统论文
Xiao Yu, Hao Ma, Paul Hsu, Jiawei Han On Building Entity Recommender Systems Using User Click Log an ...
- 记一次重装系统后恢复EFS加密文件过程
之前用了8年的win7系统被我删注册表给折腾挂了, 无法进入系统, 无法进入安全模式, 无法使用光盘修复 只能重装系统,习惯性的重装前GHOST备份了一下 今天忽然发现有好几个项目文件居然成了绿色的, ...
- java使用类序列化反序列化(读写文件)
创建类:Role package com.wbg.springRedis.entity; import java.io.Serializable; public class Role implemen ...
- idea中ssm自动配置
自动生成 只需要创建好maven项目,然后创建一个类Test,复制代码粘贴即可 使用注意: 代码 import java.io.*; public class Test { //包名格式 //列如配置 ...
- peripheralStateNotificationCB
/********************************************************************* * @fn peripheralStateNotifica ...