第四章 主要内容
4.1登陆界面
图4.1登录界面
设计过程:
用于输入用户名和密码登录,选择相应的用户类型进入系统,若是用户类型选择错误则不能进入系统。输入用户名和密码后点击确定判断数据库中的用户是否为合法用户。 设计代码:
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;
6
using System.Text;
using System.Windows.Forms; using System.Data.SqlClient;
namespace 企¨?业°|ì管¨1理¤¨a信?息?é系|ì统a3 {
public partial class Form1 : Form {
static public string sn, sub;
public Form1() {
InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) {
Form2 fr2 = new Form2(); Form3 fr3 = new Form3(); Form4 fr4 = new Form4();
if (comboBox1.Text == \ || textBox1.Text == \)
MessageBox.Show(\请?不?要°a遗°?漏?信?息?é!ê?\); if (radioButton1.Checked) {
string cstr = \用??户?ì登ì?录? where 类¤¨¤别àe='管¨1理¤¨a员?à'and 用??户?ì名?=='\ + comboBox1.Text.Trim() + \密¨1码?='\ + textBox1.Text.Trim() + \; SqlCommand comm = new SqlCommand(cstr); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read())
{ sn = comboBox1.Text.Trim(); fr4.Show(); this.Visible = false; } else {
MessageBox.Show(\输o?入¨?有?D误¨?,ê?请?重?新?输o?入¨?!ê?\); comboBox1.Text = \; textBox1.Text = \; } }
if (radioButton2.Checked) {
string cstr = \用??户?ì登ì?录? where 类¤¨¤别àe='领¢¨?导ì?'and 用??户?ì名?='\ + comboBox1.Text.Trim() + \密¨1码?='\ + textBox1.Text.Trim() + \; SqlCommand comm = new SqlCommand(cstr); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read())
{ sn = comboBox1.Text.Trim(); sub = dr.GetValue(3).ToString(); fr3.Show(); this.Visible = false; }
7
else {
MessageBox.Show(\输o?入¨?有?D误¨?,ê?请?重?新?输o?入¨?!ê?\); comboBox1.Text = \; textBox1.Text = \; } }
if (radioButton3.Checked) {
string cstr = \用??户?ì登ì?录? where 类¤¨¤别àe='员?à工?è'and 用??户?ì名?='\ + comboBox1.Text.Trim() + \密¨1码?='\ + textBox1.Text.Trim() + \; SqlCommand comm = new SqlCommand(cstr); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read())
{ sn = comboBox1.Text.Trim(); fr2.Show(); this.Visible = false; } else {
MessageBox.Show(\输o?入¨?有?D误¨?,ê?请?重?新?输o?入¨?!ê?\); comboBox1.Text = \; textBox1.Text = \; }
} }
private void button2_Click(object sender, EventArgs e) {
this.Close(); }
8
4.2员工信息管理界面
图4.2员工信息管理界面
设计过程:
此部分主要针对员工信息的管理,可以查询员工的基本信息,实现信息的查询、修改等功能。 查询界面
设计代码:
9
相关推荐: