实训九 员工信息管理

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

实训九员工信息管理实训目的:实训内容:实训过程:1.员工信息管理界面制作(worker.aspx)全部静态代码如下:%@PageLanguage=C#AutoEventWireup=trueCodeFile=worker.aspx.csInherits=gongyingshang%!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN==servertitle无标题页/title/headbodyformid=form1runat=serverdivasp:ScriptManagerID=ScriptManager1runat=server/asp:ScriptManagerasp:UpdatePanelID=UpdatePanel1runat=serverContentTemplatetablecellpadding=0cellspacing=0style=border:1pxsolid#3333FF;font-size:14px;width=800align=centertrtdbgcolor=#6699FFheight=30   员工信息 /td/trtrtdstyle=padding:10pxtablealign=centercellpadding=0cellspacing=0style=border:1pxsolid#6699FF;margin-bottom:10px;width=100%trtdbgcolor=#6699FFcolspan=5height=30 员工信息添加/修改/查询 /td/trtrtd 编号:asp:TextBoxID=TextBox1runat=serverWidth=74px/asp:TextBox/tdtdheight=30姓名:asp:TextBoxID=TextBox2runat=serverWidth=86px/asp:TextBox/tdtd密码:asp:TextBoxID=TextBox3runat=serverWidth=75px/asp:TextBox/tdtd性别:asp:RadioButtonListID=RadioButtonList1runat=serverRepeatDirection=HorizontalRepeatLayout=Flowasp:ListItemSelected=TrueValue=男男/asp:ListItemasp:ListItemValue=女女/asp:ListItem/asp:RadioButtonList/tdtd /td/trtrtd 权限:asp:DropDownListID=DropDownList1runat=serverasp:ListItemValue=1销售员/asp:ListItemasp:ListItemValue=2进货员/asp:ListItemasp:ListItemValue=0管理员/asp:ListItem/asp:DropDownList/tdtdheight=30电话:asp:TextBoxID=TextBox5runat=serverWidth=107px/asp:TextBox/tdtdcolspan=2身份证号:asp:TextBoxID=TextBox6runat=serverWidth=205px/asp:TextBox/tdtdasp:ButtonID=Button2runat=serveronclick=Button2_ClickText=查询Width=102px//td/trtrtd  工资:asp:TextBoxID=TextBox7runat=serverWidth=75px/asp:TextBox/tdtdcolspan=3height=30住址:asp:TextBoxID=TextBox8runat=serverWidth=409px/asp:TextBox/tdtdasp:ButtonID=Button1runat=serveronclick=Button1_ClickText=添加Width=103px//td/tr/tableasp:GridViewID=GridView1runat=serverAutoGenerateColumns=FalseBackColor=WhiteBorderColor=#6699FFBorderStyle=SolidBorderWidth=1pxCellPadding=4Width=100%DataKeyNames=idonrowcommand=GridView1_RowCommandAllowPaging=Trueonpageindexchanging=GridView1_PageIndexChangingFooterStyleBackColor=#99CCCCForeColor=#003399/RowStyleBackColor=WhiteForeColor=#003399/Columnsasp:BoundFieldDataField=bianhaoHeaderText=员工编号ItemStyleWidth=100px//asp:BoundFieldasp:BoundFieldDataField=usernameHeaderText=员工姓名ItemStyleWidth=100px//asp:BoundFieldasp:BoundFieldDataField=telHeaderText=员工电话ItemStyleWidth=200px//asp:BoundFieldasp:BoundFieldDataField=sfzHeaderText=身份证编号/asp:TemplateFieldItemTemplateasp:LinkButtonID=LinkButton1runat=serverCommandArgument='%#Eval(id)%'CommandName=xiugai修改/asp:LinkButton asp:LinkButtonID=LinkButton2runat=serverCommandArgument='%#Eval(id)%'CommandName=del删除/asp:LinkButton/ItemTemplateItemStyleWidth=100px//asp:TemplateField/ColumnsPagerStyleBackColor=#99CCCCForeColor=#003399HorizontalAlign=Left/SelectedRowStyleBackColor=#009999Font-Bold=TrueForeColor=#CCFF99/HeaderStyleBackColor=#6699FFFont-Bold=TrueForeColor=Black//asp:GridView/td/tr/table/ContentTemplate/asp:UpdatePanel/div/form/body/html2.编写动态代码(worker.aspx.cs)usingSystem;usingSystem.Collections;usingSystem.Configuration;usingSystem.Data;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.HtmlControls;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Xml.Linq;usingSystem.Data.OleDb;publicpartialclassgongyingshang:System.Web.UI.Page{DBfunctiondb=newDBfunction();protectedvoidPage_Load(objectsender,EventArgse){db.isLogin();if(!IsPostBack){binddata();}}voidbinddata(){GridView1.DataSource=db.getDataView(select*fromyuangong);GridView1.DataBind();}protectedvoidButton1_Click(objectsender,EventArgse){stringsqlcheck=;stringsql=;if(Session[quanxian]==null||Session[quanxian].ToString()!=0){ScriptManager.RegisterStartupScript(this,GetType(),,alert('对不起,您的权限不够!'),true);return;}else{if(TextBox1.Text.Trim().Length0&&TextBox2.Text.Trim().Length0&&TextBox3.Text.Trim().Length0&&TextBox6.Text.Trim().Length0){if(Button1.Text==添加){sql=insertintoyuangong(bianhao,username,passwd,quanxian,xinbie,tel,address,sfz,gongzi)values('+TextBox1.Text.Trim()+',';sql+=TextBox2.Text.Trim()+','+TextBox3.Text.Trim()+','+DropDownList1.SelectedValue+','+RadioButtonList1.SelectedValue+',';sql+=TextBox5.Text.Trim()+','+TextBox8.Text.Trim()+','+TextBox6.Text.Trim()+',+TextBox7.Text.Trim()+);sqlcheck=select*fromyuangongwherebianhao='+TextBox1.Text.Trim()+'andsfz='+TextBox6.Text.Trim()+';}else{sql=UPDATEyuangongSETbianhao='+TextBox1.Text.Trim()+',username='+TextBox2.Text.Trim();sql+=',passwd='+TextBox3.Text.Trim()+',quanxian='+DropDownList1.SelectedValue+',xinbie=';sql+=RadioButtonList1.SelectedValue+',tel='+

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功