AppGlobal.cs
4.1 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//----------------------------------------------------------------
//
// 概述: 本文件作用是提供在整个应用程序域中提供全局变量
// 修改:替换过时方法ConfigurationSettings.GetConfig(CurrentLoginName)
// 为 (IDictionary)ConfigurationManager.GetSection(CurrentLoginName) by 倪豪 2007-08-27
// ----------------------------------------------------------------
using System;
using System.Configuration;
using System.Collections;
namespace App
{
/// <summary>
/// AppGlobal 的摘要说明。
/// </summary>
public class AppGlobal
{
public static System.Collections.Hashtable UserConfig = new Hashtable();
//添加用户属性名
//每个属性的名字必须添加在此,可以避免属性名字重复
//例:public const 属性名="属性名";
public const string DateTime = "DateTime";//时间:在每次登录时会被更新本地Config文件的时间属性
public const string Project = "Project";//项目:记录登录选择的项目
public const string Language = "Language";//语言:登陆语言
public const string BaseLine = "BaseLine";//基线
public AppGlobal()
{
}
//public bool SetUserAttribute(string AttributeName, object AttributeValue)
//{
// GlobalConfig globalconfig = new GlobalConfig();
// string CurrentLoginName = Fuction.m_UserLogin;
// string NewValue = AttributeValue.ToString();
// if (globalconfig.ModifyUseConfig(CurrentLoginName, AttributeName, NewValue))
// {
// if (AppGlobal.UserConfig == null)
// {
// AppGlobal.UserConfig.Add(AttributeName, NewValue);
// }
// else
// {
// foreach (string f_useKey in AppGlobal.UserConfig.Keys)
// {
// if (f_useKey == AttributeName)
// {
// AppGlobal.UserConfig.Remove(f_useKey);
// AppGlobal.UserConfig.Add(AttributeName, NewValue);
// return true;
// }
// }
// AppGlobal.UserConfig.Add(AttributeName, NewValue);
// }
// return true;
// }
// else
// {
// return false;
// }
//}
///// <summary>
///// 获取用户属性
///// </summary>
///// <param name="AttributeName"></param>
///// <returns></returns>
//public string GetUserAttribute(string AttributeName)
//{
// if (AppGlobal.UserConfig != null)
// {
// foreach (string f_useKey in AppGlobal.UserConfig.Keys)
// {
// if (f_useKey == AttributeName)
// {
// return AppGlobal.UserConfig[f_useKey].ToString();
// }
// }
// }
// string CurrentLoginName = Fuction.m_UserLogin;
// try
// {
// //IDictionary UseConfigTable = (IDictionary)ConfigurationSettings.GetConfig(CurrentLoginName);
// IDictionary UseConfigTable = (IDictionary)ConfigurationManager.GetSection(CurrentLoginName);
// string UseConfigAttribute = "";
// if (UseConfigTable[AttributeName] != null)
// {
// UseConfigAttribute = (string)UseConfigTable[AttributeName];
// }
// return UseConfigAttribute;
// }
// catch
// {
// return "";
// }
//}
///// <summary>
///// 设置当前用户
///// </summary>
///// <param name="UserName">用户名</param>
///// <returns>是否成功</returns>
//public bool SetUser(string UserName)
//{
// GlobalConfig globalconfig = new GlobalConfig();
// if (globalconfig.CreateUseConfig(UserName))
// {
// return true;
// }
// else
// {
// return false;
// }
//}
}
}