实训八供应商信息管理实训目的:实训内容:实训过程:1.制作供应商信息管理界面(gongyingshang.aspx)全部静态代码如下:%@PageLanguage=C#AutoEventWireup=trueCodeFile=gongyingshang.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=4height=30 供应商添加/修改/查询 /tdtdbgcolor=#6699FFheight=30 /tdtdbgcolor=#6699FFheight=30 /tdtdbgcolor=#6699FFheight=30 /td/trtrtd 名称:/tdtdasp:TextBoxID=TextBox1runat=serverWidth=129px/asp:TextBox/tdtdheight=30地址:/tdtdasp:TextBoxID=TextBox2runat=serverWidth=200px/asp:TextBox/tdtd电话:/tdtdasp:TextBoxID=TextBox3runat=server/asp:TextBox/tdtd /td/trtrtd Email:/tdtdasp:TextBoxID=TextBox4runat=server/asp:TextBox/tdtdheight=30联系人:/tdtdasp:TextBoxID=TextBox5runat=server/asp:TextBox/tdtd备注:/tdtdasp:TextBoxID=TextBox6runat=server/asp:TextBox/tdtdasp:ButtonID=Button1runat=serverText=添加Width=103pxonclick=Button1_Click//td/tr/tableasp:GridViewID=GridView1runat=serverAutoGenerateColumns=FalseBackColor=WhiteBorderColor=#6699FFBorderStyle=SolidBorderWidth=1pxCellPadding=4Width=100%DataKeyNames=idonrowcommand=GridView1_RowCommandonrowdeleting=GridView1_RowDeletingFooterStyleBackColor=#99CCCCForeColor=#003399/RowStyleBackColor=WhiteForeColor=#003399/Columnsasp:BoundFieldDataField=companyHeaderText=供应商名称/asp:BoundFieldDataField=addressHeaderText=供应商地址/asp:BoundFieldDataField=telHeaderText=供应商电话/asp:TemplateFieldItemTemplateasp:LinkButtonID=LinkButton1runat=serverCommandArgument='%#Eval(id)%'CommandName=xiugai修改/asp:LinkButton/ItemTemplate/asp:TemplateFieldasp:CommandFieldShowDeleteButton=True//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.编写动态代码(gongyingshang.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;publicpartialclassgongyingshang:System.Web.UI.Page{DBfunctiondb=newDBfunction();protectedvoidPage_Load(objectsender,EventArgse){db.isLogin();if(!IsPostBack){binddata();}}voidbinddata(){GridView1.DataSource=db.getDataView(select*fromgys);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&&TextBox5.Text.Trim().Length0){sqlcheck=select*fromgyswherecompany='+TextBox1.Text.Trim()+'andtel='+TextBox3.Text.Trim()+'andname='+TextBox5.Text.Trim()+';if(!db.isExist(sqlcheck)){if(Button1.Text==添加){sql=insertintogys(company,email,name,address,tel,beizhu)values('+TextBox1.Text.Trim()+',';sql+=TextBox4.Text.Trim()+','+TextBox5.Text.Trim()+','+TextBox2.Text.Trim()+',';sql+=TextBox3.Text.Trim()+','+TextBox6.Text.Trim()+');}else{sql=updategyssetcompany='+TextBox1.Text.Trim()+',email='+TextBox4.Text.Trim()+',name=';sql+=TextBox5.Text.Trim()+',address='+TextBox2.Text.Trim()+',tel='+TextBox3.Text.Trim()+',;sql+=beizhu='+TextBox6.Text.Trim()+'whereid=+ViewState[id].ToString();}db.sqlExecute(sql);Button1.Text=添加;binddata();TextBox1.Text=;TextBox2.Text=;TextBox3.Text=;TextBox4.Text=;TextBox5.Text=;TextBox6.Text=;TextBox1.Focus();}else{ScriptManager.RegisterStartupScript(this,GetType(),,alert('该记录已经存在!'),true);}}else{ScriptManager.RegisterStartupScript(this,GetType(),,alert('供应商名称、供应商电话和联系人姓名不能为空'),true);}}}protectedvoidGridView1_RowDeleting(objectsender,GridViewDeleteEventArgse){if(Session[quanxian]!=null&&Session[quanxian].ToString()!=0){ScriptManager.RegisterStartupScript(this,GetType(),,alert('对不起,您的权限不够!'),true);return;}else{db.sqlExecute(deletefromgyswhereid=+GridView1.DataKeys[e.RowIndex].Value);binddata();}}protectedvoidGridView1_RowCommand(objectsender,GridViewCommandEventArgse){intid;DataRowdr;if(Session[quanxian]!=null&&Session[quanxian].ToString()!=0){ScriptMan