ASP.NET餐饮管理系统制作代码分享

网络编程 2021-07-04 22:41www.168986.cn编程入门
本文通过图片+代码的形式,详细的介绍了餐饮管理系统各部分功能及其实现方法。餐饮管理系统的制作必须有一条条理性的思维方可以做好,感兴趣的小伙伴们可以参考一下

页面介绍展示

以上是餐饮管理系统制作图片介绍,接下来是代码部分。

menu.aspx



<%@ 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

<%@ Page Language="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"  
                onupdatemand="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

using System; 
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; 
 
public partial class menuCar : System.Web.UI.Page 
{ 
  String SqlStr; 
  DB db = new DB(); 
  DataSet Ds = new DataSet(); 
  public void DataListBind() 
  { 
    SqlStr = "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(); 
    / 

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by