自定义编码解析函数示例

ContractedBlock.gif ExpandedBlockStart.gif 酒店编码解析 #region 酒店编码解析
ExpandedSubBlockStart.gifContractedSubBlock.gif
/**//// <summary>
InBlock.gif       
/// 酒店编码解析.休闲设施
InBlock.gif       
/// </summary>
InBlock.gif       
/// <param name="oType">fallow,service,meal,creditCard,auditmeans,calculateMethod,hotelCategory,netservice,roomservice</param>
InBlock.gif       
/// <param name="oType">休闲设施,服务设施,餐厅设施,信用卡,审计方式,房态计算方式,酒店分类,上网设施,客房设施</param>
ExpandedSubBlockEnd.gif       
/// <returns>游泳池,健身房,桑拿,SPA</returns>

InBlock.gif        public static string TranHotel(string oSource,string oType)
ExpandedSubBlockStart.gifContractedSubBlock.gif       
...{
InBlock.gif            Hashtable ht
=HotelUtil.GetHotelDect(oType.ToLower());
InBlock.gif           
if(ht.Count<=0) return oSource;
InBlock.gif
InBlock.gif           
//返回结果
InBlock.gif
            string oResult="";
InBlock.gif
InBlock.gif           
//遍历字典拼成返回结果
InBlock.gif
            foreach(DictionaryEntry de in ht)
ExpandedSubBlockStart.gifContractedSubBlock.gif           
...{
InBlock.gif               
//de.Key.ToString();de.Value.ToString();
InBlock.gif
                if(oSource.ToLower().IndexOf(de.Key.ToString().ToLower())>=0)//全部在小写状态写比较
ExpandedSubBlockStart.gifContractedSubBlock.gif
                ...{
InBlock.gif                    oResult
+=de.Value.ToString()+";";
InBlock.gif                    oSource
=oSource.Replace(de.Key.ToString(),"");
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif           
return Etmc.Commons.CommonFun.CommUtil.TrimSeparator(oResult+oSource,";");
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedBlockEnd.gif       
#endregion

None.gif        
   返回酒店设施对照字典,#region 返回酒店设施对照字典,
InBlock.gif       
//返回酒店设施对照字典,
ExpandedSubBlockStart.gifContractedSubBlock.gif
        /**//// <summary>
InBlock.gif       
/// 返回酒店设施对照字典
InBlock.gif       
/// </summary>
InBlock.gif       
/// <param name="oType">fallow,service,meal,creditCard,auditmeans,calculateMethod,hotelCategory</param>
InBlock.gif       
/// <param name="oType">休闲设施,服务设施,餐厅设施,信用卡,审计方式,房态计算方式,酒店分类</param>
ExpandedSubBlockEnd.gif       
/// <returns>Hashtable</returns>

InBlock.gif        public static Hashtable GetHotelDect(string oType)
ExpandedSubBlockStart.gifContractedSubBlock.gif       
...{
ContractedSubBlock.gifExpandedSubBlockStart.gif           
构造字典#region 构造字典
InBlock.gif            Hashtable ht
=new Hashtable ();
InBlock.gif           
switch(oType.ToLower())
ExpandedSubBlockStart.gifContractedSubBlock.gif           
...{
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
休闲设施#region 休闲设施
InBlock.gif               
case "fallow":
InBlock.gif                    ht.Add(
"AA","游泳池");
InBlock.gif                    ht.Add(
"AB","健身房");
InBlock.gif                    ht.Add(
"AC","桑拿");
InBlock.gif                    ht.Add(
"AD","SPA");
InBlock.gif                    ht.Add(
"AE","温泉");
InBlock.gif                    ht.Add(
"AF","网球场");
InBlock.gif                    ht.Add(
"AG","舞蹈班");
InBlock.gif                    ht.Add(
"AH","棋牌室");
InBlock.gif                    ht.Add(
"AL","卡拉OK;");
InBlock.gif                    ht.Add(
"AJ","夜总会");
InBlock.gif                    ht.Add(
"AK","儿童娱乐设施");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
服务设施#region 服务设施
InBlock.gif               
case "service"://服务设施
InBlock.gif
                    ht.Add("AA","机场免费接送");
InBlock.gif                    ht.Add(
"AB","商务中心");
InBlock.gif                    ht.Add(
"AC","洗衣服务");
InBlock.gif                    ht.Add(
"AD","礼宾服务");
InBlock.gif                    ht.Add(
"AE","客房送餐服务");
InBlock.gif                    ht.Add(
"AF","叫醒服务");
InBlock.gif                    ht.Add(
"AG","货币兑换");
InBlock.gif                    ht.Add(
"AH","商场");
InBlock.gif                    ht.Add(
"AJ","停车场");
InBlock.gif                    ht.Add(
"AM","票务");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
餐厅设施#region 餐厅设施
InBlock.gif               
case "meal"://餐厅设施
InBlock.gif
                    ht.Add("AA","中餐厅");
InBlock.gif                    ht.Add(
"AB","西餐厅");
InBlock.gif                    ht.Add(
"AC","咖啡厅");
InBlock.gif                    ht.Add(
"AD","酒吧");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
信用卡#region 信用卡
InBlock.gif               
case "creditcard"://信用卡
InBlock.gif
                    ht.Add("AA","VISA");
InBlock.gif                    ht.Add(
"AB","JCB");
InBlock.gif                    ht.Add(
"AC","American Express");
InBlock.gif                    ht.Add(
"AD","Diner's Club");
InBlock.gif                    ht.Add(
"AE","Master Card");
InBlock.gif                    ht.Add(
"AF","银联卡");
InBlock.gif                    ht.Add(
"AG","不可使用");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
审计方式#region 审计方式
InBlock.gif               
case "auditmeans":
InBlock.gif                    ht.Add(
"0","电话");
InBlock.gif                    ht.Add(
"1","传真");
InBlock.gif                    ht.Add(
"2","email");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
房态计算方式#region 房态计算方式
InBlock.gif               
case "calculatemethod":
InBlock.gif                    ht.Add(
"0","在店");
InBlock.gif                    ht.Add(
"1","当日到店");
InBlock.gif                   
break;
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
酒店分类#region 酒店分类
InBlock.gif               
case "hotelcategory":
InBlock.gif                    ht.Add(
"1","经济连锁型");
InBlock.gif                    ht.Add(
"2","酒店公寓型");
InBlock.gif                    ht.Add(
"3","舒适商务型");
InBlock.gif                    ht.Add(
"4","豪华商务型");
InBlock.gif                    ht.Add(
"5","普通旅游型");
InBlock.gif                    ht.Add(
"6","豪华旅游型");
InBlock.gif                    ht.Add(
"7","乡村度假型");
InBlock.gif                    ht.Add(
"8","会议娱乐型");
InBlock.gif                    ht.Add(
"9","特色型");
InBlock.gif                   
break;
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
客房设施#region 客房设施
InBlock.gif               
case "roomservice":
InBlock.gif                    ht.Add(
"AAA","电视机");
InBlock.gif                    ht.Add(
"AAB","卫星电视");
InBlock.gif                    ht.Add(
"AAC","有线电视");
InBlock.gif                    ht.Add(
"AAD","收费频道");
InBlock.gif                    ht.Add(
"AAE","电话机");
InBlock.gif                    ht.Add(
"AAF","电脑");
InBlock.gif                    ht.Add(
"AAJ","传真机");
InBlock.gif                    ht.Add(
"AAK","迷你吧");
InBlock.gif                    ht.Add(
"AAL","免费饮料");
InBlock.gif                    ht.Add(
"AAM","冰箱");
InBlock.gif                    ht.Add(
"AAN","洗衣机");
InBlock.gif                    ht.Add(
"AAO","微波炉");
InBlock.gif                    ht.Add(
"AAP","小厨房");
InBlock.gif                    ht.Add(
"AAQ","电熨斗");
InBlock.gif                    ht.Add(
"AAR","熨衣板");
InBlock.gif                    ht.Add(
"AAS","独立空调");
InBlock.gif                    ht.Add(
"AAT","中央空调");
InBlock.gif                    ht.Add(
"AAU","电热水壶");
InBlock.gif                    ht.Add(
"AAV","电吹风");
InBlock.gif                    ht.Add(
"AAW","雨伞");
InBlock.gif                    ht.Add(
"AAX","保险箱");
InBlock.gif                    ht.Add(
"AAY","淋浴");
InBlock.gif                    ht.Add(
"ABP","浴缸");
InBlock.gif                    ht.Add(
"AAZ","浴袍");
InBlock.gif                    ht.Add(
"ABA","拖鞋");
InBlock.gif                    ht.Add(
"ABB","毛巾");
InBlock.gif                    ht.Add(
"ABC","牙膏");
InBlock.gif                    ht.Add(
"ABD","牙刷");
InBlock.gif                    ht.Add(
"ABE","香皂");
InBlock.gif                    ht.Add(
"ABF","洗发水");
InBlock.gif                    ht.Add(
"ABG","护发素");
InBlock.gif                    ht.Add(
"ABH","淋浴露");
InBlock.gif                    ht.Add(
"ABI","润肤露");
InBlock.gif                    ht.Add(
"ABJ","绵签");
InBlock.gif                    ht.Add(
"ABK","指甲挫");
InBlock.gif                    ht.Add(
"ABL","浴帽");
InBlock.gif                    ht.Add(
"ABM","剃须刀");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif                   
上网设施#region 上网设施
InBlock.gif               
case "netservice":
InBlock.gif                    ht.Add(
"AAG","拨号上网");
InBlock.gif                    ht.Add(
"AAH","宽带上网");
InBlock.gif                    ht.Add(
"AAI","无线上网");
InBlock.gif                    ht.Add(
"ABN","上网收费");
InBlock.gif                    ht.Add(
"ABO","上网免费");
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif                   
#endregion

ExpandedSubBlockEnd.gif                   
#endregion

ExpandedSubBlockEnd.gif                   
#endregion

InBlock.gif
InBlock.gif               
default:
InBlock.gif                   
break;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif           
#endregion

InBlock.gif           
return ht;
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif       
#endregion

转载于:https://www.cnblogs.com/pbwf/archive/2007/05/26/761120.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值