(店铺管理)超市管理系统代码最全版
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
(店铺管理)超市管理系统
代码
usingSystem;
usingSystem.Collections.Generic;
ponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.T ext;
usingSystem.Windows.Forms;
namespace超市管理信息系统
{
publicpartialclassf_供应商基本信息:Form
{
//公有变量记录选定数据
publicstringstrOldNO="";
publicstringstrOldName="";
publicstringstrOldAdd="";
publicf_供应商基本信息()
{
InitializeComponent();
}
privatevoidf_供应商基本信息_Load(objectsender,EventArgse)
{
//TODO:这行代码将数据加载到表“连锁超市管理信息数据库DataSet.供应商”中。您能够根据需要移动或移除它。
this.供应商T ableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商); }
//新增数据单击事件
privatevoidbtnInsert_Click(objectsender,EventArgse)
{
//获取前台数据
stringstrName=txtName.T ext;
stringstrAdd=txtAdd.T ext;
stringstrNO=txtNO.T ext;
intiNO=0;
intiErrCode=0;
//对前台编号数据的格式审核
try
{
iNO=Convert.ToInt32(txtNO.T ext.Trim());
}
catch(ExceptioneINO)
{
iErrCode=1;
}
//对前台名称数据的格式审核
if(strName.Length>20)
iErrCode=2;
}
if(strAdd.Length>30)
{
iErrCode=3;
}
if(iErrCode!=0)
{
MessageBox.Show("你所输入的数据有误,请核查!");
}
else
{
try
{
//新增写入数据库
this.供应商T ableAdapter.Insert(iNO,strName,strAdd);
}
catch(ExceptionexInsert)
{
MessageBox.Show("新增数据发生错误,请和管理员联系!"); }
//刷新数据列数
this.供应商T ableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商);
}
//单击数据表单元格触发事件
privatevoiddataGridView1_CellClick(objectsender,DataGridViewCellEventArgse) {
//获取对应行的各个单元格数据
stringstrNO=this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); stringstrName=this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); stringstrAdd=this.dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); //填充回对应的文本框
txtNO.T ext=strNO;
txtName.T ext=strName;
txtAdd.T ext=strAdd;
//将原数据值赋予公有变量
strOldNO=strNO;
strOldName=strName;
strOldAdd=strAdd;
}
//删除按钮事件
privatevoidbtnDelete_Click(objectsender,EventArgse)
//获取前台数据
stringstrName=txtName.T ext; stringstrAdd=txtAdd.T ext; stringstrNO=txtNO.T ext;
intiNO=0;
intiErrCode=0;
//对前台编号数据的格式审核
try
{
iNO=Convert.ToInt32(txtNO.T ext.Trim()); }
catch(ExceptioneINO)
{
iErrCode=1;
}
//对前台名称数据的格式审核
if(strName.Length>20)
{
iErrCode=2;
}
if(strAdd.Length>30)
iErrCode=3;
}
if(iErrCode!=0)
{
MessageBox.Show("你所输入的数据有误,请核查!");
}
else
{
try
{
//新增写入数据库
this.供应商T ableAdapter.Delete(iNO,strName,strAdd);
}
catch(ExceptionexInsert)
{
MessageBox.Show("删除数据发生错误,请和管理员联系!");
}
}
//刷新数据列数
this.供应商T ableAdapter.Fill(this.连锁超市管理信息数据库DataSet.供应商); }