页面介绍展示:
以上是餐饮管理系统制作图片介绍,接下来是代码部分。
menu.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="menu.aspx.cs" Inherits="menu" Title="无标题页" %>
< style=" height:300px ">
图片
菜名
原价格
优惠价格
' Width="88px" />
'>
'>
'>
"
SelectCommand="SELECT [menuName], [menuPhoto], [menuNewPrice], [menuPrice] FROM [Menus] WHERe ([menuNewPrice] IS NOT NULL)">
>
menuCar.aspx
<%@ Page Language="C#" MasterPageFile="~/Land-zhuce.master" AutoEventWireup="true" CodeFile="menuCar.aspx.cs" Inherits="menuCar" Title="无标题页" %>
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();
//}
//catch (Exception)
//{
// Response.Write("");
//}
}
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("");
// }
// else//若购物车没有此产品则将此产品的相关信息插入购物车
// {
// Response.Write("没有!!");
// }
//}
//catch (Exception)
//{
// Response.Write("");
//}
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("");
// DataListBind();//绑定数据
// total_money();//计算价格
//}
//else
// Response.Write("");
}
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("");
DataListBind();//绑定数据
// total_money();//计算价格
}
else
Response.Write("");
}
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餐饮管理系统制作关键代码,代码不够完整,本文的目的只是想给大家一个启发,制作餐饮管理系统的思路,希望能真正的帮助到大家。



