版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、实训九 员工信息管理实训目的:实训内容:实训过程:员工信息管理界面制作(worker.aspx)全部静态代码如下:无标题页员工信息员工信息添加/修改/查询编号:姓名:密码:性别:男女权限:销售员进货员管理员电话:身份证号:工资:住址:asp:LinkButtonID=LinkButton1runat=serverCommandArgument=CommandName=xiugai修改asp:LinkButtonID=LinkButton2runat=serverCommandArgument=CommandName=del删除编写动态代码(worker.aspx.cs)using System
2、;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.Ol
3、eDb;publicpartialclassgongyingshang : System.Web.UI.PageDBfunction db = newDBfunction();protectedvoid Page_Load(object sender, EventArgs e) db.isLogin();if (!IsPostBack) binddata(); void binddata() GridView1.DataSource = db.getDataView(select * from yuangong); GridView1.DataBind(); protectedvoid But
4、ton1_Click(object sender, EventArgs e) string sqlcheck = ;string sql = ;if (Sessionquanxian = null | Sessionquanxian.ToString() != 0) ScriptManager.RegisterStartupScript(this, GetType(), , alert(对不起,您的权限不够!), true);return; else if (TextBox1.Text.Trim().Length 0 & TextBox2.Text.Trim().Length 0 & Text
5、Box3.Text.Trim().Length 0 & TextBox6.Text.Trim().Length 0) if (Button1.Text = 添加) sql = insert into yuangong(bianhao,username,passwd,quanxian,xinbie,tel,address,sfz,gongzi) values( + TextBox1.Text.Trim() + ,; sql += TextBox2.Text.Trim() +, + TextBox3.Text .Trim()+ , + DropDownList1.SelectedValue + ,
6、 + RadioButtonList1.SelectedValue + ,; sql += TextBox5.Text.Trim() + , + TextBox8.Text.Trim() + ,+TextBox6.Text.Trim() + , + TextBox7.Text.Trim()+); sqlcheck = select * from yuangong where bianhao= + TextBox1.Text.Trim() + and sfz= + TextBox6.Text.Trim() + ; else sql = UPDATE yuangong SET bianhao= +
7、 TextBox1.Text.Trim() + ,username= + TextBox2.Text.Trim(); sql+=,passwd=+TextBox3.Text.Trim ()+,quanxian=+DropDownList1.SelectedValue+,xinbie=; sql+=RadioButtonList1.SelectedValue+,tel=+TextBox5.Text.Trim()+,address=+TextBox8.Text.Trim();sql+=,sfz=+TextBox6.Text.Trim()+,gongzi=+TextBox7.Text.Trim()+
8、; sql += where id= + ViewStateid.ToString(); sqlcheck = select * from (select * from yuangong where id + ViewStateid.ToString() + as t1) where bianhao= + TextBox1.Text.Trim() + and sfz= + TextBox6.Text.Trim() + ; if (!db.isExist(sqlcheck) db.sqlExecute(sql); Button1.Text = 添加; binddata(); TextBox1.T
9、ext = ; TextBox2.Text = ; TextBox3.Text = ; TextBox5.Text = ; TextBox6.Text = ; TextBox7.Text = ; TextBox8.Text = ; TextBox1.Focus(); else ScriptManager.RegisterStartupScript(this, GetType(), , alert(该记录已经存在!), true); else ScriptManager.RegisterStartupScript(this, GetType(), , alert(员工编号、姓名、密码、身份证号不
10、能为空), true); protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e) int id;DataRow dr;if (Sessionquanxian = null | Sessionquanxian.ToString() != 0) ScriptManager.RegisterStartupScript(this, GetType(), , alert(对不起,您的权限不够!), true);return; else if (e.CommandName = xiugai) id = in
11、t.Parse(e.CommandArgument.ToString(); ViewStateid = id; dr = db.getDataRow(select * from yuangong where id= + id); TextBox1.Text = drbianhao.ToString(); TextBox2.Text = drusername.ToString(); TextBox3.Text = drpasswd.ToString(); TextBox5.Text = drtel.ToString(); TextBox6.Text = drsfz.ToString(); TextBox7.Text = drgongzi.ToString(); TextBox8.Text = draddress.ToString(); RadioButtonList1.SelectedValue = drxinbie.ToString(); DropDownList1.SelectedValue = drquanxian.ToString(); Button1.Text = 保存; else db.sqlExecute(delete from yuangong where id= + e.CommandArgument.ToString(); binddata();
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年河南省登封市高三生物上册期末考试自测卷含答案
- 2026年江苏省东台市高一化学上册期末考试考试卷【模拟题】附答案
- 2026年山东省诸城市高三生物上册期末考试考试卷及答案
- 2026年河南省新郑市高三生物下册期末考试模拟测试卷带答案
- 2026年江苏省扬中市高三物理下册期末考试模拟考试卷带答案
- 2026年辽宁省东港市高一化学上册期末考试模拟检测卷附完整答案(名师系列)
- 2026年江西省乐平市高一化学上册期末考试模拟卷含完整答案【夺冠系列】
- 2026年河南省荥阳市高一化学上册期末考试模拟检测卷及参考答案(B卷)
- 2026年江苏省常熟市高一化学上册期末考试模拟检测卷完整答案
- 2026年广东省陆丰市高三生物下册期末考试模拟试卷带答案
- 【《国企混合所有制改革路径及影响案例分析-以云南白药企业为例》14000字(论文)】
- 双人演讲稿励志英语版
- 我国内部控制披露制度
- 2026年药品批发企业质量管理员培训试卷及答案解析
- GB/T 47111-2026公园城市建设评价指南
- 液压缸维修培训课件
- 互联网公司前端开发工程师工作绩效考评表
- 2025年全行业薪酬报告
- 间歇导尿与留置导尿的护理对比
- 春播行动中药贴敷培训
- 岩浆岩课件教学课件
评论
0/150
提交评论