教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 高等教育 >

医药销售管理系统01(2)

来源:网络收集 时间:2026-08-21
导读: SqlConnection conn =new SqlConnection(); conn.ConnectionString = 医药销售管理系统01 ConfigurationManager.ConnectionStrings[yyxsstring].ToString(); conn.Open(); SqlCommand cmd=new SqlCommand(); mandTe

SqlConnection conn =new SqlConnection(); conn.ConnectionString =

医药销售管理系统01

ConfigurationManager.ConnectionStrings["yyxsstring"].ToString(); conn.Open();

SqlCommand cmd=new SqlCommand();

mandText="select * from [yuangong] where 员工ID='"+TextBox1.Text+"'and 密码='"+TextBox2.Text+"'"; cmd.Connection=conn;

SqlDataReader sr=cmd.ExecuteReader(); if (sr.Read()) {

Session["user"] = this.TextBox1.Text; Session["password"] = this.TextBox2.Text; Session["us"] = sr.GetString(1).Trim(); Session["power"] = sr.GetString(6).Trim(); string power=Session ["power"].ToString (); if (power.Equals("admin")) {

Response.Redirect("mlogin.aspx"); }

else if (power.Equals("saler")) {

Response.Redirect("slogin.aspx"); } else {

Response.Redirect("alogin.aspx"); } } else {

Response.Write("<Script language='javascript'>alert('用户名或密码不正确!')</script>"); } }

protected void Button2_Click(object sender, EventArgs e) {

TextBox1.Text = ""; TextBox2.Text = ""; } }

医药销售管理系统01

4.2 员工添加和删除

1. 设计说明

本系统中,管理员有添加员工的权限。添加员工,首先要输入员工的ID号,员工的姓名,选择员工的工作类型,员工的联系方式及员工的性别等信息。为避免重复录入同一个员工的信息,造成数据库出错,该功能设计中最重要的一点是当管理员输入员工ID号的同时,系统会自动检测数据库中员工表中的记录,若存在匹配的员工ID号,则不允许管理员向数据库添加该员工的信息,并提示管理员检查待添加的员工的ID号。对于要删除的员工,选中所要删除的员工并确认之后,可直接删除。

2. 流程图

图4-2 添加员工流程图 图 4-3 删除员工流程图

医药销售管理系统01

3. 代码实现

添加员工信息,在输入员工的编号后,系统会自动检测员工是否存在: protected void Button1_Click(object sender, EventArgs e) {

SqlConnection conn = new SqlConnection(); conn.ConnectionString =

ConfigurationManager.ConnectionStrings["yyxsstring"].ToString(); conn.Open();

SqlCommand smd = new SqlCommand(); smd.Connection = conn;

mandText = "select * from yuangong where 员工ID='" + TextBox1.Text.Trim() + "'";

SqlDataReader sd = smd.ExecuteReader(); if (!sd.HasRows) {

sd.Close();

SqlCommand cmd = new SqlCommand(); cmd.Connection = conn;

mandText = "insert into yuangong(员工ID,员工姓名,员工性别,年龄,联系电话,密码,员工权限) values('" + TextBox1.Text.Trim() + "','" + TextBox2.Text.Trim() + "','" + TextBox3.Text.Trim() + "','" + TextBox4.Text.Trim() + "','" + TextBox5.Text.Trim() + "','" + TextBox6.Text.Trim() + "','" + TextBox7.Text.Trim() + "')"; cmd.ExecuteNonQuery();

Response.Write("<script>alert('操作成功!')</script>"); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; } else {

Response.Write("<script>alert('员工ID已存在')</script>"); }

conn.Close(); sd.Close(); }

医药销售管理系统01

4.3 销售登记和退货 1. 设计说明

对于每一次的销售交易,首先自动生成对应订单号,由销售员完成订单其他信息的输入。订单记录了交易信息,也是交易存在的证据,当然若客户在规定的时间范围内因某些原因而需要退货,我会记交易的更新操作进行撤消,回到交易前的状态。 2. 流程图

放弃登记

图4-4 销售登记流程图

医药销售管理系统01

放弃退货

图4-5 销售退货流程图

3. 代码实现

1. 销售登记实现代码:

protected void Button1_Click(object sender, EventArgs e) {

SqlConnection conn = new SqlConnection(); conn.ConnectionString =

ConfigurationManager.ConnectionStrings["yyxsstring"].ToString(); conn.Open();

SqlCommand cmd = new SqlCommand(); cmd.Connection = conn;

mandText = "insert into xiaoshou(客户ID,药品ID,销售量,销售时间,经手人) values('" + DropDownList1.Text + "','" +

DropDownList2.Text + "'," + float.Parse(TextBox3.Text) + ",'" +

DateTime.Now.ToString() + "','" +Session ["us"].ToString () + "')"; cmd.ExecuteNonQuery(); conn.Close();

医药销售管理系统01

Response.Write("<script>alert('操作成功!')</script>"); TextBox3.Text = "";

}

2.销售退货的实现代码:

public partial class xiaoshoutuihuo : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) {

}

protected void Button1_Click(object sender, EventArgs e) {

Button TuiHuo = (Button)sender;

string dingdan= mandArgument.ToString(); SqlConnection conn = new SqlConnection(); conn.ConnectionString =

ConfigurationManager.ConnectionStrings["yyxsstring"].ToString(); conn.Open();

SqlCommand cmd = new SqlCommand(); cmd.Connection = conn;

string sql1 = "select 药品ID from xiaoshou where 订单号='" + dingdan + "'";

mandText = sql1;

string YaoPinID = cmd.ExecuteScalar().ToString();

string sql2 = "select 销售量 from xiaoshou where 订单号='" + di …… 此处隐藏:2211字,全部文档内容请下载后查看。喜欢就下载吧 ……

医药销售管理系统01(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/126689.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)