当前位置:文档之家› 报纸发行员投递管理系统

报纸发行员投递管理系统

报纸发行员投递管理系统报纸的客户主要集中在社区,每个社区有若干客户。

每个发行员管理若干客户。

为该报社开发一个报纸发行员投递管理系统。

系统主要功能如下:(1) 系统用户管理:实现系统管理员添加、删除和更改密码等功能。

(2) 发行员管理:实现发行员个人信息的查询和维护。

(3) 客户信息管理:实现客户信息的查询和维护。

(4) 报纸管理:报纸订购和退订信息的维护和查询(5) 管理统计:发行员负责区域的安排,客户数量和订购信息的统计。

一、报纸发行员投递管理系统的分析和概要设计(1)系统模块菜单:1 系统用户管理实现系统管理员添加删除以及密码更改功能2 发行员管理实现发行员个人信息的维护对发行员进行查询3 客户信息管理实现客户信息的维护对客户进行查询4 报纸管理报纸订购和退订信息的维护报纸订购和退订信息的查询5 管理统计发行员负责区域的安排客户数量和订购信息的统计(2)报纸发行员投递管理系统功能描述1 系统用户管理:对系统管理员添加,删除,更新及查询;2 发行员管理:实现对每个发行员添加,删除,更新及查询3 客户信息管理:实现对每个客户信息添加,删除,更新及查询4 报纸管理:报纸订购与退订,及报纸信息的添加,删除,更新及查询5 管理统计:发行员负责的区域的更新,客户数量的统计,订购信息的统计二、系统数据结构设计用户需求具体有报刊发行员管理系统提供保存、更新、查询、维护,这就需求数据库结构能充分满足各种信息的输入与输出,实现有组织地、动态地存储大量关联数据,方便用户访问系统中的数据。

1.数据流图描述:本系统从总体上分为系统系统用户管理、发行员管理、客户管理、报纸管理和统计功能。

信息流入图2.数据库中的表有关创建数据库和关系表的SQL 语句如下所示:/*==============================================================*//* DataBase: 报纸发行员投递管理系统, 创建数据库,数据库名称为报纸发行员投递管理系统*/ /*==============================================================*/ create database 报纸发行员投递管理系统 go/*==============================================================*/ /* Table: paper, 报纸信息表 */报纸发行员管理人员客户信息录入系统用户信息录入 发行员信息录入 报纸信息录入数据库客户信息表系统用户信息表发行员信息表报纸信息表报纸发行员投递管理人员查询条件查询结果系统管理员信息录入发行员信息录入 客户信息录入 报纸订购信息录入 系统用户信息管理表发行员信息管理表客户信息管理表报纸管理表/*==============================================================*/ create table paper (paper nchar(10), /*报纸名*/)go/*==============================================================*/ /* Table: CustomerInfo, 客户个人信息表 *//*==============================================================*/ create table CustomerInfo (name1 nchar(10), /*客户姓名*/sex nchar(10) , /*客户性别*/telephone nchar(20), /*客户电话*/site nchar(10), /*客户住址*/distributor nchar(10), /*客户发行员*/)go/*==============================================================*/ /* Table: CustomerOrder,客户订购信息表 *//*==============================================================*/ create table CustomerOrder(name1 nchar(10), /*客户姓名*/sex nchar(10) , /*客户性别*/telephone nchar(20), /*客户电话*/site nchar(10), /*客户住址*/distributor nchar(10), /*客户发行员*/date datetime /*订购时间*/)go/*==============================================================*/ /* Table: CustomerCancle,客户退订信息表*//*==============================================================*/ create table CustomerCancle(name1 nchar(10), /*客户姓名*/sex nchar(10) , /*客户性别*/telephone nchar(20), /*客户电话*/site nchar(10), /*客户住址*/distributor nchar(10), /*客户发行员*/date datetime /*退订时间*/)Go3.ER 图1. 系统管理员查询2. 添加系统用户3. 删除系统用户编号人员用户名账户密码权限查询系统管理员记录集名字电话 Email 身份证权限用户名权限系统管理员账户编号用户名密码权限添加系统管理员账号用户名身份证编号 名字电话 密码权限用户名Email身份证4. 更新系统用户5. 发行员查询系统用户编号 用户名 账户密码权限删除系统用户账户身份证编号名字电话权限密码Email用户名用户名用户名系统用户编号用户名账号密码权限更新系统用户 账号身份证名字电话Email密码权限用户名6.发行员添加信息7.发行员信息删除人员编号 权限查询发行员社区姓名电话Email身份证账户用户名账户 密码权限系统发行员编号用户名添加发行员账户社区姓名电话Email身份证用户名密码权限用户名8.发行员信息更新9. 客户信息查询系统管理员用户名编号删除发行员账户社区·姓名 电话 身份证 Email用户名权限密码用户名系统管理员编号用户名更新发行员权限社区姓名电话 Qq Email账户密码 权限账户密码权限社区 编号社区10.客户信息添加11.客户信息删除系统管理员编号用户名查询客户社区姓名 电话 Email 地址社区编号社区订购表订购日期截止日期系统管理员用户名编号添加客户社区身份证姓名 Email 电话地址社区社区编号编号12.客户信息更新系统管理员 用户名社区编号社区更新客户社区身份证 姓名 电话 Email 地址订购表订购日期 截止日期编号系统管理员 用户名 编号 删除客户社区身份证 姓名 电话 Email地址社区编号 社区编号订购表编号Client_idWorker_id订购日期截止日期13.报纸订购与退订的查询14.报纸订购添加15.报纸退订删除发行员编号用户名社区订购查询退订查询客户 订购表 姓名电话Email社区地址订购日期截止日期发行员姓名系统管理员用户名添加客户编号姓名电话Email身份证社区地址订购表编号客户编号发行员编号订购日期截止日期编号16.报纸订购与退订更新17.统计管理系统管理员编号用户名 删除客户编号姓名Email电话身份证订购表编号客户编号发行员编号订购日期截止日期Asp 事务处理社区地址系统管理员编号用户名更新客户姓名身份证电话Email社区地址订购表发行员编号订购日期截止日期订购判断三、应用系统设计登录界面:登录按钮点击事件代码:private void btnLogin_Click(object sender, EventArgs e) { try {if (txtUserName.Text == "") //判断用户是否输入登录名{MessageBox .Show("用户名不能为空"); } elseif (txtPwd.Text == "") //判断用户是否输入密码{MessageBox .Show("密码不能为空"); } elseif (cmbLogin.Text == "") //判断用户是否选择用户界面{系统管理员编号 用户名区域安排 发行员编号姓名社区客户统计客户社区数量 总数量订购统计订购表社区统计 订购日期MessageBox.Show("请选择登录界面");cmbLogin.Focus();return;}else{if (cmbLogin.Text == "客户"){SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open(); //打开连接SqlCommand cmd = new SqlCommand("select count(*)from Users where name1='" + txtUserName.Text + "' and pwd1='" + txtPwd.Text + "'and permission='"+cmbLogin.Text+"'", con);Int32 count = (Int32)cmd.ExecuteScalar(); //获取返回值if (count==1){frmMain1 main = new frmMain1();main.Show(); //弹出客户登陆界面Login_name = txtUserName.Text;this.Hide(); //隐藏登陆界面}else{MessageBox.Show("用户名或者密码错误"); //弹出提示}con.Close();}if (cmbLogin.Text == "发行员"){SqlConnection con = PaperCon.createCon(); //创建数据库连接 con.Open(); //打开连接SqlCommand cmd = new SqlCommand("select count(*)from Users where name1='"+ txtUserName.Text + "' and pwd1='"+ txtPwd.Text + "'and permission='"+ cmbLogin.Text + "'", con);Int32 count = (Int32)cmd.ExecuteScalar(); //获取返回值if (count==1){frmMain2 main = new frmMain2();main.Show();Login_name = txtUserName.Text; //记录登陆用户名this.Hide();}else{MessageBox.Show("用户名或者密码错误"); //弹出提示}con.Close();}if (cmbLogin.Text == "系统用户"){SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open(); //打开连接SqlCommand cmd = new SqlCommand("select count(*)from Users where name1='"+ txtUserName.Text + "' and pwd1='"+ txtPwd.Text + "'and permission='"+ cmbLogin.Text + "'", con);Int32 count = (Int32)cmd.ExecuteScalar(); //获取返回值if (count==1){frmMain3 main = new frmMain3();main.Show();Login_name = txtUserName.Text;this.Hide();}else{MessageBox.Show("用户名或者密码错误"); //弹出提示}con.Close(); //关闭连接}}}catch (Exception ex){MessageBox.Show(ex.ToString()); //获取异常}}客户界面:报纸订购事件程序:private void button1_Click(object sender, EventArgs e){try{if (textBox1.Text == ""){MessageBox.Show("请输入要订购的报纸名");}else{SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();SqlCommand cmd1 = new SqlCommand("select count(*)from Allpaper where paper='"+ textBox1.Text + "'", con);Int32 count1 = (Int32)cmd1.ExecuteScalar();SqlCommand cmd4 = new SqlCommand("select count(*)from CustomerOrder where name1='" + label8.Text + "' and paper='" + textBox1.Text + "'", con);Int32 count4 = (Int32)cmd4.ExecuteScalar();if (count4 > 0) //判断用户是否订购了该报纸{MessageBox.Show("您¨已经订购了该报纸!!!");}if (count1 == 0) //判断是否有该报纸名{MessageBox.Show("没有该报纸名,订购失败!!!");}else if ( count1 > 0 && count4==0){string strSql = "insert into CustomerOrder(name1,sex,paper,telephone,site,date) values('" + label8.Text.ToString() + "','" +label9.Text.ToString() + "','" + textBox1.Text.ToString() + "','" + label11.Text.ToString() + "','" + label12.Text.ToString() + "','" + DateTime.Now.ToString() + "')";SqlCommand cmd = new SqlCommand(strSql, con);cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命令MessageBox.Show("订购成功!!!");string strSql1 = " update CustomerOrder set distributorname=(select distributorname from CustomerInfo where name1='" + label8.Text.ToString() + "')where name1='" + label8.Text.ToString() + "'";SqlCommand cmd3 = new SqlCommand(strSql1, con);cmd3.ExecuteNonQuery();// 执行SQL语句完成SQL命令con.Close();}}}catch (Exception ex){MessageBox.Show(ex.ToString());}}private void Paperorder_Load(object sender, EventArgs e){label8.Text=frmLogin.Login_name;SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();string str1="select sex from CustomerInfo where name1='"+frmLogin.Login_name+"'";SqlCommand cmd1 = new SqlCommand(str1, con);string sex = (string)cmd1.ExecuteScalar();label9.Text = sex.ToString();string str2 = "select telephone from CustomerInfo where name1='" + frmLogin.Login_name + "'";SqlCommand cmd2 = new SqlCommand(str2, con);string telephone = (string)cmd2.ExecuteScalar();label11.Text = telephone.ToString();string str3 = "select site from CustomerInfo where name1='" + frmLogin.Login_name + "'";SqlCommand cmd3 = new SqlCommand(str3, con);string site = (string)cmd3.ExecuteScalar();label12.Text = site.ToString();label13.Text = DateTime.Now.ToString();con.Close();}报纸退订事件程序:private void button1_Click(object sender, EventArgs e){try{if (textBox3.Text == ""){MessageBox.Show("报纸名不能为空");}else{SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();SqlCommand cmd1 = new SqlCommand("select count(*)from CustomerOrder where name1='" + label8.Text + "'and paper='" + textBox3.Text + "'", con);Int32 count = (Int32)cmd1.ExecuteScalar();if ( count > 0){string strSql = "DELETE FROM CustomerOrder where name1='" +label8.Text.ToString() + "'and paper='" + textBox3.Text.ToString() + "'";SqlCommand cmd = new SqlCommand(strSql, con);cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命令MessageBox.Show("退订成功!!!");string strSql1 = "insert into CustomerCancle(name1,sex,paper,telephone,site,date) values('" + label8.Text.ToString() + "','" +label9.Text.ToString() + "','" + textBox3.Text.ToString() + "','" + label10.Text.ToString() + "','" + label11.Text.ToString() + "','" + DateTime.Now.ToString() + "')";SqlCommand cmd3 = new SqlCommand(strSql1, con);cmd3.ExecuteNonQuery();// 执行SQL语句完成SQL命令con.Close();}else if (count == 0) //判断是否有该订购记录{MessageBox.Show("您没有订购该报纸,操作失败!!!");}}}catch (Exception ex){MessageBox.Show(ex.ToString());}}private void PaperCancle_Load(object sender, EventArgs e){label8.Text = frmLogin.Login_name;SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();string str1 = "select sex from CustomerInfo where name1='" + frmLogin.Login_name + "'";SqlCommand cmd1 = new SqlCommand(str1, con);string sex = (string)cmd1.ExecuteScalar();label9.Text = sex.ToString();string str2 = "select telephone from CustomerInfo where name1='" + frmLogin.Login_name + "'";SqlCommand cmd2 = new SqlCommand(str2, con);string telephone = (string)cmd2.ExecuteScalar();label10.Text = telephone.ToString();string str3 = "select site from CustomerInfo where name1='" + frmLogin.Login_name + "'";SqlCommand cmd3 = new SqlCommand(str3, con);string site = (string)cmd3.ExecuteScalar();label11.Text = site.ToString();label12.Text = DateTime.Now.ToString();con.Close();}发行员界面:我的客户点击事件程序:private void我的客户¡ìToolStripMenuItem_Click(object sender, EventArgs e){SqlConnection con = PaperCon.createCon(); //创建数据库连接¨ con.Open();string commandString = "Select * from CustomerInfo where distributorname='" + frmLogin.Login_name + "'"; //获取该发行员的客户信息SqlDataAdapter DataAdapter = new SqlDataAdapter(commandString, con);DataSet DataSet = new DataSet();DataAdapter.Fill(DataSet, "CustomerInfo");DataTable dataTable = DataSet.Tables[0];dataGridView1.DataSource = dataTable;con.Close();}删除退订点击事件程序:private void删¦除ToolStripMenuItem_Click(object sender, EventArgs e){if (MessageBox.Show("确定删¦除所选记录吗", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK){SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();string sql = "delete from CustomerCancle where paper='" +dataGridView1.CurrentRow.Cells["paper"].FormattedValue.ToString() + "' "; //删除该条退订记录SqlCommand cmd = new SqlCommand(sql, con);cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命dataGridView1.Rows.Remove(dataGridView1.CurrentRow);con.Close();}}订购数量点击事件程序:private void订购数量ToolStripMenuItem_Click(object sender, EventArgs e){show2(); //调用show2()}private void show2(){SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();string strSql = "Select * from CustomerOrder where distributorname='"+ frmLogin.Login_name + "'";SqlCommand cmd = new SqlCommand(strSql, con);cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命令int count = 0;SqlDataReader reader = cmd.ExecuteReader();while (reader.Read()){count++;Console.WriteLine(String.Format("{0}", reader[0]));}MessageBox.Show("我的客户订购数量为:"+count.ToString());con.Close();}系统用户界面:增加报纸点击事件程序:private void button1_Click(object sender, EventArgs e){if (textBox1.Text == "") {MessageBox.Show("报纸名不能为空");}else{try{SqlConnection con = PaperCon.createCon(); //创建数据库连接 con.Open();SqlCommand cmd = new SqlCommand("insert into Allpaper (paper) values('" + textBox1.Text.ToString() + "')", con); //向表中插入该报纸名cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命令con.Close();MessageBox.Show("添加成功");}catch (Exception ex){MessageBox.Show("该报纸名已存在 ! ! !");}}}添加客户点击事件代码:private void button1_Click(object sender, EventArgs e){if (textBox1.Text == ""){MessageBox.Show("用户名不能为空");}else if (textBox2.Text == ""){MessageBox.Show("密码不能为空");}else{SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();SqlCommand cmd2 = new SqlCommand("select count(*)from Users where name1='" + textBox1.Text.ToString() + "'", con);Int32 count = (Int32)cmd2.ExecuteScalar();if (count == 1) //判断是否有该用户{MessageBox.Show("该用户已经存在");}else{string strSql = "insert into Users(name1,pwd1,permission) values('" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','客户')"; //向用户表中插入该客户SqlCommand cmd = new SqlCommand(strSql, con);cmd.ExecuteNonQuery();// 执行SQL语句完成SQL命令string strSql1 = "insert into CustomerInfo(name1) values('" +textBox1.Text.ToString() + "')"; //向客户信息表中插入该客户SqlCommand cmd1 = new SqlCommand(strSql1, con);cmd1.ExecuteNonQuery();// 执行SQL语句完成SQL命令MessageBox.Show("添加成功!!!");con.Close();}}}private void button1_Click(object sender, EventArgs e){try{if (textBox1.Text == ""){MessageBox.Show("客户姓名不能为空");}else if (textBox2.Text == ""){MessageBox.Show("发行员不能为空");}else{SqlConnection con = PaperCon.createCon(); //创建数据库连接 con.Open();SqlCommand cmd1 = new SqlCommand("select count(*)from Users where name1='" + textBox1.Text + "'and permission='客¨ª户¡ì'", con);Int32 count1 = (Int32)cmd1.ExecuteScalar(); //判断是否有该客户SqlCommand cmd2 = new SqlCommand("select count(*)from Users where name1='" + textBox2.Text + "' and permission='发¤¡é行D员¡À'", con);Int32 count2 = (Int32)cmd2.ExecuteScalar(); //判断是否有该发行员if (count1==0){MessageBox.Show("没有该客户!!!");}else if (count2 == 0){MessageBox.Show("没有该发行员!!!");}else{string strSql3 = " update CustomerInfo set distributorname='" + textBox2.Text.ToString() + "'where name1='" + textBox1.Text.ToString() + "'";SqlCommand cmd3 = new SqlCommand(strSql3, con);cmd3.ExecuteNonQuery();// 执行SQL语句完成SQL命令string strSql4 = " update CustomerOrder set distributorname='" + textBox2.Text.ToString() + "'where name1='" + textBox1.Text.ToString() + "'";SqlCommand cmd4 = new SqlCommand(strSql4, con);cmd4.ExecuteNonQuery();// 执行SQL语句完成SQL命令con.Close();MessageBox.Show("分配成功!!!");}}}catch (Exception ex){MessageBox.Show(ex.ToString());}}更改密码点击事件程序:private void button1_Click(object sender, EventArgs e){if (textBox3.Text == "") //判断用户是否输入了用户名 {MessageBox.Show("用户名不能为空");}else{if (textBox1.Text == ""){MessageBox.Show("原密码不能为空"); //判断用户是否输入了密码}else if (textBox2.Text == ""){MessageBox.Show("新密码不能为空");}else{SqlConnection con = PaperCon.createCon(); //创建数据库连接con.Open();SqlCommand cmd2 = new SqlCommand("select count(*) from Users where name1='" + textBox3.Text.ToString() + "' and pwd1='" + textBox1.Text.ToString() + "'", con);Int32 count2 = (Int32)cmd2.ExecuteScalar();if (count2 > 0){string strSql1 = "update users set pwd1='" + textBox2.Text.ToString() + "' where pwd1='" + textBox1.Text.ToString() + "' ";SqlCommand cmd1 = new SqlCommand(strSql1, con);cmd1.ExecuteNonQuery();// 执行SQL语句完成SQL命令con.Close();MessageBox.Show("修改成功!!!");}if (count2 == 0){MessageBox.Show("用户名或密码错误!!!");}con.Close();}}}。

相关主题