




已閱讀5頁,還剩9頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
網(wǎng)絡協(xié)議編程設計C#實訓課程項目報告公司管理系統(tǒng),自己做的,除了數(shù)據(jù)庫不能發(fā)其他源代碼都有(實訓設計)一、實訓題目:公司員工管理系統(tǒng)二、實訓意義:通過此次實訓,讓我們進一步了解c#應用程序開發(fā)的過程,同時也讓我們對前面所學的知識付出實踐,達到熟練掌握、綜合性應用的目的。三、實訓內(nèi)容:1、項目分析:1)員工信息管理 2)員工考勤管理2、項目設計首先,我們必須建立一個登錄系統(tǒng)和八個子系統(tǒng)。登錄系統(tǒng):用戶在登陸后可以進行權限操作管理。員工信息管理系統(tǒng):對員工信息進行查詢、修改、添加、刪除。員工考勤管理系統(tǒng):對員工考勤信息進行查詢、修改、添加、刪除。使用SQL SERVER2005建立YGGL數(shù)據(jù)庫,其中包括:用戶表員工信息表員工考勤表四、項目的實現(xiàn)1、使用SQL2005創(chuàng)建YGGL數(shù)據(jù)庫。2、分別在SQL2005的YGGL數(shù)據(jù)庫下創(chuàng)建admin表、employee_info表、attendance表,其代表用戶表、員工信息表、員工考勤表。1) 用戶信息表:CREATE TABLE dbo.admin( name varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL, pwd varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL) ON PRIMARYGO2) 員工信息表CREATE TABLE dbo.employee_info( userid int NOT NULL, name char(10) COLLATE Chinese_PRC_CI_AS NOT NULL, sex char(10) COLLATE Chinese_PRC_CI_AS NOT NULL, workyear varchar(2) COLLATE Chinese_PRC_CI_AS NULL, phone varchar(50) COLLATE Chinese_PRC_CI_AS NULL, addr varchar(50) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT PK_employee info PRIMARY KEY CLUSTERED ( userid ASC)WITH (IGNORE_DUP_KEY = OFF) ON PRIMARY) ON PRIMARYGO2) 員工考勤表CREATE TABLE dbo.attendance( userid int NOT NULL, leave int NULL, travel int NULL, absent int NULL, CONSTRAINT PK_attendance PRIMARY KEY CLUSTERED ( userid ASC)WITH (IGNORE_DUP_KEY = OFF) ON PRIMARY) ON PRIMARY3、使用C#進行窗口設計(源代碼)1)登錄系統(tǒng):private void btnloginOK_Click_1(object sender, EventArgs e) SqlConnection dbConnection = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); SqlDataReader dataReader; string sqlString = SELECT name,pwd FROM admin; string loginPassWord = ; dbConnection.Open(); SqlCommand dbCommand = new SqlCommand(sqlString, dbConnection); dataReader = dbCommand.ExecuteReader(); try if (dataReader.HasRows) dataReader.Read(); LoginName = dataReadername.ToString(); loginPassWord = dataReaderpwd.ToString(); catch (Exception e1) MessageBox.Show(e1.Message, 登陸出錯); dataReader.Close(); if (LoginName = textBox1.Text & loginPassWord = textBox2.Text) this.Hide(); Main frm1 = new Main(); frm1.ShowDialog(); else MessageBox.Show(請輸入正確的用戶名或者密碼!, 登陸出錯); LoginName = null; 2)員工信息查詢系統(tǒng):查詢:private void btnDemand_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); if (rdbid.Checked = true) sda = new SqlDataAdapter(select * from employee_info where userid=+textChecked.Text.Trim()+, conn); ds = new DataSet(); sda.Fill(ds,employee_info); if (rdbname.Checked = true) sda = new SqlDataAdapter(select * from employee_info where name= + textChecked.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, employee_info); else dataGridView1.DataSource = ds.Tables0; 3)員工考勤管理系統(tǒng):查詢:private void btnDemand1_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from attendance where userid= + textChecked1.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView2.DataSource = ds.Tables0; 修改:private void btnDemand2_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(update attendance set leave= + textleave.Text.Trim() + ,travel= + texttravel.Text.Trim() + , absent= + textabsent.Text.Trim() + where userid= + textChecked1.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); 4)新窗體:添加窗體: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 WindowsApplication1 public partial class insert : Form public insert() InitializeComponent(); private void insert_Load(object sender, EventArgs e) SqlDataAdapter sda; SqlConnection conn; DataSet ds; private void btnDemand5_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(insert into employee_info values( + textuserid1.Text.Trim() + , + textname1.Text.Trim() + , + textsex1.Text.Trim() + , + textworkyear1.Text.Trim() + , + textphone1.Text.Trim() + , + textaddr1.Text.Trim() + ), conn); ds = new DataSet(); sda.Fill(ds, attendance); private void btnresult2_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; 修改窗體: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 WindowsApplication1 public partial class Update : Form public Update() InitializeComponent(); private void Update_Load(object sender, EventArgs e) private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) SqlDataAdapter sda; SqlConnection conn; DataSet ds; private void btnDemand3_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; private void btnDemand4_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(update employee_info set name= + textname.Text.Trim() + ,sex= + textsex.Text.Trim() + , workyear= + textworkyear.Text.Trim() + ,phone= + textphone.Text.Trim() + ,addr= + textaddr.Text.Trim() + where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); private void btnresult1_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; 刪除窗體: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 WindowsApplication1 public partial class delete : Form public delete() InitializeComponent(); private void delete_Load(object sender, EventArgs e) private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) SqlDataAdapter sda; SqlConnection conn; DataSet ds; private void btnDemand6_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; private void btnDemand7_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(delete from employee_info where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); private void btnDemand8_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; 5)員工信息管理系統(tǒng):修改:private void btnupdate_Click(object sender, EventArgs e) Update frm2 = new Update(); frm2.ShowDialog(); private void btnDemand3_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(select * from employee_info where userid= + t extChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); dataGridView1.DataSource = ds.Tables0; private void btnDemand4_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(update employee_info set name= + textname.Text.Trim() + ,sex= + textsex.Text.Trim() + , workyear= + textworkyear.Text.Trim() + ,phone= + textphone.Text.Trim() + ,addr= + textaddr.Text.Trim() + where userid= + textChecked2.Text.Trim() + , conn); ds = new DataSet(); sda.Fill(ds, attendance); 添加:private void btninsert_Click(object sender, EventArgs e) insert frm2 = new insert(); frm2.ShowDialog(); private void btnDemand5_Click(object sender, EventArgs e) conn = new SqlConnection(server=.;database=YGGL;uid=sa;pwd=); sda = new SqlDataAdapter(insert into employee_inf
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 六一親子采摘活動方案
- 六一慈善活動策劃方案
- 六一漢唐活動方案
- 六一活動健美操活動方案
- 六一活動合唱活動方案
- 六一班活動優(yōu)惠活動方案
- 六一納新活動方案
- 六一節(jié)教學活動方案
- 六一蛋糕店活動策劃方案
- 六十校慶活動策劃方案
- 2025年高考全國二卷英語高考真題含解析
- 現(xiàn)金盤點表完整版
- 軍標類型整理文檔
- 國開電大 管理概論 形考任務一(畫組織結構圖)
- 2023年高三新高考英語復習備考策略及方法指導(深度課件)
- 高層建筑施工基坑工程勘察及支護結構選型培訓
- 304不銹鋼管材質(zhì)證明書
- 預拌混凝土及原材料檢測理論考試題庫(含答案)
- 《植物生理學》課件第三章+植物的光合作用
- 游泳館網(wǎng)架翻新施工組織方案設計
- 有機化學所有的命名--超全.
評論
0/150
提交評論