zoukankan
html css js c++ java
取得程序设定的常用代码.
using
System;
using
System.Configuration;
namespace
HXBTools.Util
{
/**/
///
<summary>
///
Class1 的摘要说明。
///
</summary>
public
class
Config
{
public
Config()
{
//
//
TODO: 在此处添加构造函数逻辑
//
}
public
static
string
GetSettingString(
string
sKeyName,
string
sDefault)
{
string
s
=
ConfigurationSettings.AppSettings[sKeyName];
if
(s
==
null
)
{
return
sDefault;
}
else
{
return
s;
}
}
public
static
int
GetSettingInt(
string
sKeyName,
int
iDefault)
{
string
s
=
Config.GetSettingString(sKeyName,
null
);
if
(s
==
null
)
return
iDefault;
int
i;
try
{
i
=
int
.Parse(s);
return
i;
}
catch
{
return
iDefault;
}
}
public
static
long
GetSettingLong(
string
sKeyName,
long
lDefault)
{
string
s
=
Config.GetSettingString(sKeyName,
null
);
if
(s
==
null
)
return
lDefault;
long
l;
try
{
l
=
long
.Parse(s);
return
l;
}
catch
{
return
lDefault;
}
}
public
static
decimal
GetSettingDecimal(
string
sKeyName,
decimal
dcDefault)
{
string
s
=
Config.GetSettingString(sKeyName,
null
);
if
(s
==
null
)
return
dcDefault;
decimal
dc;
try
{
dc
=
decimal
.Parse(s);
return
dc;
}
catch
{
return
dcDefault;
}
}
public
static
DateTime GetSettingDateTime(
string
sKeyName, DateTime dtDefaule)
{
string
s
=
Config.GetSettingString(sKeyName,
null
);
if
(s
==
null
)
return
dtDefaule;
DateTime dt;
try
{
dt
=
DateTime.Parse(s);
return
dt;
}
catch
{
return
dtDefaule;
}
}
public
static
bool
GetSettingBool(
string
sKeyName,
bool
bDefault)
{
string
s
=
Config.GetSettingString(sKeyName,
null
);
if
(s
==
null
)
return
bDefault;
switch
(s.Trim().ToLower())
{
case
"
true
"
:
case
"
真
"
:
case
"
是
"
:
case
"
1
"
:
case
"
yes
"
:
case
"
ok
"
:
case
"
-1
"
:
return
true
;
case
"
false
"
:
case
"
0
"
:
case
"
假
"
:
case
"
否
"
:
case
"
不
"
:
case
"
非
"
:
case
"
no
"
:
case
"
not
"
:
case
"
never
"
:
return
false
;
default
:
return
bDefault;
}
}
}
}
查看全文
相关阅读:
几个用于序列化的代码片段
一个统计查询写的哥要哭了
pb数据窗口数据输入的下拉选择效果
PB代码块
获取指定表的字段信息sql2005
TSQL时间格式化显示
Atitit 为什么互联网金融会得到高层的支持 面子工程战略 政绩战略 大事业战略 高层需要在意识形态创新全球,政绩工程 得到合法性。 银行有很多家,而且别的区域也有。。不独特。。但是支付
Atitit 软件与互联网理论 attilax总结
Atitit 软件与开发的未来趋势 attilax总结 1.1. Sdx软件重构世界 软件定义未来 1 1.2. 《软件和信息技术服务业发展规划(20162020年)》( 2 1.3. Iot物联
Atitit it业界与软件界的定律 原则 准则 法则 效应
原文地址:https://www.cnblogs.com/haoxiaobo/p/89932.html
最新文章
js树通用代码
linux下和apache有关的操作命令:配置编译安装及其它
PHP网络函数库
FAQ for Apache
服务器尺寸1U有多大
用PHP来执行系统命令
什么是DQL、DML、DDL、DCL
服务器资源
linux下的apache配置文件详解
linux下apache各种跳转(包括伪静态)的配置
热门文章
服务端端口状态和客户端端口状态解释LISTENINGESTABLISHEDTIME_WAIT
动态查询与查询分析器的查找替换
游标,存储过程,以及临时表
Quartz.Net 2.0 bate1 使用
PB动态游标代码段
PB关于datastore Datashare 给dw
关于Persist Security Info=True,又遇sa登陆失败的错误
WCF,心跳检测
SQL自动事务、隐藏事务、显式事务,以及.net中的关于事务
又一个查询,哥整了一天,NND有点受不鸟了
Copyright © 2011-2022 走看看