《(店铺管理)超市管理系统代码_》由会员分享,可在线阅读,更多相关《(店铺管理)超市管理系统代码_(18页珍藏版)》请在金锄头文库上搜索。
1、(店铺管理)超市管理系统代码usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespace超市管理信息系统publicpartialclassf_供应商基本信息:Form/公有变量记录选定数据publicstringstrOldNO=;publicstringstrOldName=;publicstringstrOldAdd=;public
2、f_供应商基本信息()InitializeComponent();privatevoidf_供应商基本信息_Load(objectsender,EventArgse)/TODO:这行代码将数据加载到表“连锁超市管理信息数据库DataSet.供应商”中。您能够根据需要移动或移除它。this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);/新增数据单击事件privatevoidbtnInsert_Click(objectsender,EventArgse)/获取前台数据stringstrName=txtName.Text;stringstrAd
3、d=txtAdd.Text;stringstrNO=txtNO.Text;intiNO=0;intiErrCode=0;/对前台编号数据的格式审核tryiNO=Convert.ToInt32(txtNO.Text.Trim();catch(ExceptioneINO)iErrCode=1;/对前台名称数据的格式审核if(strName.Length20)iErrCode=2;if(strAdd.Length30)iErrCode=3;if(iErrCode!=0)MessageBox.Show(你所输入的数据有误,请核查!);elsetry/新增写入数据库this.供应商TableAdapte
4、r.Insert(iNO,strName,strAdd);catch(ExceptionexInsert)MessageBox.Show(新增数据发生错误,请和管理员联系!);/刷新数据列数this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);/单击数据表单元格触发事件privatevoiddataGridView1_CellClick(objectsender,DataGridViewCellEventArgse)/获取对应行的各个单元格数据stringstrNO=this.dataGridView1.Rowse.RowIndex.Ce
5、lls0.Value.ToString();stringstrName=this.dataGridView1.Rowse.RowIndex.Cells1.Value.ToString();stringstrAdd=this.dataGridView1.Rowse.RowIndex.Cells2.Value.ToString();/填充回对应的文本框txtNO.Text=strNO;txtName.Text=strName;txtAdd.Text=strAdd;/将原数据值赋予公有变量strOldNO=strNO;strOldName=strName;strOldAdd=strAdd;/删除按钮
6、事件privatevoidbtnDelete_Click(objectsender,EventArgse)/获取前台数据stringstrName=txtName.Text;stringstrAdd=txtAdd.Text;stringstrNO=txtNO.Text;intiNO=0;intiErrCode=0;/对前台编号数据的格式审核tryiNO=Convert.ToInt32(txtNO.Text.Trim();catch(ExceptioneINO)iErrCode=1;/对前台名称数据的格式审核if(strName.Length20)iErrCode=2;if(strAdd.Len
7、gth30)iErrCode=3;if(iErrCode!=0)MessageBox.Show(你所输入的数据有误,请核查!);elsetry/新增写入数据库this.供应商TableAdapter.Delete(iNO,strName,strAdd);catch(ExceptionexInsert)MessageBox.Show(删除数据发生错误,请和管理员联系!);/刷新数据列数this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);/修改按钮事件privatevoidbtnUpdate_Click(objectsender,Event
8、Argse)/获取前台数据stringstrName=txtName.Text;stringstrAdd=txtAdd.Text;stringstrNO=txtNO.Text;intiNO=0;intiErrCode=0;/对前台编号数据的格式审核tryiNO=Convert.ToInt32(txtNO.Text.Trim();catch(ExceptioneINO)iErrCode=1;/对前台名称数据的格式审核if(strName.Length20)iErrCode=2;if(strAdd.Length30)iErrCode=3;if(iErrCode!=0)MessageBox.Show
9、(你所输入的数据有误,请核查!);elsetrythis.供应商TableAdapter.Update(iNO,strName,strAdd,Convert.ToInt32(strOldNO),strOldName,strOldAdd);catch(ExceptionexUpdate)MessageBox.Show(修改数据发生错误,请和管理员联系!);/刷新数据列数this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);usingSystem;usingSystem.Collections.Generic;usingSystem.Comp
10、onentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespace超市管理信息系统publicpartialclassf_供应商基本信息:Form/公有变量记录选定数据publicstringstrOldNO=;publicstringstrOldName=;publicstringstrOldAdd=;publicf_供应商基本信息()InitializeComponent();privatevoidf_供应商基本信息_Load(objectsender,Ev
11、entArgse)/TODO:这行代码将数据加载到表“连锁超市管理信息数据库DataSet.供应商”中。您能够根据需要移动或移除它。this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);/新增数据单击事件privatevoidbtnInsert_Click(objectsender,EventArgse)/获取前台数据stringstrName=txtName.Text;stringstrAdd=txtAdd.Text;stringstrNO=txtNO.Text;intiNO=0;intiErrCode=0;/对前台编号数据的格式审核t
12、ryiNO=Convert.ToInt32(txtNO.Text.Trim();catch(ExceptioneINO)iErrCode=1;/对前台名称数据的格式审核if(strName.Length20)iErrCode=2;if(strAdd.Length30)iErrCode=3;if(iErrCode!=0)MessageBox.Show(你所输入的数据有误,请核查!);elsetry/新增写入数据库this.供应商TableAdapter.Insert(iNO,strName,strAdd);catch(ExceptionexInsert)MessageBox.Show(新增数据发
13、生错误,请和管理员联系!);/刷新数据列数this.供应商TableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);/单击数据表单元格触发事件privatevoiddataGridView1_CellClick(objectsender,DataGridViewCellEventArgse)/获取对应行的各个单元格数据stringstrNO=this.dataGridView1.Rowse.RowIndex.Cells0.Value.ToString();stringstrName=this.dataGridView1.Rowse.RowIndex.Cell
14、s1.Value.ToString();stringstrAdd=this.dataGridView1.Rowse.RowIndex.Cells2.Value.ToString();/填充回对应的文本框txtNO.Text=strNO;txtName.Text=strName;txtAdd.Text=strAdd;/将原数据值赋予公有变量strOldNO=strNO;strOldName=strName;strOldAdd=strAdd;/删除按钮事件privatevoidbtnDelete_Click(objectsender,EventArgse)/获取前台数据stringstrName=txtName.Text;stringstrAdd=txtAdd.Text;stringstrNO=txtNO.Tex