您现在的位置是:网站首页> 编程资料编程资料

ASP.NET餐饮管理系统制作代码分享_实用技巧_

2023-05-24 344人已围观

简介 ASP.NET餐饮管理系统制作代码分享_实用技巧_

页面介绍展示:

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

menu.aspx



<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="menu.aspx.cs" Inherits="menu" Title="无标题页" %>
< style="height: 300px">
< style=" height:300px ">
图片菜名原价格优惠价格

menuCar.aspx

 <%@ Page Language="C#" MasterPageFile="~/Land-zhuce.master" AutoEventWireup="true" CodeFile="menuCar.aspx.cs" Inherits="menuCar" Title="无标题页" %>
< style="height:350px">
订餐车
<%-- --%><%-- --%>
序号 菜名 图片 付费 份数 保存份数 删除
<%# DataBinder.Eval(Container.DataItem ,"goodID") %><%# DataBinder.Eval(Container.DataItem ,"menuName") %><%# DataBinder.Eval(Container.DataItem ,"menuPhoto") %><%# DataBinder.Eval(Container.DataItem ,"payMoney") %>
总金额:

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 * f
                
                

-六神源码网