页面介绍展示:
以上是餐饮管理系统制作图片介绍,接下来是代码部分。
menu.aspx
"htmlcode">
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="menu.aspx.cs" Inherits="menu" Title="无标题页" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <form id="form1" runat="server"> < style="height: 300px"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="299px" Width="544px" AllowPaging="True" PageSize="4"> <PagerSettings FirstPageText="首页" LastPageText="末页" Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" /> <Columns> <asp:BoundField DataField="menuID" HeaderText="序号" InsertVisible="False" ReadOnly="True" SortExpression="menuID" /> <asp:BoundField DataField="menuName" HeaderText="菜名" SortExpression="menuName" /> <asp:ImageField DataImageUrlField="menuPhoto" HeaderText="图片" ControlStyle-Height="30px" ControlStyle-Width="70px" SortExpression="menuPhoto" > <ControlStyle Height="30px" Width="70px"></ControlStyle> </asp:ImageField> <asp:BoundField DataField="menuCooker" HeaderText="厨师" SortExpression="menuCooker" /> <asp:BoundField DataField="menuStyle" HeaderText="菜系" SortExpression="menuStyle" /> <asp:BoundField DataField="menuPrice" HeaderText="价格" SortExpression="menuPrice" /> <asp:BoundField DataField="menuDate" HeaderText="创菜日期" SortExpression="menuDate" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStr %>" SelectCommand="SELECT [menuID], [menuName], [menuPhoto], [menuCooker], [menuStyle], [menuPrice], [menuDate] FROM [Menus]"> </asp:SqlDataSource> </> </form> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"> < style=" height:300px "> <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource2"> <HeaderTemplate > <table border="1" style="width: 104%; height: 36px"> <tr> <td>图片</td> <td>菜名</td> <td>原价格</td> <td>优惠价格</td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td style="width: 90px"> <asp:Image ID="Image1" runat="server" Height="88px" ImageUrl='<%# Eval("menuPhoto") %>' Width="88px" /> </td> <td style="width: 40px"> <asp:Label ID="Label1" runat="server" Text='<%# Eval("menuName") %>'></asp:Label> </td> <td style="width: 50px"> <asp:Label ID="Label2" runat="server" Text='<%# Eval("menuPrice") %>'></asp:Label> </td> <td style="width: 50px"> <asp:Label ID="Label3" runat="server" Text='<%# Eval("menuNewPrice") %>'></asp:Label> </td> </tr> </ItemTemplate> <FooterTemplate></table></FooterTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStr %>" SelectCommand="SELECT [menuName], [menuPhoto], [menuNewPrice], [menuPrice] FROM [Menus] WHERE ([menuNewPrice] IS NOT NULL)"> </asp:SqlDataSource> </> </asp:Content>
menuCar.aspx
"C#" MasterPageFile="~/Land-zhuce.master" AutoEventWireup="true" CodeFile="menuCar.aspx.cs" Inherits="menuCar" Title="无标题页" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <form id="form1" runat="server"> < style="height:350px"> <table id="Table1" cellSpacing="1" cellPadding="0" width="530" align="center" border="0"> <TR> <TD align="center"> <asp:label id="Label1" runat="server" Font-Size="X-Large" Font-Names="华文行楷" ForeColor="Blue">订餐车</asp:label></TD> </TR> <TR> <TD align="center"> <asp:DataList ID="DataList1" runat="server" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" DataKeyField="ID" onupdatecommand="DataList1_UpdateCommand" OnDeleteCommand="DataList1_DeleteCommand" AllowPaging="true" PageSize="4" RepeatColumns="4"> <%-- <AlternatingItemStyle BackColor="PaleGoldenrod" /> <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />--%> <HeaderTemplate> <table border="1" style="width: 100%"> <tr> <td style="width: 25px"> 序号</td> <td style="width: 33px"> 菜名</td> <td style="width: 49px"> 图片</td> <td style="width: 30px"> 付费</td> <td> 份数</td> <td> 保存份数</td> <td> 删除</td> </tr> </HeaderTemplate> <HeaderStyle BackColor="Tan" Font-Bold="True" /> <ItemTemplate> <tr> <td><%# DataBinder.Eval(Container.DataItem ,"goodID") %></td> <td><%# DataBinder.Eval(Container.DataItem ,"menuName") %></td> <%-- <td><%# DataBinder.Eval(Container.DataItem ,"menuPhoto") %></td>--%> <td><asp:Image ID="Image1" runat="server" Width="60px" Height="40px" ImageUrl='<%# DataBinder.Eval(Container.DataItem ,"menuPhUrl") %>'></asp:Image></td> <td><%# DataBinder.Eval(Container.DataItem ,"payMoney") %></td> <td><asp:TextBox ID="txtCount" runat="server" Width="32px" Text='<%# DataBinder.Eval(Container.DataItem ,"number") %>'></asp:TextBox></td> <td><asp:Button ID="bnMod" runat="server" Text="保存修改" CommandName="Update"></asp:Button></td> <td><asp:Button ID="Button1" runat="server" Text="删除" CommandName= "Delete"/></td> </tr> </ItemTemplate> <FooterTemplate></table></FooterTemplate> <FooterStyle BackColor="Tan" /> </asp:DataList> </TD> </TR> <TR> <TD align="center" height="40">总金额: <asp:TextBox id="total_money_txt" runat="server" Width="82px"></asp:TextBox> <asp:Button id="shoppingbtn" runat="server" Text="继续购物" OnClick="shoppingbtn_Click"></asp:Button> <asp:Button id="delallbtn" runat="server" Text="清空购物车" OnClick="delallbtn_Click"></asp:Button> <asp:Button id="orderbtn" runat="server" Text="结算中心" OnClick="orderbtn_Click"></asp:Button></TD> </TR> <TR> <TD align="center"></TD> </TR> <TR> <TD align="center"> </TD> </TR> </table> </> </form> </asp:Content>
menuCar.aspx.cs
"select * from OrderMenu where customerName='" + Session["UserName"] + "'"; //Ds = db.GetDataTableBySql(SqlStr); DataSet das = Dataoperator.getRows(SqlStr); DataList1.DataSource = das; DataList1.DataBind(); //try //{ // this.DataList1.DataSource = Ds.Tables[0].DefaultView; // this.DataList1.DataBind(); //} //catch (Exception) //{ // Response.Write("<script>alert('没有得到数据,请重试!')</script>"); //} } protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { SqlStr = "select * from OrderMenu"; Ds = db.GetDataTableBySql(SqlStr); //try //{ // if (Ds.Tables[0].Rows.Count != 0)//若购物车有此产品则提示用户 // { // Response.Write("<script>alert('你已经购买了此产品,只要更改数量就行!')</script>"); // } // else//若购物车没有此产品则将此产品的相关信息插入购物车 // { // Response.Write("没有!!"); // } //} //catch (Exception) //{ // Response.Write("<script>alert('没有得到数据,请重试!')</script>"); //} DataListBind();//绑定数据 //total_money();//计算价格 } } protected void shoppingbtn_Click(object sender, EventArgs e) { Response.Redirect("orderMainMenu.aspx"); } protected void delallbtn_Click(object sender, EventArgs e) { } protected void orderbtn_Click(object sender, EventArgs e) { Response.Redirect("menuorder.aspx"); } protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e) { //String book_id = this.DataList1.DataKeys[e.Item.ItemIndex].ToString(); //SqlStr = "delete from 购物车表 where 图书编号='" + book_id + "'"; //Boolean Del_Result; //Del_Result = db.UpdateDataBySql(SqlStr); //if (Del_Result == true) //{ // Response.Write("<script>alert('记录删除成功!')</script>"); // DataListBind();//绑定数据 // total_money();//计算价格 //} //else // Response.Write("<script>alert('记录删除失败,请检查!')</script>"); } protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e) { String book_id = this.DataList1.DataKeys[e.Item.ItemIndex].ToString(); TextBox count = (TextBox)this.DataList1.Items[e.Item.ItemIndex].FindControl("txtcount"); string SqlStr1 = "select * from Menus where menuNumber='" + Session["menu_number"] + "'"; Ds = Dataoperator.getRows(SqlStr1); if (Ds.Tables[0].Rows.Count>0) { int pric = Convert.ToInt32(Ds.Tables[0].Rows[0][6]); int mon = Convert.ToInt32(count.Text) * pric; //Session["payMon"] = mon.ToString(); //total_money_txt.Text = mon.ToString(); SqlStr = "update OrderMenu set number='" + Convert.ToInt32(count.Text) + "',payMoney='" + mon + "' where ID='" + book_id + "'"; Boolean Update_Result; Update_Result = db.UpdateDataBySql(SqlStr); if (Update_Result == true) { Response.Write("<script>alert('数量修改成功!')</script>"); DataListBind();//绑定数据 // total_money();//计算价格 } else Response.Write("<script>alert('数量修改失败,请检查!')</script>"); } else { } } }
[ASP/Basic]代码
//menuorder.aspx protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { //Session["Username"] = "ning"; // DataGridViewBind(); //total_money(); string sql = "select * from menuView where customerName='" + Session["UserName"] + "'"; Ds = Dataoperator.getRows(sql); int i = Ds.Tables[0].Rows.Count; int tem = 0; for (int j = 0; j < i; j++) { tem = Convert.ToInt32(Ds.Tables[0].Rows[j][5].ToString()) + tem; } total_money_txt.Text = tem.ToString(); } } protected void orderbtn_Click(object sender, EventArgs e) { string sql = "select * from menuView where customerName='" + Session["UserName"] + "'"; Ds = Dataoperator.getRows(sql); int i = Ds.Tables[0].Rows.Count; string strgoodid=""; string strcustomername = ""; string strmenuname = ""; string strnumber = ""; string deldate = ""; int strpaymoney = 0; if (i > 0) { bool te = false; for (int j = 0; j < i; j++) { strgoodid = Ds.Tables[0].Rows[j][0].ToString(); strcustomername = Ds.Tables[0].Rows[j][1].ToString(); strmenuname = Ds.Tables[0].Rows[j][2].ToString(); strnumber = Ds.Tables[0].Rows[j][3].ToString(); deldate = Ds.Tables[0].Rows[j][4].ToString(); strpaymoney = Convert.ToInt32(Ds.Tables[0].Rows[j][5]); tem++; string songdate = Calendar1.SelectedDate.ToString(); string stylePay = ddlpayment.SelectedValue.ToString(); string sakmenu = remarktxtbox.Text; string sqlind = "insert into IndentMenu values('" + strgoodid + "','" + strcustomername + "','" + strmenuname + "','" + strnumber + "','" + deldate + "','" + strpaymoney + "','" + songdate + "','" + stylePay + "','" + sakmenu + "')"; te = Dataoperator.exSql(sqlind); } if (te) { MessageBox.ShowPath("menuIndent.aspx"); } else { MessageBox.Show("存储错误.."); } } else { MessageBox.Show("出错了啊!!"); } }
以上就是ASP.NET餐饮管理系统制作关键代码,代码不够完整,本文的目的只是想给大家一个启发,制作餐饮管理系统的思路,希望能真正的帮助到大家。
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月30日
2024年11月30日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]