版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 添加仓库信息ToolStripMenuItem_Click(object sender
3、, EventArgs e) Frm_Warehouse_Add frm_Warehouse_Add = new Frm_Warehouse_Add(); frm_Warehouse_Add.ShowDialog(); private void 修改仓库信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Update frm_Warehouse_Update = new Frm_Warehouse_Update(); frm_Warehouse_Update.ShowDialog(); private void
4、 删除仓库信息ToolStripMenuItem_Click(object sender, EventArgs e) Frm_Warehouse_Delete frm_Warehouse_Delete = new Frm_Warehouse_Delete(); frm_Warehouse_Delete.ShowDialog(); 仓库信息添加界面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("请将数据完整输入!", "提示", 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(); 仓库信息删除界面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(); /点开删除界面时,向下拉菜单中加载可选的仓库编号 pri
12、vate void Frm_Warehouse_Delete_Load(object sender, EventArgs e) AddWarehouseCode(); private void AddWarehouseCode() cboWarehouseCode.DataSource = new WarehouseManage().GetWarehouseCode(); cboWarehouseCode.DisplayMember = "WAREHOUSECODE" /查询选择的仓库信息 private void btnQuery_Click(object sender,
13、 EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("请选择出库单编号!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(cboWarehouseCode.Text); /删除选中的仓库 private void btnDelete_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWa
14、rehouseCode.Text) MessageBox.Show("请选择出库单编号!"); else int i = new WarehouseManage().DeleteWarehouse(cboWarehouseCode.Text); MessageBox.Show("已经删除"+i+"条记录!"); dgvWarehouseDetails.DataSource = null; AddWarehouseCode(); /点击退出,关闭窗口 private void btnExit_Click(object sender, E
15、ventArgs e) this.Close(); 仓库信息更新界面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" /查询仓库信息 private void btnQuery_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(cboWarehouseCode.Text) MessageBox.Show("请选择要查询的仓库编号!"); 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(); 仓库信息查询界面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) /按选择的条件查询仓库信息 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("开始时间不能晚于结束时间!"); else /按时间查询,仓库编号和负责人都不是查询条件 if (cbWarehouseCode.Checked = false && cbDirector.Checked = false) dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime); /按时间和仓库编号查询 else if (cbWarehouseCode.Checked = t
24、rue && cbDirector.Checked = false) string warehouseCode = txtWarehouseCode.Text; if (string.IsNullOrEmpty(warehouseCode.Trim() MessageBox.Show("请输入仓库编号!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, warehouseCode); /按时间和负责人查询 e
25、lse if (cbWarehouseCode.Checked = false && cbDirector.Checked = true) string director = txtDirector.Text; if (string.IsNullOrEmpty(director.Trim() MessageBox.Show("请输入负责人!"); else dgvWarehouseDetails.DataSource = new WarehouseManage().GetWarehouseTable(startTime, endTime, director,
26、9); /按时间,仓库编号,负责人查询 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 /向数据库WAREHOUSE表中添加仓库数据 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、得仓库编号 public DataTable GetWarehouseCode() string strSql = "select WAREHOUSECODE from WAREHOUSE" return SQLHelper.Query(strSql).Tables0; /根据仓库编号查询仓库详细信息 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; /根据仓库编号删除仓库信息 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); /根据时间阶段查询仓库信息 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; /根据时间阶段和仓库编号查询 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; /根据时间阶段和负责人查询 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; /根据时间阶段,仓库编号和负责人查询 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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026重庆清江镇分水社区招聘社区工作者(本土人才)1人笔试备考题库及答案详解
- 2026浙江舟山市岱山县公路与运输管理中心招聘编外人员1人笔试参考题库及答案详解
- 2026外国语学院歌德语言中心招聘合同制工作人员1人笔试备考试题及答案详解
- 2026年张店钢铁总厂医院医护人员招聘笔试备考题库及答案解析
- 2026年邹平鹤伴山老年康复医院医护人员招聘笔试备考题库及答案解析
- 2026年山东第一医科大学第二附属医院公开招聘部分岗位聘用制工作人员(37人)笔试参考题库及答案详解
- 2026湖南衡阳市石鼓区公开招聘教师44人笔试备考题库及答案详解
- 中华财险2027届暑期实习招募笔试备考题库及答案详解
- 2025年盱眙县古桑乡卫生院医护人员招聘笔试试题及答案详解
- 2025年重庆江陵医院长安汽车有限责任公司第一职工医院医护人员招聘笔试试题及答案详解
- 2026年河南省胸科医院医护人员招聘笔试参考题库及答案详解
- 高空作业2026年合同协议
- 新录用公务员考察报告
- 2026年福建厦漳泉城际铁路有限责任公司社会招聘34人笔试备考试题及答案详解
- 智能施肥决策支持系统-洞察与解读
- 2025年江苏省八年级地理生物会考考试试题及答案
- 2026年渝中区北碚区社区工作者招聘考试参考试题及答案解析
- 水利工程材料取样检测指南
- 守护网络安全护航青春成长-高二年级网络安全主题班会课件
- 雨课堂学堂在线学堂云《当代中国社会与文化:大湾区文化景观(暨南)》单元测试考核答案
- 银行外汇汇款课件
评论
0/150
提交评论