东连电子会员管理系统 V1.0 (源代码)
1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace CompanyPersonnelManagementSystem
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Login lo = new Login();
lo.ShowDialog();
if (lo.DialogResult == DialogResult.OK)
{
Form
{
//private bool res = false;
OleDbConnection con;
OleDbDataReader tbread;
FormLogin()
{
}
{
}
{
}
{
InitializeComponent();
buttonClose_Click( sender, EventArgs e)
Application.Exit();
buttonOk_Click( sender, EventArgs e)
getCon();
{
tbread.Read();
pw = tbread.GetValue(0).ToString();
(pw == textBoxPW.Text)
{
}
ClassAdminName.adminName = textBoxName.Text;
.Close();
MessageBox.Show( MessageBoxButtons.OK);
}
{
MessageBox.Show(MessageBoxButtons.OK);
}
con.Close();
OleDbDataReader getCon()
{
source=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbJJCRM.mdb";
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
con =
OleDbConnection(ConStr);
sql = "select adminPassword from tbAdmin where adminName = '"
+ textBoxName.Text + "'";
OleDbCommand cmd =
con.Open();
OleDbCommand(sql, con);
1
东连电子会员管理系统 V1.0 (源代码)
2
tbread = cmd.ExecuteReader();
tbread;
{
MessageBox.Show(MessageBoxButtons.OK);
}
}
}
}
public partial class FormView : Form
{
private OleDbConnection con;
private OleDbDataReader tbread;
//int row = 0;
public FormView()
{
InitializeComponent();
}
private void FormView_Load(object sender, EventArgs e)
{
getCon();
listViewViewAll.Items.Clear();
try
{
while (tbread.Read())
{
ListViewItem lvi = new
ListViewItem(tbread.GetValue(1).ToString());
lvi.SubItems.Add(tbread.GetValue(2).ToString());
lvi.SubItems.Add(tbread.GetValue(3).ToString());
lvi.SubItems.Add(tbread.GetValue(4).ToString());
lvi.SubItems.Add(tbread.GetValue(5).ToString());
lvi.SubItems.Add(tbread.GetValue(6).ToString());
listViewViewAll.Items.Add(lvi);
}
}
catch
{
MessageBox.Show(MessageBoxButtons.OK);
}
con.Close();
}
public OleDbDataReader getCon()
{
try
{
source=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbJJCRM.mdb";
string ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
con = new OleDbConnection(ConStr);
string sql = "select * from tbUserInfo";
OleDbCommand cmd = new OleDbCommand(sql, con);
con.Open();
tbread = cmd.ExecuteReader();
return tbread;
}
catch
{
MessageBox.Show(MessageBoxButtons.OK);
return null;
2
东连电子会员管理系统 V1.0 (源代码)
3
}
}
}
FormMain : Form
{
FormMain()
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
InitializeComponent();
.Hide();
FormLogin fl =
fl.ShowDialog();
FormLogin();
FormMain_Load( sender, EventArgs e)
labelWelcom.Text =
+ ClassAdminName.adminName;
buttonViewAll_Click( sender, EventArgs e)
FormView fv =
fv.MdiParent = ;
fv.Show();
FormView();
buttonSearch_Click( sender, EventArgs e)
FormSearch fs =
fs.MdiParent = ;
fs.Show();
FormSearch();
buttonAdd_Click( sender, EventArgs e)
FormAdd fa =
fa.MdiParent = ;
fa.Show();
FormAdd();
buttonUpdate_Click( sender, EventArgs e)
FormUpdate fu =
fu.MdiParent = ;
fu.Show();
FormUpdate();
buttonExit_Click( sender, EventArgs e)
Application.Exit();
buttonDelete_Click( sender, EventArgs e)
FormDelete fd =
fd.MdiParent = ;
fd.Show();
FormDelete();
button1_Click( sender, EventArgs e)
AboutBox1 aboutbox =
AboutBox1();
aboutbox.ShowDialog();
button2_Click( sender, EventArgs e)
3
东连电子会员管理系统 V1.0 (源代码)
4
System.Diagnostics.Process.Start("notepad.exe");
}
{
}
button3_Click( sender, EventArgs e)
Form1 form1 =
form1.ShowDialog();
Form1();
}
partial class FormSearch
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
///
true if managed resources should be
disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.groupBoxSearch = new System.Windows.Forms.GroupBox();
this.buttonClear = new System.Windows.Forms.Button();
this.buttonSearch = new System.Windows.Forms.Button();
this.textBoxSearch = new System.Windows.Forms.TextBox();
this.radioButtonNumberSearch = new
System.Windows.Forms.RadioButton();
this.radioButtonNameSearch = new System.Windows.Forms.RadioButton();
this.listViewView = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.groupBoxSearch.SuspendLayout();
this.SuspendLayout();
// groupBoxSearch
this.groupBoxSearch.Controls.Add(this.buttonClear);
this.groupBoxSearch.Controls.Add(this.buttonSearch);
this.groupBoxSearch.Controls.Add(this.textBoxSearch);
this.groupBoxSearch.Controls.Add(this.radioButtonNumberSearch);
this.groupBoxSearch.Controls.Add(this.radioButtonNameSearch);
this.groupBoxSearch.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBoxSearch.Location = new System.Drawing.Point(0, 0);
4
东连电子会员管理系统 V1.0 (源代码)
5
this.groupBoxSearch.Name = "groupBoxSearch";
this.groupBoxSearch.Size = new System.Drawing.Size(531, 107);
this.groupBoxSearch.TabIndex = 1;
this.groupBoxSearch.TabStop = false;
this.groupBoxSearch.Text =;
this.groupBoxSearch.Enter += new
System.EventHandler(this.groupBoxSearch_Enter);
// buttonClear
this.buttonClear.Location = new System.Drawing.Point(402, 58);
this.buttonClear.Name = "buttonClear";
this.buttonClear.Size = new System.Drawing.Size(75, 23);
this.buttonClear.TabIndex = 4;
this.buttonClear.Text =;
this.buttonClear.UseVisualStyleBackColor = true;
this.buttonClear.Click += new
System.EventHandler(this.buttonClear_Click);
// buttonSearch
this.buttonSearch.Location = new System.Drawing.Point(402, 30);
this.buttonSearch.Name = "buttonSearch";
this.buttonSearch.Size = new System.Drawing.Size(75, 23);
this.buttonSearch.TabIndex = 3;
this.buttonSearch.Text =;
this.buttonSearch.UseVisualStyleBackColor = true;
this.buttonSearch.Click += new
System.EventHandler(this.buttonSearch_Click);
65);
16);
30);
// textBoxSearch
this.textBoxSearch.Location = new System.Drawing.Point(171, 46);
this.textBoxSearch.Name = "textBoxSearch";
this.textBoxSearch.Size = new System.Drawing.Size(195, 21);
this.textBoxSearch.TabIndex = 2;
// radioButtonNumberSearch
this.radioButtonNumberSearch.AutoSize = true;
this.radioButtonNumberSearch.Location = new System.Drawing.Point(47,
this.radioButtonNumberSearch.Name = "radioButtonNumberSearch";
this.radioButtonNumberSearch.Size = new System.Drawing.Size(107,
this.radioButtonNumberSearch.TabIndex = 1;
this.radioButtonNumberSearch.TabStop = true;
this.radioButtonNumberSearch.Text =;
this.radioButtonNumberSearch.UseVisualStyleBackColor = true;
// radioButtonNameSearch
this.radioButtonNameSearch.AutoSize = true;
this.radioButtonNameSearch.Location = new System.Drawing.Point(47,
this.radioButtonNameSearch.Name = "radioButtonNameSearch";
this.radioButtonNameSearch.Size = new System.Drawing.Size(107, 16);
this.radioButtonNameSearch.TabIndex = 0;
this.radioButtonNameSearch.TabStop = true;
this.radioButtonNameSearch.Text =;
this.radioButtonNameSearch.UseVisualStyleBackColor = true;
// listViewView
this.listViewView.Columns.AddRange(new
System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
5
东连电子会员管理系统 V1.0 (源代码)
6
this.columnHeader5,
this.columnHeader6});
this.listViewView.Dock = System.Windows.Forms.DockStyle.Bottom;
this.listViewView.FullRowSelect = true;
this.listViewView.GridLines = true;
this.listViewView.Location = new System.Drawing.Point(0, 108);
this.listViewView.Name = "listViewView";
this.listViewView.Size = new System.Drawing.Size(531, 132);
this.listViewView.TabIndex = 0;
this.listViewView.UseCompatibleStateImageBehavior = false;
this.listViewView.View = System.Windows.Forms.View.Details;
// columnHeader1
this.columnHeader1.Text =;
this.columnHeader1.Width = 70;
// columnHeader2
this.columnHeader2.Text =;
this.columnHeader2.Width = 72;
// columnHeader3
this.columnHeader3.Text =;
this.columnHeader3.Width = 88;
// columnHeader4
this.columnHeader4.Text =;
this.columnHeader4.Width = 134;
// columnHeader5
this.columnHeader5.Text =;
this.columnHeader5.Width = 81;
// columnHeader6
this.columnHeader6.Text =;
this.columnHeader6.Width = 76;
// FormSearch
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(531, 240);
this.Controls.Add(this.listViewView);
this.Controls.Add(this.groupBoxSearch);
this.Name = "FormSearch";
this.Text =;
this.Load += new System.EventHandler(this.FormSearch_Load);
this.groupBoxSearch.ResumeLayout(false);
this.groupBoxSearch.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBoxSearch;
private System.Windows.Forms.Button buttonClear;
private System.Windows.Forms.Button buttonSearch;
private System.Windows.Forms.TextBox textBoxSearch;
private System.Windows.Forms.RadioButton radioButtonNumberSearch;
private System.Windows.Forms.RadioButton radioButtonNameSearch;
private System.Windows.Forms.ListView listViewView;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
}
FormAdd : Form
6
东连电子会员管理系统 V1.0 (源代码)
7
{
OleDbConnection con;
FormAdd()
{
}
{
}
{
}
{
}
{
InitializeComponent();
FormAdd_Load( sender, EventArgs e)
buttonOk_Click( sender, EventArgs e)
(getCon())
{
}
}
MessageBox.Show(, MessageBoxButtons.OK);
buttonClear_Click(sender, e);
{
MessageBox.Show( MessageBoxButtons.OK);
buttonClear_Click( sender, EventArgs e)
textBoxName.Text = "";
textBoxNum.Text = "";
textBoxAutoNum.Text = "";
textBoxAddress.Text = "";
textBoxService.Text = "";
textBoxMenu.Text = "";
Boolean getCon()
{
source=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbJJCRM.mdb";
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
con =
OleDbConnection(ConStr);
sql = "insert into tbUserInfo
(userName,userNum,userAutoNum,userAddress,userService,userMenu) values ('" +
textBoxName.Text + "','" + textBoxNum.Text + "','" + textBoxAutoNum.Text +
"','" + textBoxAddress.Text + "','" + textBoxService.Text + "','" +
textBoxMenu.Text + "')";
OleDbCommand cmd =
con.Open();
cmd.ExecuteNonQuery();
OleDbCommand(sql, con);
}
}
}
{
FormUpdate : Form
{
id = "";
OleDbConnection con;
OleDbDataReader tbread;
FormUpdate()
InitializeComponent();
FormUpdate_Load( sender, EventArgs e)
{
}
{
7
东连电子会员管理系统 V1.0 (源代码)
8
buttonSearch_Click( sender, EventArgs e)
getCon();
tbread.Read();
{
id = tbread.GetValue(0).ToString();
textBoxName.Text = tbread.GetValue(1).ToString();
textBoxNum.Text = tbread.GetValue(2).ToString();
textBoxAutoNum.Text = tbread.GetValue(3).ToString();
textBoxAddress.Text = tbread.GetValue(4).ToString();
textBoxService.Text = tbread.GetValue(5).ToString();
textBoxMenu.Text = tbread.GetValue(6).ToString();
buttonClear_Click(sender, e);
}
{
MessageBox.Show(MessageBoxButtons.OK);
}
con.Close();
textBoxSearch.Text = "";
buttonOk_Click( sender, EventArgs e)
(update())
{
}
MessageBox.Show(MessageBoxButtons.OK);
buttonClearUser_Click(sender, e);
{
MessageBox.Show(MessageBoxButtons.OK);
}
con.Close();
buttonClearUser_Click( sender, EventArgs e)
textBoxName.Text = "";
textBoxNum.Text = "";
textBoxAutoNum.Text = "";
textBoxAddress.Text = "";
textBoxService.Text = "";
textBoxMenu.Text = "";
Boolean update()
{
}
{
}
{
}
{
}
{
}
{
source=Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dbJJCRM.mdb";
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
con =
OleDbConnection(ConStr);
sql = "update tbUserInfo set userName = '" + textBoxName.Text
+ "',userNum = '" + textBoxNum.Text + "',userAutoNum = '" + textBoxAutoNum.Text
+ "',userAddress = '" + textBoxAddress.Text + "',userService = '" +
textBoxService.Text + "',userMenu = '" + textBoxMenu.Text + "' where id = "
+ .Parse(id);
OleDbCommand cmd =
con.Open();
cmd.ExecuteNonQuery();
OleDbCommand(sql, con);
8