




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、主界面程序using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU;namespace public partial class Frm_Main : Form public Frm_Main() InitializeComponent(); private void Frm_Main_Load(object send
2、er, EventArgs e) toolStripStatusLabel6.Text = DateTime.Now.ToString(); private void 查詢分析ToolStripMenuItem3_Click(object sender, EventArgs e) Frm_Warehouse_Query frm_Warehouse_Query = new Frm_Warehouse_Query(); frm_Warehouse_Query.ShowDialog(); private void 添加倉(cāng)庫(kù)信息ToolStripMenuItem_Click(object sender
3、, EventArgs e) Frm_Warehouse_Add frm_Warehouse_Add = new Frm_Warehouse_Add(); frm_Warehouse_Add.ShowDialog(); private void 修改倉(cāng)庫(kù)信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Update frm_Warehouse_Update = new Frm_Warehouse_Update(); frm_Warehouse_Update.ShowDialog(); private void
4、 刪除倉(cāng)庫(kù)信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Delete frm_Warehouse_Delete = new Frm_Warehouse_Delete(); frm_Warehouse_Delete.ShowDialog(); 倉(cāng)庫(kù)信息添加界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.
5、Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Add : Form public Frm_Warehouse_Add() InitializeComponent(); private void Frm_Warehouse_Add_Load(object sender, EventArgs e) /添加按鈕事件 private void btnAdd_Click(
6、object sender, EventArgs e) if (string.IsNullOrEmpty(txtWarehouseCode.Text.Trim() MessageBox.Show("請(qǐng)將數(shù)據(jù)完整輸入!", "提示", MessageBoxButtons.OK); else WarehouseManage warehouseManage = new WarehouseManage(); WarehouseTable warehouseTable = new WarehouseTable(); warehouseTable.Warehouse
7、Code = (string)txtWarehouseCode.Text; warehouseTable.WarehouseName = (string)txtWarehouseName.Text; warehouseTable.Property = (string)txtProperty.Text; warehouseTable.Department = (string)txtDepartment.Text; warehouseTable.Address = (string)txtAddress.Text; warehouseTable.Tel = (string)txtTel.Text;
8、warehouseTable.Director = (string)txtDirector.Text; warehouseTable.CreateBy = (string)txtCreateBy.Text; warehouseTable.CreateTime = int.Parse(dtpCreateTime.Value.ToString("yyyyMMdd"); warehouseTable.Summary = (string)txtSummary.Text; int i = warehouseManage.AddWarehouseTable(warehouseTable
9、); if (i > 0) MessageBox.Show("已插入" + i + "條記錄!", "提示", MessageBoxButtons.OK); else MessageBox.Show("插入失??!", "提示", MessageBoxButtons.OK); /取消按鈕事件 private void btnCanel_Click(object sender, EventArgs e) txtWarehouseCode.Text = null; txtWarehouseNam
10、e.Text = null; txtProperty.Text = null; txtDepartment.Text = null; txtAddress.Text = null; txtTel.Text = null; txtDirector.Text = null; txtCreateBy.Text = null; txtSummary.Text = null; /退出按鈕事件 private void btnExit_Click(object sender, EventArgs e) this.Close(); 倉(cāng)庫(kù)信息刪除界面using System;using System.Coll
11、ections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Delete : Form public Frm_Warehouse_Delete() InitializeComponent(); /點(diǎn)開刪除界面時(shí),向下拉菜單中加載可選的倉(cāng)庫(kù)編號(hào) pri
12、vate void Frm_Warehouse_Delete_Load(object sender, EventArgs e) AddWarehouseCode(); private void AddWarehouseCode() cboWarehouseCode.DataSource = new WarehouseManage().GetWarehouseCode(); cboWarehouseCode.DisplayMember = "WAREHOUSECODE" /查詢選擇的倉(cāng)庫(kù)信息 private void btnQuery_Click(object sender,
13、 EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("請(qǐng)選擇出庫(kù)單編號(hào)!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(cboWarehouseCode.Text); /刪除選中的倉(cāng)庫(kù) private void btnDelete_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWa
14、rehouseCode.Text) MessageBox.Show("請(qǐng)選擇出庫(kù)單編號(hào)!"); else int i = new WarehouseManage().DeleteWarehouse(cboWarehouseCode.Text); MessageBox.Show("已經(jīng)刪除"+i+"條記錄!"); dgvWarehouseDetails.DataSource = null; AddWarehouseCode(); /點(diǎn)擊退出,關(guān)閉窗口 private void btnExit_Click(object sender, E
15、ventArgs e) this.Close(); 倉(cāng)庫(kù)信息更新界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;using System.Data.SqlClient;using SJZU.SWEIM
16、S.DBUtility;namespace public partial class Frm_Warehouse_Update : Form WarehouseManage warehouseManage = new WarehouseManage(); SqlDataAdapter adapter; DataTable table; public Frm_Warehouse_Update() InitializeComponent(); private void Frm_Warehouse_Update_Load(object sender, EventArgs e) cboWarehous
17、eCode.DataSource = warehouseManage.GetWarehouseCode(); cboWarehouseCode.DisplayMember = "WAREHOUSECODE" /查詢倉(cāng)庫(kù)信息 private void btnQuery_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("請(qǐng)選擇要查詢的倉(cāng)庫(kù)編號(hào)!"); else string warehouseCode = cbo
18、WarehouseCode.Text; string strsql = "select * from WAREHOUSE where WAREHOUSECODE = " + warehouseCode; string connectionString = SQLHelper._connectionString; SqlConnection conn = new SqlConnection(connectionString); adapter = new SqlDataAdapter(strsql, conn); SqlCommandBuilder builder = new
19、 SqlCommandBuilder(adapter); adapter.InsertCommand = builder.GetInsertCommand(); adapter.DeleteCommand = builder.GetDeleteCommand(); adapter.UpdateCommand = builder.GetUpdateCommand(); table = new DataTable(); adapter.Fill(table); dgvWarehouseDetails.DataSource = table; private void btnUpdate_Click(
20、object sender, EventArgs e) dgvWarehouseDetails.EndEdit(); try adapter.Update(table); MessageBox.Show("保存成功!"); catch (SqlException err) MessageBox.Show(err.Message, "保存成功!"); private void btnExit_Click(object sender, EventArgs e) this.Close(); 倉(cāng)庫(kù)信息查詢界面using System;using System.C
21、ollections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using SJZU.SWEIMS.BusinessModel;using SJZU.SWEIMS.BusinessLogic;namespace public partial class Frm_Warehouse_Query : Form public Frm_Warehouse_Query() InitializeComponen
22、t(); private void Frm_Warehouse_Query_Load(object sender, EventArgs e) /按選擇的條件查詢倉(cāng)庫(kù)信息 private void btnQuery_Click(object sender, EventArgs e) int startTime = int.Parse(dtpStart.Value.ToString("yyyyMMdd"); int endTime = int.Parse(dtpEnd.Value.ToString("yyyyMMdd"); if (startTime >
23、; endTime) MessageBox.Show("開始時(shí)間不能晚于結(jié)束時(shí)間!"); else /按時(shí)間查詢,倉(cāng)庫(kù)編號(hào)和負(fù)責(zé)人都不是查詢條件 if (cbWarehouseCode.Checked = false && cbDirector.Checked = false) dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime); /按時(shí)間和倉(cāng)庫(kù)編號(hào)查詢 else if (cbWarehouseCode.Checked = t
24、rue && cbDirector.Checked = false) string warehouseCode = txtWarehouseCode.Text; if (string.IsNullOrEmpty(warehouseCode.Trim() MessageBox.Show("請(qǐng)輸入倉(cāng)庫(kù)編號(hào)!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode); /按時(shí)間和負(fù)責(zé)人查詢 e
25、lse if (cbWarehouseCode.Checked = false && cbDirector.Checked = true) string director = txtDirector.Text; if (string.IsNullOrEmpty(director.Trim() MessageBox.Show("請(qǐng)輸入負(fù)責(zé)人!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, director,
26、9); /按時(shí)間,倉(cāng)庫(kù)編號(hào),負(fù)責(zé)人查詢 else if (cbWarehouseCode.Checked = true && cbDirector.Checked = true) string warehouseCode = txtWarehouseCode.Text; string director = txtDirector.Text; if (string.IsNullOrEmpty(warehouseCode.Trim() | string.IsNullOrEmpty(director.Trim() MessageBox.Show("所選條件不能為空!&quo
27、t;); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode,director); private void btnExit_Click(object sender, EventArgs e) this.Close(); 邏輯層代碼using System;using System.Collections.Generic;using System.Text;using System.Data.SqlClient;using
28、SJZU.SWEIMS.DBUtility;using SJZU.SWEIMS.BusinessModel;using System.Data;namespace public class WarehouseManage /向數(shù)據(jù)庫(kù)WAREHOUSE表中添加倉(cāng)庫(kù)數(shù)據(jù) public int AddWarehouseTable(WarehouseTable warehouseTable) string strsql = "insert into WAREHOUSE(WAREHOUSECODE," + "WAREHOUSENAME," + "PROP
29、ERTY," + "DEPARTMENT," + "ADDRESS," + "TEL," + "DIRECTOR," + "CREATEBY," + "CREATETIME," + "SUMMARY)" + "VALUES(WAREHOUSECODE," + "WAREHOUSENAME," + "PROPERTY," + "DEPARTMENT," + "
30、ADDRESS," + "TEL," + "DIRECTOR," + "CREATEBY," + "CREATETIME," + "SUMMARY)" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseTable.WarehouseCode), new SqlParameter("WAREHOUSENAME", wareh
31、ouseTable.WarehouseName), new SqlParameter("PROPERTY", warehouseTable.Property) , new SqlParameter("DEPARTMENT", warehouseTable.Department), new SqlParameter("ADDRESS",warehouseTable.Address), new SqlParameter("TEL",warehouseTable.Tel), new SqlParameter("
32、DIRECTOR", warehouseTable.Director), new SqlParameter("CREATEBY", warehouseTable.CreateBy), new SqlParameter("CREATETIME",warehouseTable.CreateTime), new SqlParameter("SUMMARY",warehouseTable.Summary); int i = SQLHelper.ExecuteSql(strsql,commandParms); return i; /取
33、得倉(cāng)庫(kù)編號(hào) public DataTable GetWarehouseCode() string strSql = "select WAREHOUSECODE from WAREHOUSE" return SQLHelper.Query(strSql).Tables0; /根據(jù)倉(cāng)庫(kù)編號(hào)查詢倉(cāng)庫(kù)詳細(xì)信息 public DataTable GetWarehouseTable(string warehouseCode) string strSql = "select * from WAREHOUSE where WAREHOUSECODE = WAREHOUSECODE
34、" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseCode) ; return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)倉(cāng)庫(kù)編號(hào)刪除倉(cāng)庫(kù)信息 public int DeleteWarehouse(string warehouseCode) string strSql = "delete from WAREHOUSE where WAREHOUSECODE = WARE
35、HOUSECODE" SqlParameter commandParms = new SqlParameter new SqlParameter("WAREHOUSECODE", warehouseCode) ; return SQLHelper.ExecuteSql(strSql, commandParms); /根據(jù)時(shí)間階段查詢倉(cāng)庫(kù)信息 public DataTable GetWarehouseTable(int startTime, int endTime) string strSql = "select * from WAREHOUSE wher
36、e CREATETIME >= startTime and CREATETIME <= endTime" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", startTime), new SqlParameter("endTime", endTime) ; return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時(shí)間階段和倉(cāng)庫(kù)編號(hào)查詢 public DataTable GetW
37、arehouseTable(int startTime, int endTime, string warehouseCode) string strSql = "select * from WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and WAREHOUSECODE=warehouseCode" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", start
38、Time), new SqlParameter("endTime", endTime),new SqlParameter("warehouseCode", warehouseCode); return SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時(shí)間階段和負(fù)責(zé)人查詢 public DataTable GetWarehouseTable(int startTime, int endTime,string director,int i) string strSql = "select * fr
39、om WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and DIRECTOR=director" SqlParameter commandParms = new SqlParameter new SqlParameter("startTime", startTime), new SqlParameter("endTime", endTime), new SqlParameter("director", director) ; r
40、eturn SQLHelper.Query(strSql, commandParms).Tables0; /根據(jù)時(shí)間階段,倉(cāng)庫(kù)編號(hào)和負(fù)責(zé)人查詢 public DataTable GetWarehouseTable(int startTime, int endTime, string warehouseCode,string director) string strSql = "select * from WAREHOUSE where CREATETIME >= startTime and CREATETIME <= endTime and WAREHOUSECODE=warehouseCode and DIRECTOR =director" SqlParame
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 5年級(jí)下冊(cè)英語(yǔ)書單詞表點(diǎn)讀
- 低空空中交通應(yīng)用場(chǎng)景
- 登山 法治宣傳活動(dòng)
- 4年級(jí)觀察日記三則怎么寫
- 超聲波塑料焊接 - 副本 - 副本
- 2025年貴陽(yáng)幼兒師范高等??茖W(xué)校單招職業(yè)技能測(cè)試題庫(kù)帶答案
- 2025年云南商務(wù)職業(yè)學(xué)院?jiǎn)握新殬I(yè)傾向性測(cè)試題庫(kù)一套
- 2025年重慶市綿陽(yáng)市單招職業(yè)傾向性測(cè)試題庫(kù)及參考答案
- 2025年天津公安警官職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)1套
- 2025年晉城職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)學(xué)生專用
- GA/T 701-2024安全防范指紋識(shí)別應(yīng)用出入口控制指紋識(shí)別模塊通用規(guī)范
- 4.1 人要有自信 (課件)2024-2025學(xué)年七年級(jí)道德與法治下冊(cè)(統(tǒng)編版2024)
- 加強(qiáng)學(xué)校鑄牢中華民族共同體意識(shí)教育心得
- 16.3 二次根式的加減 - 人教版數(shù)學(xué)八年級(jí)下冊(cè)教學(xué)課件
- 馬尼拉草皮施工方案
- 中國(guó)HEPA過濾器行業(yè)發(fā)展監(jiān)測(cè)及發(fā)展戰(zhàn)略規(guī)劃報(bào)告
- 人工智能融入土木水利碩士人才培養(yǎng)模式研究
- 2024年江蘇商貿(mào)職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性測(cè)試歷年參考題庫(kù)含答案解析
- 施工技術(shù)創(chuàng)新管理措施
- 人工智能賦能新質(zhì)生產(chǎn)力發(fā)展:現(xiàn)狀解析與未來(lái)展望
- 2021年安徽省中考數(shù)學(xué)試卷-普通卷
評(píng)論
0/150
提交評(píng)論