汇报总结
小组成员:谢先意
田俊
李越男
龚建云
王超
2.3系统主界面的制作

新建步骤
1.新建一个form1 命名为用户登录。
2.添加2个Button控件,用于登录,退出显示按钮! 3.添加3个Textbox控件,用于用户输入登录名和密码! 4.添加1个Linklabel控件,用于超链接,显示忘记密码! 5.添加3个Label控件,用于显示用户名和密码! 6.调整各个控件的位置大小,并对其进行相关设置! 7.设置用户名和密码
主要代码
private void frm_Login_Load(objectsender, EventArgs e)
{
// 设置收银员为默认登录类型
this.cbb_UserType.SelectedIndex = 0;
// 禁止Tab键停留到LinkLabel上
this.ll_Register.TabStop = false;
this.ll_Forget.TabStop = false;
}
// 点击“登录”按钮则登录系统
private void bt_Login_Click(objectsender, EventArgs e)
{
// TODO
StringconnStr = "Data Source=.;Initial Catalog=SuperMarketSales;Integrated Security=True";
// String connStr = ConfigurationManager.ConnectionStrings["SuperMarketSales"].ConnectionString;
SqlConnectionsqlConn = new SqlConnection(connStr);
try
{
sqlConn.Open();
StringsqlStr = "";
if (this.cbb_UserType.Text == "收银员")
{
sqlStr = "select * from USERS where ID=@id and PASSWORD=@pwd";
}
else
{
sqlStr = "select * from ADMIN where ID=@id and PASSWORD=@pwd";
}
SqlCommandcmd = new SqlCommand(sqlStr, sqlConn);
cmd.Parameters.Add(new SqlParameter("@id", this.tb_User.Text.Trim()));
cmd.Parameters.Add(new SqlParameter("@pwd", this.tb_Password.Text.Trim()));
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
UserInfo.userId = dr["ID"].ToString();
UserInfo.userName = dr["NAME"].ToString();
UserInfo.userPwd = dr["PASSWORD"].ToString();
UserInfo.userPhone = dr["PHONE"].ToString();
UserInfo.userType = this.cbb_UserType.Text;
MessageBox.Show(UserInfo.userType + "登陆成功");
if (UserInfo.userType == "收银员")
{
//MessageBox.Show(UserInfo.userType + "登陆成功");
MainFormUserformUser = new MainFormUser();
formUser.Show();
this.Hide();
}
else if (UserInfo.userType == "库管员")
{
MainFormAdminformAdmin = new MainFormAdmin();
formAdmin.Show();
this.Hide();
}
2.4系统数据库设计
E-R图

所有的表的字段
收银员表 工号 Int 否 主键 姓名 Varchar(50) 是 密码 Varchar(50) 是 电话 Varchar(15) 是 库管员表 列名 数据类型 允许为空 备注 工号 Int 否 主键 姓名 Varchar(50) 是 密码 Varchar(50) 是 电话 Varchar(15) 是 商品表 列名 数据类型 允许为空 备注 商品号 Int 否 主键 价格 Varchar(50) 是 名称 Varchar(50) 是
供应商表 列名 数据类型 允许为空 备注 代码 Int 否 主键 名称 Varchar(50) 是 地点 Varchar(50) 是 联系人 Varchar(50) 是 电话 Varchar(15) 是

2.5登录用户验证功能设计
效果图

](https://upload-
描述画面主要功能,列出支持这些功能的后台数据库表结构

收银员、库管员登陆成功的显示状态,实现登录信息到数据库服务器上验证,显示数据库 SuperMarketSales中的收银员用户表和库管员用户表
ADO.NET查询数据库的流程


贴入重要代码片段,并进行详细描述


2.6密码修改界面功能设计
效果图



描述画面主要功能,并列出支持这些功能的后台数据库表结构

ADO.NET更新数据库的流程



1.连接数据库 String connStr = "Data Source=.;Initial Catalog=SuperMarketSales;Integrated Security=True"; SqlConnection sqlConn = new SqlConnection(connStr);
try
{
// 连接数据库
sqlConn.Open();
2.构造数据库并查询 String sqlStr = "update EMPLOYEE set PASSWORD=@pwd where ID=@id"; SqlCommand cmd = new SqlCommand(sqlStr, sqlConn);
// SQL字符串参数赋值
cmd.Parameters.Add(new SqlParameter("@pwd", newPwd));
cmd.Parameters.Add(new SqlParameter("@id", UserInfo.userId));
// 将命令发送给数据库
int res = cmd.ExecuteNonQuery();
3.根据返回值判断是否修改成功
if (res != 0)
{
MessageBox.Show("密码修改成功");
this.Close();
}
else
{
MessageBox.Show("密码修改错误");
}
}
catch (Exception exp)
{
MessageBox.Show("访问数据库错误:" + exp.ToString());
}
finally
{
sqlConn.Close();
}
}
2.7商品信息录入界面的功能设计
效果图

描述画面主要功能,并列出支持这些功能的后台数据库表结构
1.导入命名空间;
2.定义数据库连接字符串,创建Connection对象;
3.打开连接;
4.利用Command对象的ExecuteNonQuery()方法执行Insert语句;
5.通过ExecuteNonQuery()方法返回值判断是否修改成功,并在界面上提示;
6.关闭连接。
画面功能是如何迭代的,描述迭代过程(无外键****→****有外键)

描述画面主要功能,并列出支持这些功能的后台数据库表结构
1.导入命名空间;
2.定义数据库连接字符串,创建Connection对象;
3.打开连接;
4.利用Command对象的ExecuteNonQuery()方法执行Insert语句;
5.通过ExecuteNonQuery()方法返回值判断是否修改成功,并在界面上提示;
6.关闭连接。
ADO.NET插入数据库的流程
[图片上传失败...(image-9a98f2-1543932860071)]
画面功能是如何迭代的,描述迭代过程(无外键****→****有外键)
[图片上传失败...(image-4d1269-1543932860071)]
DataGridView数据绑定流程。
给DataGridView控件取个Name名称
将要绑定的数据列表赋值给DataGridView的DataSource属性
贴入重要代码片段,并进行详细描述
[图片上传失败...(image-e7b78c-1543932860071)]
2.9系统程序的部署
效果图


打包流程
1.项目右键单击选择属性

2.在应用程序里面选择.ico的图标,单击程序集信息设置关于信息

3.单击发布,选择合适的磁盘发布项目

4.电极setup安装软件,点击“智慧商超管理系统”打开软件

� `���-�v�
网友评论