1?登陆界面
主要代码:
public partial
class LoginForm : Form{
public static string uacc;
public static
string upsw;
public static string
uname;
public static string usex;
public static string upart;
public static
string
uright;
public LoginForm() {
lnitializeComponent();
}
private void loginbtn_Click( object sender, EventArgs e) {
if ( this .useracctxt.Text.Trim() ==
\
{
MessageBoxShow(”请输入您的用户名和密码! \提示! ”);
return ;
}
try
{
string sql;
sql
= \+ this .pswtxt.Text +
\
OleDbDataReader dr = DBHelpOleReader(sql);
dr.Read();
if (dr.HasRows)
{
uacc = this .useracctxt.Text; upsw = this .pswtxt.Text;
uname = dr[
\
upart = dr[ \
uright = dr[
\
精选范本
\
and upsw='\
usex = dr[
\
MainForm af = new MainForm( this ); this .Hide();
this .useracctxt.Clear(); this .pswtxt.Clear();
af.Show(); }
else
{
MessageBoxShow(”账号或密码错误!\提示! ”); this .useracctxt.Clear(); this .pswtxt.Clear(); this .useracctxt.Focus();
} }
catch ( Exception )
{
MessageBoxShow(”数据库无法连接!\,\警告!\);
} }
private void cancelbtn_Click( object sender, EventArgs e) {
Application .Exit();
}
private void LoginForm_Closing( object sender, FormClosingEventArgs e) {
Application .Exit();
} }
2.主界面(图较小,自己可以拉大点)
精选范本
?田社管理系统
主要代码就不写了,很简单 3.权限设置
主要代码:
public partial class RightSet : Form {
public RightSet() {
lnitializeComponent(); }
private void RightSet_Load( object sender, EventArgs e) {
this .rightbox.Selectedlndex = 0; 〃this.treeright.ExpandAII();
Fill();
private void okbtn_Click( object sender, EventArgs e)
精选范本
{
if ( this .txtnum.Text == string .Empty)
{
MessageBoxShow(”请输入最大借阅图书数量! return ;
}
if ( this .txtday.Text == string .Empty)
{
MessageBoxShow(”请输入最大借阅图书时间! \,”提示! ”); \,”提示! ”);
return ;
}
if ( this .txtcost.Text == string .Empty)
{
MessageBoxShow(”请输入借书押金金额! \提示! ”);return ;
}
if ( this .txtfine.Text == string .Empty)
{
MessageBoxShow(”请输入超期罚款金额! \提示! ”);return ;
}
if ( this .txttim.Text == string .Empty)
{
MessageBoxShow(”请输入图书遗失罚款倍数! \,”提示!return ;
}
ArrayList arr = new ArrayList ();
foreach ( TreeNode nodes in this .treeright.Nodes)
{
if (nodes.Checked)
{
arr.Add( \
}
else
{
arr.Add( \}
foreach (TreeNode node in nodes.Nodes)
{
if (node.Checked)
精选范本
”);
arr.Add( \
}
else
{
arr.Add( \
} } }
string [] a= new string [11]; for ( int i = 0; i < arr.Count; i++)
{
if (arr[i].ToString().Trim() ==
\
{ a[i] = \
}
else
{ a[i] = \} }
string sql = string .Empty;
sql +=
\
DataTable dt = DBHelp.ExeOleCommand(sql);
bool b = false ;
while (dt.Rows.Count != 0)
{ b =
true ; break;
}
string sql1;
if (b)
{ sql1 = \;
sql1 += \+ this .txtnum.Text + sql1 += \+ this .txtday.Text +
sql1 += \+ this .txtcost.Text + sql1 +=
\
+ this .txtfine.Text +
精选范本
+ this \\\\
.rightbox.Text +