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 ...
随机推荐
- iptables 安全
注解:来自某位大神的详解,做个笔记. iptables防火墙简介 Netfilter/Iptables(以下简称Iptables)是unix/linux自带的一款优秀且开放源代码的安全自由的**基于包 ...
- Tomcat你很少使用的安全管理SecurityManager
试想一下,如果你的JSP页面中包含一句代码“System.exit(1);”,你的web应用访问到该JSP时,会发生什么? 一般使用tomcat可能都没有注意到这个问题,本篇主要讲述tomcat 6中 ...
- Oracle案例05——ORA-12162: TNS:net service name is incorrectly specified
最近在梳理环境,发现环境真的不是一般的复杂,配置不是一般的乱,刚在梳理环境的时候发现一个库通过conn /as sysdba无法连接,具体处理过程如下: 一.错误信息 [oracle@ ~]$ sql ...
- Wpf 系列
http://www.cnblogs.com/chillsrc/category/684419.html
- centos7下搭建sphinx全文检索引擎
Sphinx是一个基于SQL的全文检索引擎,可以结合MySQL,PostgreSQL做全文搜索,它可以提供比数据库本身更专业的搜索功能,使得应用 程序更容易实现专业化的全文检索.Sphinx特别为一些 ...
- selenium 截图加上时间戳
思路: 1 新建screenshot文件夹,不存在则创建该目录 2 在screenshot文件夹下新建当日日期文件夹,比如20190110:不存在则创建该目录 3 截图保存到当日文件夹,且截图文 ...
- Visual Studio中头文件stdafx.h的作用
在较新版的Visual Studio中,新生成的C++项目文件的的头文件夹下会默认有头文件stdafx.h,而源文件夹下则默认有源文件stdafx.cpp,手动将这些文件删除后,编译时系统还会报错.下 ...
- 如何删除Word 2010中的“向下箭头”
原文:https://jingyan.baidu.com/article/e75aca85552916142edac614.html 在日常办公中,如果从网站复制了一段文字,直接粘贴到Word中时,常 ...
- 我上线的android版app
把自己开发的几个小的app上线了,在自己的博客中推广一下吧: 聊天兔子: 下载地址:http://android.myapp.com/myapp/detail.htm?apkName=com.fuly ...
- 【转】python通过文件头判断文件类型
刚刚看到一个好玩的程序,拉过来.原文地址:https://www.ttlsa.com/python/determine-file-type-by-the-file-header/ 侵权删. ===== ...