精品文档
private void 损耗查询(object sender, EventArgs e) {
QueryManage.BreakQuery Cc = new XRX.QueryManage.BreakQuery(); Cc.ShowDialog(); }
private void 库存查询(object sender, EventArgs e) {
QueryManage.StoreQuery Cd = new XRX.QueryManage.StoreQuery(); Cd.ShowDialog(); }
private void 备份数据(object sender, EventArgs e) {
SysManage.DataStore Da = new XRX.SysManage.DataStore(); Da.ShowDialog(); }
private void 恢复数据(object sender, EventArgs e) {
SysManage.DataRevert Db = new XRX.SysManage.DataRevert(); Db.ShowDialog(); }
private void 用户管理(object sender, EventArgs e) {
OtherManage.UserManage Ea = new XRX.OtherManage.UserManage(); Ea.ShowDialog(); }
private void 更改密码(object sender, EventArgs e) {
OtherManage.EditPassword Eb = new XRX.OtherManage.EditPassword(); Eb.ShowDialog(); }
private void 系统说明(object sender, EventArgs e) {
OtherManage.Help Ec = new XRX.OtherManage.Help(); Ec.ShowDialog(); }
精品文档
精品文档
private void 退出系统(object sender, EventArgs e) {
Application.Exit(); }
private void Main_FormClosing(object sender, FormClosingEventArgs e) {
if (MessageBox.Show(\您真的要退出本系统吗?\, \提示\,
MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) Application.Exit(); }
private void Main_Load(object sender, EventArgs e) {
} } }
2. 登陆界面
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text;
using System.Windows.Forms; using System.Data.SqlClient;
namespace XRX {
精品文档
精品文档
public partial class Login : Form {
public static string strUName = \; public static string strUPwd = \; public Login() {
InitializeComponent(); }
private void Login_Load(object sender, EventArgs e) {
User u = new User();
DataSet ds = u.showLogin();
this.cboxUName.DataSource = ds.Tables[0].DefaultView; this.cboxUName.DisplayMember = \; }
private void Login_Click(object sender, EventArgs e) {
DataBase db = new DataBase();
SqlParameter[] Pa = new SqlParameter[3];
Pa[0] = db.MakeInParam(\,SqlDbType.VarChar, 20, this.cboxUName.Text);
Pa[1] = db.MakeInParam(\, SqlDbType.VarChar, 20, this.txtPwd.Text);
Pa[2] = db.MakeOutParam(\, SqlDbType.Int, 20);
db.ExecuteNonQuery(CommandType.StoredProcedure, \, Pa); string rtn = Pa[2].Value.ToString(); if (rtn == \) {
Main main = new Main();
strUName = this.cboxUName.Text; strUPwd = this.txtPwd.Text; this.Hide(); main.Show();
} else
MessageBox.Show(\密码错误!\, \登陆失败\, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
精品文档
精品文档
private void Exit_Click(object sender, EventArgs e) {
Application.Exit(); }
private void cboxUName_SelectedValueChanged(object sender, EventArgs e) {
DataBase db = new DataBase();
SqlDataReader dr = db.ExecuteReader(CommandType.Text, \UserLimit from UserInfo where UserName ='\ + this.cboxUName.Text.Trim() + \, null);
if (dr.Read()) {
string a = dr[\].ToString(); if (a == \)
this.labURight.Text = \一级用户\; if (a == \)
this.labURight.Text = \二级用户\; if (a == \)
this.labURight.Text = \三级用户\; if (a == \)
this.labURight.Text = \管理员\; if (a == \)
this.labURight.Text = \超级管理员\;
}
dr.Close(); }
private void cboxUName_SelectedIndexChanged(object sender, EventArgs e) { }
private void Login_FormClosing(object sender, FormClosingEventArgs e) {
Application.Exit(); } }
}
精品文档