4.2具体页面实现 4.2.1系统登录 copyright paper51.com 登录页面是一个必不可少的部分,但不是每个用户都要进入登录界面,病人对药品的查询不需要登录。门诊医生对药品的查询和每个对系统有操作的用户需要登陆进行身份的验证,以确保进入系统的人员和系统的安全,所以登录界面是系统的第一关卡:ID是验证用户的登陆名,password 和passwordcheck 是对密码的验证,并且根据选择的用户角色进入不同的操作页面,而这个登录框界面友好并且具有国际化的功能:以中文,英文,日文三国语言为操作平台,且操作简单。 copyright paper51.com paper51.com 图4-1登录 内容来自www.paper51.com 具体代码如下: 内容来自论文无忧网 www.paper51.com private void teacher_Button_Click(objectsender, System.EventArgs e) copyright paper51.com { http://www.paper51.com
if( Isbn_TextBox.Text==""||Book_TextBox.Text==""||Time_TextBox.Text==""||Author_TextBox.Text==""|| Depart_DropDownList.SelectedIndex==0 http://www.paper51.com
||Type_DropDownList.SelectedIndex==0|| Code_TextBox.Text==""||Class_TextBox.Text=="") 内容来自www.paper51.com { 内容来自www.paper51.com showMsg("选项不能为空!!"); 内容来自www.paper51.com return; copyright paper51.com
} copyright paper51.com DBhelper.DBhelperDBh = new DBhelper.DBhelper(); copyright paper51.com bool doctor=true; //默认进入角色 http://www.paper51.com stringinput=DropDownList1.SelectedValue; copyright paper51.com switch (input) //设置进入角色; http://www.paper51.com
{ paper51.com case "门诊医生": copyright paper51.com
doctor = true; 内容来自www.paper51.com break; http://www.paper51.com case "药房管理": http://www.paper51.com doctor = false; copyright paper51.com break; paper51.com
} http://www.paper51.com
string table="Administrator"; //判断进入角色所对应的页面 paper51.com if ((DBh.Validat(TextBox1.Text.Trim(),TextBox2.Text.Trim(), table)) && http://www.paper51.com doctor!= false) 内容来自论文无忧网 www.paper51.com { 内容来自www.paper51.com TextBox3.Text = "成功!请再点击提交进入修改页面"; copyright paper51.com this.Button2.PostBackUrl = "docSleWest.aspx"; 内容来自论文无忧网 www.paper51.com } 内容来自www.paper51.com
else if((DBh.Validat(TextBox1.Text.Trim(), TextBox2.Text.Trim(), table)) &&doctor != true) http://www.paper51.com { http://www.paper51.com TextBox3.Text = "成功!请再点击提交进入修改页面"; 内容来自论文无忧网 www.paper51.com this.Button2.PostBackUrl = "Add.aspx"; paper51.com
} 内容来自www.paper51.com else { 内容来自www.paper51.com TextBox3.Text = "请重新登陆"; http://www.paper51.com } 内容来自www.paper51.com 4.2.2门诊药品查询 paper51.com 门诊药品的查询分为病人药品查询和门诊医生的查询。而病人药品查询不需要登录,分类行查询页面,主要是由一个树型结构的药品分类,按照模糊到详细的类型层次排列,双击药品类型,右边的结果框中就会显示所对应的类型的药品,依次点开显示的药品就越来越少查询得就越来越细。一般的查询页面,由类型和药品名为查询的条件,进行模糊查询。分别以药品的拼音名和药品的生产厂商进行大范围的查询,病人查询到的药品信息只是药品的基本信息,主要以名称,用途,价格为主。医生的查询是详细查询和模糊查询相结合,不像病人查询模块中那么简便,需输入更多的信息,但是能查询到药品信息比较的全面,如药品的库存量等病人不能查看到的药品信息。也不能更细的以药品类型进行查询。查询如图4-2、4-3和4-4所示,主要代码分别如下: 内容来自www.paper51.com http://www.paper51.com 图4-2按药品种类查询 内容来自论文无忧网 www.paper51.com 主要代码: 内容来自www.paper51.com SELECT [medical_name],[pinyin_name], [kinds], [price], [company], [introduce] FROM [tb_medicine]WHERE ([kinds] = @kinds); copyright paper51.com
http://www.paper51.com 图4-3病人药品种类查询 http://www.paper51.com 药品的模糊查询: 内容来自www.paper51.com SELECT [medical_name],[pinyin_name], [kinds], [introduce], [quantity], [company], [guige] FROM[tb_medicine] WHERE (([kinds] = @kinds) AND ([medical_name] LIKE '%' +@medical_name + '%')) copyright paper51.com 初始化连接: 内容来自www.paper51.com DataTable dt = newDataTable(); paper51.com DataSet ds = new DataSet(); http://www.paper51.com DBhelper.DBhelper Db = newDBhelper.DBhelper(); paper51.com SqlConnection sqlcon = newSqlConnection(); 内容来自www.paper51.com string sql = "selectmedical_name,pinyin_name,kind,price,intrduce,company from tb_medicinewhere"; paper51.com string choose; copyright paper51.com
内容来自论文无忧网 www.paper51.com
图4-4门诊医生药品查询页面: paper51.com 代码如下: paper51.com
药品名称查询:SELECT [medical_name], [pinyin_name], [kinds], [price], [introduce],[quantity], [company] FROM [tb_medicine] WHERE ([medical_name] = @medical_name) http://www.paper51.com
药品拼音名字查询:SELECT[medical_name], [pinyin_name], [kinds], [price], [introduce], [company] FROM[tb_medicine] WHERE ([pinyin_name] = @pinyin_name) 内容来自www.paper51.com //分别用不同的文本框里的值,进行查询 http://www.paper51.com protected void Button2_Click(object sender, EventArgs e) http://www.paper51.com { paper51.com Label4.Visible = true; http://www.paper51.com if (TextBox1.Text != "") 内容来自论文无忧网 www.paper51.com { http://www.paper51.com GridView1.EnableViewState = true; 内容来自论文无忧网 www.paper51.com
GridView2.Visible = false; paper51.com GridView3.Visible = false; paper51.com GridView4.Visible = false; copyright paper51.com
} paper51.com else copyright paper51.com { 内容来自论文无忧网 www.paper51.com Label4.Text = "请输入查询信息"; http://www.paper51.com } copyright paper51.com } 内容来自论文无忧网 www.paper51.com protected voidGridView1_SelectedIndexChanged(object sender, EventArgs e) http://www.paper51.com { 内容来自www.paper51.com } paper51.com protected voidButton4_Click(object sender, EventArgs e) paper51.com
{ 内容来自www.paper51.com Label4.Visible = true; 内容来自www.paper51.com
if(TextBox2.Text != "") 内容来自论文无忧网 www.paper51.com
{ 内容来自论文无忧网 www.paper51.com
GridView1.Visible = false; 内容来自www.paper51.com
GridView3.Visible = true; 内容来自论文无忧网 www.paper51.com GridView2.Visible = false; paper51.com GridView4.Visible = false; paper51.com
GridView3.EnableViewState = true; paper51.com } 内容来自www.paper51.com
else{ copyright paper51.com Label4.Text = "请输入查询信息"; 内容来自论文无忧网 www.paper51.com } copyright paper51.com } copyright paper51.com SELECT * FROM [tb_medicine] WHERE([medical_name] = @medical_name); copyright paper51.com SELECT * FROM [tb_medicine] WHERE([pinyin_name] = @pinyin_name); paper51.com
SELECT * FROM [tb_medicine] WHERE([kinds] = @kinds); copyright paper51.com SELECT * FROM [tb_medicine] WHERE([company] = @company2); copyright paper51.com 4.2.3药房管理 内容来自论文无忧网 www.paper51.com 药房管理员操作页面是主要针对药房管理员对药品的添加,删除药品,并且能够看到药品数量少于警戒线报警,当上一次输入了警戒线的值就会更新到数据库,只要不更改警戒线的值就会在每次登录该页面时看见以上次设定的值为警戒线,显示少于该值的所有的药品信息。添加药品在对应的药品名称,药品拼音名,药品价格,数量,厂家等药品信息的筐内,添入信息,点击添加。药品删除只需要填写药品名称点击删除,成功,页面有提示,并且每一种药品所对应的项目如表所示,每一项都是必须填写的,存入数据库的药品资料才详细。药品的出入库为:药品出入库只需要填写药品名称,和药品的数量点击出入库就可以减去或添加药品的数量更新到数据库。管理员对药品类型的动态添加,输入药品新类型名和选择级别,点击添加,对应的表就能看到添加药品类型的信息。如下图4-5添加删除药品的页面。如图4-5和4-6等。 内容来自论文无忧网 www.paper51.com
paper51.com
图4-5系统管理员 copyright paper51.com
代码如下: paper51.com protectedvoid Button1_Click(objectsender, EventArgs e) paper51.com { copyright paper51.com GridView1.Visible = true; paper51.com
GridView2.Visible = false; copyright paper51.com DBhelper.DBhelper ms = new DBhelper.DBhelper(); 内容来自www.paper51.com string text=ListBox1.SelectedValue; 内容来自www.paper51.com int number = 0; copyright paper51.com switch(text){ http://www.paper51.com case "一级类型": http://www.paper51.com number =1; 内容来自www.paper51.com
break; copyright paper51.com
case"二级类型": 内容来自论文无忧网 www.paper51.com number=10+1; paper51.com break; 内容来自www.paper51.com case"三级类型": paper51.com number = 100 + 1; 内容来自www.paper51.com break; 内容来自www.paper51.com } 内容来自www.paper51.com
int number1 = Convert.ToInt32(number); paper51.com string mi = "INSERTINTO data110(kinds,number)VALUES('" + TextBox1.Text + "',"+number1+")"; http://www.paper51.com } paper51.com
protectedvoid Button2_Click(objectsender, EventArgs e) 内容来自www.paper51.com { http://www.paper51.com
DateTime dt =DateTime.Now; http://www.paper51.com
string datet = dt.ToString(); 内容来自www.paper51.com DBhelper.DBhelperms = new DBhelper.DBhelper(); 内容来自www.paper51.com string mm = "INSERTINTO databiao(daily,insertdate)VALUES('" + TextBox2.Text + "','" + datet + "')"; 内容来自论文无忧网 www.paper51.com if (ms.ExecuteSQL(mm)) paper51.com { 内容来自www.paper51.com // DataTable table1=new DataTable (); http://www.paper51.com } paper51.com
} 内容来自www.paper51.com
protectedvoid Button3_Click(objectsender, EventArgs e) paper51.com { http://www.paper51.com GridView2.Visible = true; paper51.com GridView1.Visible = false; paper51.com
} copyright paper51.com protectedvoid Button4_Click(objectsender, EventArgs e) paper51.com { copyright paper51.com DBhelper.DBhelper ms = new DBhelper.DBhelper(); 内容来自论文无忧网 www.paper51.com string mm = "selectquantity from tb_medicine where medical_name='" + TextBox5.Text + "'"; 内容来自www.paper51.com
if (ms.ExecuteSQL(mm)) paper51.com { copyright paper51.com long number = Convert.ToInt64(mm); 内容来自论文无忧网 www.paper51.com
long inputnumber = Convert.ToInt64(TextBox4.Text); paper51.com long newNumber = number - inputnumber; http://www.paper51.com
string newnum = newNumber.ToString(); http://www.paper51.com string sqlcommand = "insert into tb_medicine(quantity)values("+ newnum + ")"; copyright paper51.com // DataTable table1=new DataTable (); 内容来自论文无忧网 www.paper51.com } paper51.com
} copyright paper51.com
protectedvoid Button5_Click(objectsender, EventArgs e) http://www.paper51.com { 内容来自www.paper51.com DBhelper.DBhelper ms = new DBhelper.DBhelper(); 内容来自www.paper51.com string mm = "selectquantity from tb_medicine where medical_name= 内容来自www.paper51.com '" + TextBox5.Text + "'"; 内容来自论文无忧网 www.paper51.com
if (ms.ExecuteSQL(mm)) paper51.com
{ http://www.paper51.com long number = Convert.ToInt64(mm); 内容来自www.paper51.com long inputnumber = Convert.ToInt64(TextBox4.Text); 内容来自www.paper51.com long newNumber = number + inputnumber; http://www.paper51.com string newnum = newNumber.ToString(); 内容来自www.paper51.com string sqlcommand = "insert into tb_medicine(quantity)values("+ newnum + ")"; http://www.paper51.com
// DataTable table1=new DataTable (); copyright paper51.com } http://www.paper51.com } copyright paper51.com
内容来自论文无忧网 www.paper51.com
图4-6药品添加删除 copyright paper51.com |