Currency Helper
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages; /// <summary>
/// 货币
/// </summary>
public class TransactionCurrencyHelper
{
public static readonly string entityName = "transactioncurrency";
public Guid transactionCurrencyId = Guid.Empty; /// <summary>
/// 创建货币
/// </summary>
/// <param name="service">服务</param>
public void Create(IOrganizationService service)
{
Entity en = new Entity() { LogicalName = entityName };
//货币代码
en["isocurrencycode"] = "CNY";
//货币名称
en["currencyname"] = "人民币";
//货币精度
en["currencyprecision"] = ;
//货币符合
en["currencysymbol"] = "¥";
//换算比率
en["exchangerate"] = 1.0; transactionCurrencyId = service.Create(en);
} /// <summary>
/// 修改货币
/// </summary>
/// <param name="service">服务</param>
public void Update(IOrganizationService service)
{
Entity en = new Entity() { LogicalName = entityName, Id = transactionCurrencyId };
//货币名称
en["currencyname"] = "人民币-2000"; service.Update(en);
} /// <summary>
/// 检索汇率
/// </summary>
/// <param name="service">服务</param>
public decimal SearchRateById(IOrganizationService service)
{
decimal value = ;
RetrieveExchangeRateRequest request = new RetrieveExchangeRateRequest();
request.TransactionCurrencyId = transactionCurrencyId;
RetrieveExchangeRateResponse response = (RetrieveExchangeRateResponse)service.Execute(request);
value = response.ExchangeRate;
return value;
} /// <summary>
/// 停用和启用货币
/// </summary>
public void UpdateTransactionCurrencyState(IOrganizationService service)
{
//停用货币
UpdateState(entityName, transactionCurrencyId, , , service);
//启用货币
UpdateState(entityName, transactionCurrencyId, , , service);
} private void UpdateState(string enName, Guid id, int state, int status, IOrganizationService service)
{
SetStateRequest setState = new SetStateRequest()
{
EntityMoniker = new EntityReference()
{
Id = id,
LogicalName = enName
},
State = new OptionSetValue(state),
Status = new OptionSetValue(status)
};
service.Execute(setState);
} /// <summary> ///
/// 删除货币 ///
/// </summary> ///
/// <param name="service">服务</param>
public void Delete(IOrganizationService service) { service.Delete(entityName, transactionCurrencyId); }
}
Currency Helper的更多相关文章
- [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 ...
- JavaScript模板引擎artTemplate.js——template.helper()方法
上一篇文章我们已经讲到了helper()方法,但是上面的例子只是一个参数的写法,如果是多个参数,写法就另有区别了. <div id="user_info"></d ...
- POJ1860 Currency Exchange(bellman-ford)
链接:http://poj.org/problem?id=1860 Currency Exchange Description Several currency exchange points are ...
- [ASP.NET MVC 小牛之路]13 - Helper Method
我们平时编程写一些辅助类的时候习惯用“XxxHelper”来命名.同样,在 MVC 中用于生成 Html 元素的辅助类是 System.Web.Mvc 命名空间下的 HtmlHelper,习惯上我们把 ...
- asp.net MVC helper 和自定义函数@functions小结
asp.net Razor 视图具有.cshtml后缀,可以轻松的实现c#代码和html标签的切换,大大提升了我们的开发效率.但是Razor语法还是有一些棉花糖值得我们了解一下,可以更加强劲的提升我们 ...
- C# random helper class
项目中经常需要模拟些假数据,来做测试.这个随机生成数据的helper类就应用而生: using System; using System.Text; using System.Windows.Me ...
随机推荐
- c# 修改winform中app.config的配置值
public bool ChangeConfig(string AppKey,string AppValue) { bool result = true; try { XmlDocument xDoc ...
- SQL SERVER ->> IDENTITY相关函数
IDENTITY函数 -- 只能用在SELECT INTO语句中,用于在插入数据的时候模拟IDENTITY属性的作用生成自增长值. ,) AS ID_Num INTO NewTable FROM Ol ...
- SQL Server ->> PERCENTILE_CONT、PERCENTILE_DISC 和 PERCENT_RANK 函数
PERCENTILE_CONT和PERCENTILE_DISC都是为了计算百分位的数值,比如计算在某个百分位时某个栏位的数值是多少.他们的区别就是前者是连续型,后者是离散型.CONT代表continu ...
- 404错误 标签: servlet浏览器 2016-11-16 16:58 61人阅读 评论(0) 收藏
404是资源没有找到,一般由于以下几个方面导致: 1.路径出错: a)检查web.xml中servlet的配置是否出错 b)浏览器访问是路径书写方式:http://localhost:8080/项目名 ...
- python 枚举类
枚举类 Enum类 from enum import Enum Month = Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Ju ...
- Java文件操作工具类
import com.foriseland.fjf.lang.DateUtil;import org.apache.commons.io.FileUtils;import org.slf4j.Logg ...
- 通过CXF,开发soap协议接口
1. 引入cxf的jar包 pom文件里面直接增加依赖 < dependency> <groupId > junit</ groupId> <artifact ...
- ZT sigprocmask,sigpending函数
sigprocmask,sigpending函数 分类: LINUX 2012-02-02 16:39 905人阅读 评论(0) 收藏 举报 signalredhatnulllinux [sigpro ...
- plus.webview.create mui.openWindow区别是什么呢
create 只是创建这个webview,但是不显示,而且同一个页面.同一个id你甚至能重复创建多个(严重消耗性能,作死...),其实mui里面已经封装了这个方法 mui.preload(),并且 ...
- Linux汉化(Cent Os汉化)
在腾讯云上购买了Cent Os7.1的云服务器,是英文版啊,有没有?对于我这种英文的渣渣啊,所以我要用中文版,我就是这么low,怎么着呢? Ok ,在汉化之前,先查看系统的语言环境, echo $LA ...