ConfigAppSettings.cs
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Threading;
using System.Xml;
using System.Windows.Forms;
using log4net;
namespace OnlineStore.Common
{
public class ConfigAppSettings
{
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1;
public static int nextSeq()
{
if (seq.Equals(Int32.MaxValue))
{
LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0;
}
Interlocked.Increment(ref seq);
return seq;
}
public static string GetValue(string key,string defaultVal="")
{
return ConfigHelper.Config.Get(key, defaultVal);
}
public static decimal GetNumValue(string key)
{
return ConfigHelper.Config.Get<decimal>(key);
}
public static int GetIntValue(string key,int val=0)
{
return ConfigHelper.Config.Get<int>(key,val);
}
public static void SaveValue(string key, int value)
{
SaveValue(key, value.ToString());
}
public static void SaveValue(string key, string value)
{
ConfigHelper.Config.Set(key, value);
}
}
}