其实GPM不仅仅是权限管理系统,其实更是一个灵活的轻量级快速.Net开发架构,他需要最短的学习时间,可以最快速入门,并不是通过玩技术来实现我们的日常需求。GPM中只要写一套代码,就可以实现在多种数据库上的稳定运行。
1
//
-----------------------------------------------------------------
2
//
All Rights Reserved , Copyright (C) 2012 , Hairihan TECH, Ltd.
3
//
-----------------------------------------------------------------
4
5
using System;
6
using System.Data;
7
using System.Windows.Forms;
8
9
namespace DotNet.WinForm
10 {
11
using DotNet.Utilities;
12
using DotNet.Business;
13
14
///
<summary>
15
///
FrmSystemSecurity
16
///
用户登录系统
17
///
18
///
修改纪录
19
///
20
///
2012.02.12 版本:1.1 JiRiGaLa 功能实现。
21
///
2012.01.19 版本:1.0 JiRiGaLa 整理文件。
22
///
23
///
版本:1.0
24
///
25
///
<author>
26
///
<name>
JiRiGaLa
</name>
27
///
<date>
2012.02.12
</date>
28
///
</author>
29
///
</summary>
30
public
partial
class FrmSystemSecurity : BaseForm
31 {
32
public FrmSystemSecurity()
33 {
34 InitializeComponent();
35 }
36
37
///
<summary>
38
///
从数据库读取当前配置情况
39
///
</summary>
40
private
void GetParameter()
41 {
42
string parameter =
string.Empty;
43 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
ServerEncryptPassword
");
44
if (!
string.IsNullOrEmpty(parameter))
45 {
46
this.chkServerEncryptPassword.Checked = parameter.Equals(
true.ToString());
47 }
48 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordMiniLength
");
49
if (!
string.IsNullOrEmpty(parameter))
50 {
51
this.nudPasswordMiniLength.Value =
int.Parse(parameter);
52 }
53 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
NumericCharacters
");
54
if (!
string.IsNullOrEmpty(parameter))
55 {
56
this.chkNumericCharacters.Checked = parameter.Equals(
true.ToString());
57 }
58 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordCycle
");
59
if (!
string.IsNullOrEmpty(parameter))
60 {
61
this.nudPasswordChangeCycle.Value =
int.Parse(parameter);
62 }
63 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
CheckOnLine
");
64
if (!
string.IsNullOrEmpty(parameter))
65 {
66
this.chkCheckOnLine.Checked = parameter.Equals(
true.ToString());
67 }
68 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
AccountMinimumLength
");
69
if (!
string.IsNullOrEmpty(parameter))
70 {
71
this.nudAccountMinimumLength.Value =
int.Parse(parameter);
72 }
73 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordErrowLockLimit
");
74
if (!
string.IsNullOrEmpty(parameter))
75 {
76
this.nudPasswordErrowLockLimit.Value =
int.Parse(parameter);
77 }
78 parameter = DotNetService.Instance.ParameterService.GetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordErrowLockCycle
");
79
if (!
string.IsNullOrEmpty(parameter))
80 {
81
this.nudPasswordErrowLockCycle.Value =
int.Parse(parameter);
82 }
83 }
84
85
///
<summary>
86
///
将设置保存到数据库
87
///
</summary>
88
private
void SaveParameter()
89 {
90 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
ServerEncryptPassword
",
this.chkServerEncryptPassword.Checked.ToString());
91 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordMiniLength
",
this.nudPasswordMiniLength.Value.ToString());
92 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
NumericCharacters
",
this.chkNumericCharacters.Checked.ToString());
93 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordCycle
",
this.nudPasswordChangeCycle.Value.ToString());
94 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
CheckOnLine
",
this.chkCheckOnLine.Checked.ToString());
95 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
AccountMinimumLength
",
this.nudAccountMinimumLength.Value.ToString());
96 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordErrowLockLimit
",
this.nudPasswordErrowLockLimit.Value.ToString());
97 DotNetService.Instance.ParameterService.SetParameter(
this.UserInfo,
"
System
",
"
SystemSecurity
",
"
PasswordErrowLockCycle
",
this.nudPasswordErrowLockCycle.Value.ToString());
98 }
99
100
///
<summary>
101
///
从当前配置文件显示到界面上
102
///
</summary>
103
private
void GetConfig()
104 {
105
this.chkServerEncryptPassword.Checked = BaseSystemInfo.ServerEncryptPassword;
106
this.nudPasswordMiniLength.Value = BaseSystemInfo.PasswordMiniLength;
107
this.chkNumericCharacters.Checked = BaseSystemInfo.NumericCharacters;
108
this.nudPasswordChangeCycle.Value = BaseSystemInfo.PasswordChangeCycle;
109
this.chkCheckOnLine.Checked = BaseSystemInfo.CheckOnLine;
110
this.nudAccountMinimumLength.Value = BaseSystemInfo.AccountMinimumLength;
111
this.nudPasswordErrowLockLimit.Value = BaseSystemInfo.PasswordErrowLockLimit;
112
this.nudPasswordErrowLockCycle.Value = BaseSystemInfo.PasswordErrowLockCycle;
113 }
114
115
///
<summary>
116
///
当窗体加载时执行的方法,
117
///
这个方法会自动处理鼠标的忙碌状态等等
118
///
</summary>
119
public
override
void FormOnLoad()
120 {
121
this.GetConfig();
122
this.GetParameter();
123 }
124
125
///
<summary>
126
///
将配置文件保存到XML文件里
127
///
</summary>
128
private
void SaveConfig()
129 {
130 BaseSystemInfo.ServerEncryptPassword =
this.chkServerEncryptPassword.Checked;
131 BaseSystemInfo.PasswordMiniLength = (
int)
this.nudPasswordMiniLength.Value;
132 BaseSystemInfo.NumericCharacters =
this.chkNumericCharacters.Checked;
133 BaseSystemInfo.PasswordChangeCycle = (
int)
this.nudPasswordChangeCycle.Value;
134 BaseSystemInfo.CheckOnLine =
this.chkCheckOnLine.Checked;
135 BaseSystemInfo.AccountMinimumLength = (
int)
this.nudAccountMinimumLength.Value;
136 BaseSystemInfo.PasswordErrowLockLimit = (
int)
this.nudPasswordErrowLockLimit.Value;
137 BaseSystemInfo.PasswordErrowLockCycle = (
int)
this.nudPasswordErrowLockCycle.Value;
138
139
//
保存用户的信息
140
#if (!DEBUG)
141 UserConfigHelper.SaveConfig();
142
#endif
143 }
144
145
///
<summary>
146
///
保存系统设置
147
///
</summary>
148
private
void SaveSystemConfig()
149 {
150
//
设置鼠标繁忙状态,并保留原先的状态
151 Cursor holdCursor =
this.Cursor;
152
this.Cursor = Cursors.WaitCursor;
153
try
154 {
155
this.SaveParameter();
156
this.SaveConfig();
157
158
//
是否需要有提示信息?
159
if (BaseSystemInfo.ShowInformation)
160 {
161
//
批量保存,进行提示
162 MessageBox.Show(AppMessage.MSG0011, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
163 }
164 }
165
catch (Exception ex)
166 {
167
this.ProcessException(ex);
168 }
169
finally
170 {
171
//
设置鼠标默认状态,原来的光标状态
172
this.Cursor = holdCursor;
173 }
174 }
175
176
private
void btnConfirm_Click(
object sender, EventArgs e)
177 {
178
//
保存系统设置
179
this.SaveSystemConfig();
180 }
181
182
private
void btnCancel_Click(
object sender, EventArgs e)
183 {
184
this.Close();
185 }
186 }
187 }
复制代码
吉日嘎拉(蒙古语为吉祥如意),2000年毕业于黑龙江大学计算机系软件专业,目前定居杭州,典型的IT软件土鳖一个,外号“软件包工头”。
通用权限管理系统组件(GPM - General Permissions Manager)自2003年开始发布,目前是国内注册用户和免费盗版用户最多的权限管理系统,是各种信息管理系统开发中彻底的权限解决方案。本组件支持多种主流数据库(Oracle、sqlsever、db2、mysql),功能强大,使用方便,代码简洁,思路严谨,被广大支持者称为权限管理系统中的“走火入魔级权限管理系统”。
精心维护通用权限管理系统组件(GPM - General Permissions Manager)有8年多,3年的不断推广,20万行经典的业务逻辑积累,经过上万次的调试修正,经历了四百个付费客户,上百软件公司的实战开发。
11年以上开发经验,外企工作5年,上市公司3年,独立经营软件公司2年,主持研发部门管理工作4年以上。
将权限管理、工作流做到我能力的极致,一个人只能做好那么很少的几件事情。
QQ:252056973,Mail:[email protected]
访问者分布
通用权限管理模块的严谨设计定位、精心编码实现、不断维护推广、持续优化改进,主要是为了实现一个可以高度重复利用劳动成果的工具软件并有偿提供给所需的人们,另想成为国人值得骄傲的知名软件功能模块。
可供国内管理类开发人员在日常工作中进行灵活二次开发利用的模块,开发管理类软件的必备工具之一,我们的目标就是让程序员早点儿回家休息。
淘宝店地址:http://jirigala.taobao.com