C#實(shí)現(xiàn)在線點(diǎn)餐系統(tǒng)
這個(gè)是C#大作業(yè),寫作業(yè)很用心,寫了很久,所以留存一下。不是現(xiàn)在的是之前的的期末作業(yè),現(xiàn)在才想著整理一下
實(shí)現(xiàn)功能:
1、商家登錄;客戶的登錄、注冊(cè)。
2、商家界面實(shí)現(xiàn)了對(duì)菜單的增、刪、改、查;還有訂單的查看、查詢、結(jié)賬(刪除訂單)、查看已結(jié)賬訂單、關(guān)閉;退出系統(tǒng)。
3、用戶界面實(shí)現(xiàn)了菜單的查看,查詢,新建訂單,選擇餐桌,保存訂單,增加菜品,退出。
C#語(yǔ)言實(shí)現(xiàn)在線點(diǎn)餐系統(tǒng),具體功能如下圖
登錄界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class Form1 : Form
{
int dlsf=0;
/* SqlConnection sqlcon;
SqlCommand sqlcom;
SqlDataReader sqlsdr;*/
BaseInfo baseinfo = new BaseInfo();//
BaseInfo.GkInfo gkinfo = new BaseInfo.GkInfo();//
public Form1()
{
InitializeComponent();
}
public void dengluzt()
{
DataSet ds = null;
gkinfo.Gk_num = textBox1.Text.Trim();
ds = baseinfo.DengLu(gkinfo, "db_menu");
gkinfo.Gk_zt = 1;
gkinfo.Gk_apw = gkinfo.Gk_pw;
gkinfo.Gk_name = ds.Tables[0].Rows[0][1].ToString().Trim();
baseinfo.Updatgk(this.gkinfo);
}
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked) dlsf = 1;
if (radioButton2.Checked) dlsf = 2;
if (textBox1.Text.Trim() == "")
{
label3.Text = "賬號(hào)不能為空";
textBox1.Focus();
return;
}
else
if (textBox2.Text.Trim() == "")
{
label3.Text = "密碼不能為空";
textBox1.Focus();
return;
}
else
if (dlsf == 2)
{
try
{
DataSet ds = null;
gkinfo.Gk_num = textBox1.Text.Trim();
gkinfo.Gk_pw = textBox2.Text.Trim();
ds = baseinfo.DengLu(gkinfo, "db_menu");
if (ds== null||ds.Tables.Count == 0||(ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))
{
MessageBox.Show("用戶名錯(cuò)誤!");
return;
}
else
if (ds.Tables[0].Rows[0][2].ToString().Trim() != textBox2.Text.Trim())
{ MessageBox.Show("密碼錯(cuò)誤"); }
else
{
MessageBox.Show("登陸成功!");
dengluzt();
gkfm fm = new gkfm();
fm.add (Convert.ToString(textBox1.Text));
fm.Show();
//this.Hide();
}
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}
else
if (dlsf == 1)
{
if (textBox1.Text.Trim() == "1" && textBox2.Text.Trim() == "1")
{
MessageBox.Show("登錄成功");
sjfm fm = new sjfm();
fm.Show();
// this.Hide();
}
else { MessageBox.Show("賬號(hào)或密碼錯(cuò)誤!請(qǐng)重新輸入!"); return; }
}
}
private void label3_Click(object sender, EventArgs e)
{
zcfm fm = new zcfm();
fm.Show();
this.Hide();
}
}
}
注冊(cè)界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class zcfm : Form
{
BaseInfo baseinfo = new BaseInfo();//
BaseInfo.GkInfo gkinfo = new BaseInfo.GkInfo();//
/* SqlConnection sqlcon;
SqlCommand sqlcom;*/
public zcfm()
{
InitializeComponent();
}
private void label6_Click(object sender, EventArgs e)
{
Form1 fm = new Form1();
fm.Show();
this.Hide();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() == "" || textBox1.Text.Length != 11)
{
MessageBox.Show( "手機(jī)號(hào)錯(cuò)誤,請(qǐng)規(guī)范填寫");
}
else
if (textBox2.Text.Trim() == "")
{
MessageBox.Show("用戶名錯(cuò)誤,請(qǐng)規(guī)范填寫4-8位");
}
else
if (textBox3.Text.Trim() == "" || textBox3.Text.Length < 6 || textBox3.Text.Length > 8)
{
MessageBox.Show("密碼錯(cuò)誤,請(qǐng)規(guī)范填寫6-8位!");
}
else
if (textBox4.Text.Trim() == "")
{
MessageBox.Show("密碼錯(cuò)誤,請(qǐng)規(guī)范填寫6-8位!");
}
else
if (textBox3.Text.Trim() != textBox4.Text.Trim())
{
MessageBox.Show("兩次輸入密碼必須一致!");
}
else
{
try
{
gkinfo.Gk_num = textBox1.Text.Trim();
gkinfo.Gk_name = textBox2.Text.Trim();
gkinfo.Gk_pw = textBox3.Text.Trim();
gkinfo.Gk_apw = textBox4.Text.Trim();
gkinfo.Gk_zt = 0;
int id = baseinfo.AddGk(gkinfo);
MessageBox.Show("注冊(cè)成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ee){ MessageBox.Show(ee.Message); }
}
}
private void zcfm_Load(object sender, EventArgs e)
{
}
}
}
商家界面:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class sjfm : Form
{
public sjfm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MenuShop fm = new MenuShop();
fm.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
glfm fm = new glfm();
fm.Show();
}
}
}
菜單管理
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class MenuShop : Form
{
BaseInfo baseinfo = new BaseInfo();
BaseInfo.MenuInfo stockinfo = new BaseInfo.MenuInfo();
int kj_bz = 0;//控件狀態(tài)標(biāo)志
public MenuShop()
{
InitializeComponent();
}
private void clearText()
{
Textboxnum.Text = string.Empty;
TextboxName.Text = string.Empty;
Textboxgg.Text = string.Empty;
Textboxlx.Text = string.Empty;
Textboxdj.Text = string.Empty;
}
private void cancelEnabled()
{
groupBox1.Enabled = false;
tlBtnAdd.Enabled = true;
BtnEdit.Enabled = true;
BtnDelete.Enabled = true;
BtnSave.Enabled = false;
BtnCancel.Enabled = false;
}
private void LoadEnabled()
{
groupBox1.Enabled = false;
tlBtnAdd.Enabled = true;
BtnEdit.Enabled = true;
BtnDelete.Enabled = true;
BtnSave.Enabled = false;
BtnCancel.Enabled = false;
}
private void editEnabled()
{
groupBox1.Enabled = true;
tlBtnAdd.Enabled = false;
BtnEdit.Enabled = false;
BtnDelete.Enabled =false;
BtnSave.Enabled = true;
BtnCancel.Enabled = true;
}
private void AddEnabled()
{
Textboxdj.Text = "";
Textboxgg.Text = "";
Textboxnum.Text = "";
TextboxName.Text = "";
Textboxlx.Text = "";
groupBox1.Enabled = true;
tlBtnAdd.Enabled = false;
BtnEdit.Enabled = false;
BtnDelete.Enabled = false;
BtnSave.Enabled = true;
BtnCancel.Enabled = true;
}
private void MenuShop_Load(object sender, EventArgs e)
{
this.LoadEnabled();
dataGridView1.DataSource = baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;//展示菜品信息
this.SetdataGridView1HeadText();
}
private void SetdataGridView1HeadText()
{
dataGridView1.Columns[0].HeaderText = "菜品編號(hào)";
dataGridView1.Columns[1].HeaderText = "菜品名稱";
dataGridView1.Columns[2].HeaderText = "菜品規(guī)格";
dataGridView1.Columns[3].HeaderText = "菜品類型";
dataGridView1.Columns[4].HeaderText = "菜品價(jià)格";
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
Textboxnum.Text = this.dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品編號(hào)
TextboxName.Text = this.dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品全稱
Textboxgg.Text = this.dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品規(guī)格
Textboxlx.Text = this.dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品類型
Textboxdj.Text = this.dataGridView1[4, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品單價(jià)
}
public void labletime()
{
labelsj.Text = System.DateTime.Now.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
labletime();
}
private void tlBtnExit_Click(object sender, EventArgs e)
{
this.Close();
//Application.Exit();
}
private void BtnDelete_Click(object sender, EventArgs e)
{
if (Textboxnum.Text.Trim() == string.Empty)
{
MessageBox.Show("刪除--菜品數(shù)據(jù)--失敗!", "錯(cuò)誤提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
stockinfo.Menu_num = Textboxnum.Text.Trim();
int id = baseinfo.Deletemenu(stockinfo);
MessageBox.Show("刪除--庫(kù)存商品數(shù)據(jù)--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
dataGridView1.DataSource = baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;
this.SetdataGridView1HeadText();
this.clearText();//清空文本框
}
private void BtnSave_Click(object sender, EventArgs e)
{
if (kj_bz == 0)
{
try
{
//添加數(shù)據(jù)
stockinfo.Menu_num =Textboxnum.Text;
stockinfo.Menu_name = TextboxName.Text;
stockinfo.Menu_gg = Textboxgg.Text;
stockinfo.Menu_lx= Textboxlx.Text;
stockinfo.Menu_dj = float.Parse( Textboxdj.Text.Trim());
//執(zhí)行添加操作
int id = baseinfo.Addmenu(stockinfo);
MessageBox.Show("新增--庫(kù)存商品數(shù)據(jù)--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "錯(cuò)誤提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
//修改數(shù)據(jù)
stockinfo.Menu_num = Textboxnum.Text;
stockinfo.Menu_name = TextboxName.Text;
stockinfo.Menu_gg = Textboxgg.Text;
stockinfo.Menu_lx = Textboxlx.Text;
stockinfo.Menu_dj = float.Parse(Textboxdj.Text.Trim());
//執(zhí)行修改操作
int id = baseinfo.Updatemenu(stockinfo);
MessageBox.Show("修改--庫(kù)存商品數(shù)據(jù)--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
dataGridView1.DataSource = baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;
this.SetdataGridView1HeadText();
this.cancelEnabled();//設(shè)置各個(gè)按鈕的可用狀態(tài)
}
private void BtnFind_Click(object sender, EventArgs e)
{
if (tlCmbStockType.Text == string.Empty)
{
MessageBox.Show("查詢類別不能為空!", "錯(cuò)誤提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
tlCmbStockType.Focus();
return;
}
else
if (tlCmbStockType.Text.Trim() == "全部")
{
dataGridView1.DataSource = baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;
this.SetdataGridView1HeadText();
return;
}
else
{
DataSet ds = null;
stockinfo.Menu_lx = tlCmbStockType.Text;
ds = baseinfo.FindmenuBylx(stockinfo, "db_menu");
dataGridView1.DataSource = ds.Tables[0].DefaultView;
this.SetdataGridView1HeadText();
}
}
private void BtnCancel_Click(object sender, EventArgs e)
{
this.cancelEnabled();
}
private void BtnEdit_Click(object sender, EventArgs e)
{
kj_bz = 1;
this.editEnabled();
}
private void tlBtnAdd_Click(object sender, EventArgs e)
{
this.AddEnabled();
kj_bz = 0;
}
}
}
訂單管理
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class glfm : Form
{
BaseInfo baseinfo = new BaseInfo();
BaseInfo.Ddinfo dd = new BaseInfo.Ddinfo();
public glfm()
{
InitializeComponent();
}
private void glfm_Load(object sender, EventArgs e)
{
textBoxddxq.Enabled = false;
dataGridView1.DataSource = baseinfo.GetAlldd("db_dd").Tables[0].DefaultView;//展示訂單信息
this.SetdataGridView1HeadText();
}
private void SetdataGridView1HeadText()
{
dataGridView1.Columns[0].HeaderText = "桌號(hào)";
dataGridView1.Columns[1].HeaderText = "顧客手機(jī)號(hào)";
dataGridView1.Columns[2].HeaderText = "訂單詳情";
dataGridView1.Columns[3].HeaderText = "訂單總價(jià)";
dataGridView1.Columns[4].HeaderText = "訂單時(shí)間";
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
if (ComboBoxzh.Text == string.Empty)
{
MessageBox.Show("查詢類別不能為空!", "錯(cuò)誤提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
ComboBoxzh.Focus();
return;
}
else
if (ComboBoxzh.Text.Trim() == "全部")
{
dataGridView1.DataSource = baseinfo.GetAlldd("db_dd").Tables[0].DefaultView;
return;
}
if (ComboBoxzh.Text.Trim() == "已結(jié)賬訂單")
{
dataGridView1.DataSource = baseinfo.GetAllsydd("db_sydd").Tables[0].DefaultView;
//labelxfzj.Text = baseinfo.GetAllddsy("dd_sydd").ToString();
return;
}
else
{
DataSet ds = null;
dd.Dd_num = int.Parse(ComboBoxzh.Text);
ds = baseinfo.FindddByzh(dd, "db_dd");
dataGridView1.DataSource = ds.Tables[0].DefaultView;
this.SetdataGridView1HeadText();
if (ds == null || ds.Tables.Count == 0 || (ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))
{
textBoxddxq.Text = "";
}
else
{
textBoxddxq.Text = ds.Tables[0].Rows[0][2].ToString().Trim();
}
}
}
public void yjdd()
{
dataGridView1.DataSource = baseinfo.GetAlldd("db_sydd").Tables[0].DefaultView;
SetdataGridView1HeadText();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
ComboBoxzh.Text = this.dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString();
textBoxddxq.Text = this.dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value.ToString();
labelxfzj.Text = "本次消費(fèi)總價(jià)為:" + this.dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value.ToString();
}
private void ExitBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
if (ComboBoxzh.Text.Trim() != "")
{
dd.Dd_num = int.Parse(ComboBoxzh.Text.Trim());
dd.Zd_num = this.dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();
dd.Dd_name = this.dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value.ToString();
dd.Dd_zj= float.Parse(this.dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value.ToString());
dd.Dd_time = this.dataGridView1[4, dataGridView1.CurrentCell.RowIndex].Value.ToString();
baseinfo.bcdd(dd);
baseinfo.Deletedd(dd);
MessageBox.Show("結(jié)賬完成!");
dataGridView1.DataSource = baseinfo.GetAlldd("db_dd").Tables[0].DefaultView;
this.SetdataGridView1HeadText();
}
else
{
MessageBox.Show("請(qǐng)選擇正確的桌號(hào)!");
return ;
}
}
}
}
用戶界面
using MenuSystemWss;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MenuSystemWss
{
public partial class gkfm : Form
{
BaseInfo baseinfo = new BaseInfo();
BaseInfo.GkInfo gkinfo = new BaseInfo.GkInfo();
BaseInfo.MenuInfo menu = new BaseInfo.MenuInfo();
BaseInfo.Ddinfo ddinfo = new BaseInfo.Ddinfo();
public double xfzj = 0;//消費(fèi)總價(jià)
public string yhsj = "";//用戶手機(jī)號(hào)
public int qxzt = 0;//點(diǎn)擊取消時(shí)的狀態(tài)
public gkfm()
{
InitializeComponent();
}
private void gkfm_Load(object sender, EventArgs e)
{
dataGridView1.DataSource =baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;//展示菜品信息
dataGridView1.ReadOnly = true;
this.SetdataGridView1HeadText();
load_Enable();
}
public void load_Enable()
{
cancelAll_Enable();
DataSet ds = null;
ddinfo.Zd_num = yhsj;
ds = baseinfo.FindddByzcnum(ddinfo, "db_dd");
if (ds == null || ds.Tables.Count == 0 || (ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))
{
comboBox1.Enabled = true;
tlBtnAdd.Enabled = true;
}
else {
jcBtn.Enabled = true;
comboBox1.Text= ds.Tables[0].Rows[0][0].ToString().Trim();
textBoxxq.Text = ds.Tables[0].Rows[0][2].ToString().Trim();
textBoxzj.Text = ds.Tables[0].Rows[0][3].ToString().Trim();
}
if (textBoxzj.Text.Trim() != "")
{
xfzj = Convert.ToDouble(textBoxzj.Text.Trim());
}
else
{
xfzj = 0;
}
if (textBoxxq.Text != "") qxzt = 1;
}
public void cancelAll_Enable()//關(guān)閉所有的控件
{
tlBtnAdd.Enabled = false;
BtnSave.Enabled = false;
BtnCancel.Enabled = false;
jcBtn.Enabled = false;
comboBox1.Enabled = false;
textBoxlx.Enabled = false;
textBoxdj.Enabled = false;
textBoxname.Enabled = false;
button1.Enabled = false;
textBoxzj.Enabled = false;
textBoxxq.Enabled = false;
}
public void jc_Enable()
{
BtnCancel.Enabled = true;
BtnSave.Enabled = true;
button1.Enabled = true;
}
public void add_Enable()
{
tlBtnAdd.Enabled = false;
BtnSave.Enabled = true;
BtnCancel.Enabled = true;
button1.Enabled = true;
}
public void cancel_Enable()
{
if (qxzt == 0)
{
cancelAll_Enable();
tlBtnAdd.Enabled = true;
comboBox1.Enabled = true;
xfzj = 0;
textBoxxq.Text = "";
}
else
{
BtnSave.Enabled = false;
BtnCancel.Enabled = false;
}
}
public void labletime()
{
labelTime.Text = System.DateTime.Now.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
labletime();
}
private void SetdataGridView1HeadText()
{
dataGridView1.Columns[0].HeaderText = "菜品編號(hào)";
dataGridView1.Columns[1].HeaderText = "菜品名稱";
dataGridView1.Columns[2].HeaderText = "菜品規(guī)格";
dataGridView1.Columns[3].HeaderText = "菜品類型";
dataGridView1.Columns[4].HeaderText = "菜品價(jià)格";
}
public void add(string strgk)
{
DataSet ds = null;
yhsj = strgk;
gkinfo.Gk_num = strgk;
ds = baseinfo.DengLu1(gkinfo, "db_menu");
label1.Text = ds.Tables[0].Rows[0][1].ToString().Trim() + "顧客您好 歡迎光臨小帥飯店"; //**先生
}
private void BtnFind_Click(object sender, EventArgs e)
{
if (toolStripComboBox1.Text == string.Empty)
{
MessageBox.Show("查詢類別不能為空!", "錯(cuò)誤提示!", MessageBoxButtons.OK, MessageBoxIcon.Error);
toolStripComboBox1.Focus();
return;
}
else
if (toolStripComboBox1.Text.Trim() == "全部")
{
dataGridView1.DataSource = baseinfo.GetAllmenu("db_menu").Tables[0].DefaultView;
this.SetdataGridView1HeadText();
return;
}
else
{
DataSet ds = null;
menu.Menu_lx = toolStripComboBox1.Text;
ds = baseinfo.FindmenuBylx(menu, "db_menu");
dataGridView1.DataSource = ds.Tables[0].DefaultView;
this.SetdataGridView1HeadText();
}
}
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void tlBtnAdd_Click(object sender, EventArgs e)
{
MessageBox.Show("請(qǐng)選擇桌號(hào)!");
add_Enable();
}
private void BtnCancel_Click(object sender, EventArgs e)
{
cancel_Enable();
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBoxname.Text = this.dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品全稱
textBoxlx.Text = this.dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品類型
textBoxdj.Text = this.dataGridView1[4, dataGridView1.CurrentCell.RowIndex].Value.ToString();//顯示菜品價(jià)格
}
private void tlBtnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
textBoxxq.Text += textBoxname.Text.Trim() + "*1; ";
//listView1 .Items.Add(textBoxname.Text.Trim()+"*1;");
xfzj += Convert.ToDouble(textBoxdj.Text.Trim());
textBoxzj.Text = xfzj.ToString();
}
private void BtnSave_Click(object sender, EventArgs e)
{
if (comboBox1.Text == "") { MessageBox.Show("桌號(hào)不能為空!請(qǐng)選擇桌號(hào)!");return; }
string strlist=textBoxxq.Text.Trim() ;
/* for (int i = 0; i < listView1.Items.Count; i++)
{
ListViewItem item = listView1.Items[i];
for (int j = 0; j < item.SubItems.Count; j++)
{
strlist += item.SubItems[j].Text;
}
}*/
if (qxzt == 0)
{
try
{
ddinfo.Dd_num = Convert.ToInt32(comboBox1.SelectedItem);
ddinfo.Zd_num = yhsj;
ddinfo.Dd_name = strlist;
ddinfo.Dd_zj = float.Parse(textBoxzj.Text);
ddinfo.Dd_time = System.DateTime.Now.ToString().Trim();
int id = baseinfo.Adddd(ddinfo);
MessageBox.Show("新增訂單成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "錯(cuò)誤提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
ddinfo.Dd_num = Convert.ToInt32(comboBox1.SelectedItem);
ddinfo.Zd_num = yhsj;
ddinfo.Dd_name = strlist;
ddinfo.Dd_zj = float.Parse(textBoxzj.Text);
int id = baseinfo.Updatedd(ddinfo);
MessageBox.Show("菜品添加成功!");
}
////listView1.Clear();
qxzt = 1;
cancelAll_Enable();
jcBtn.Enabled = true;
}
private void jcBtn_Click(object sender, EventArgs e)
{
jc_Enable();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
DataSet ds = null;
ddinfo.Dd_num = int.Parse(comboBox1.Text.Trim());
ds = baseinfo.FindddByzh(ddinfo, "db_dd");
if (ds == null || ds.Tables.Count == 0 || (ds.Tables.Count == 1 && ds.Tables[0].Rows.Count == 0))
{
comboBox1.Enabled = false;
}
// else { MessageBox.Show("桌號(hào)選擇錯(cuò)誤!請(qǐng)重新選擇");comboBox1.Text = ""; return; }
}
}
}
還有兩個(gè)類文件,可在項(xiàng)目中查看。
部分代碼參考我們學(xué)的課本上的源代碼,代碼只是大作水平,僅供參考學(xué)習(xí)。
更多學(xué)習(xí)資料請(qǐng)關(guān)注專題《管理系統(tǒng)開發(fā)》。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。
上一篇:C#實(shí)現(xiàn)一個(gè)控制臺(tái)的點(diǎn)餐系統(tǒng)
欄 目:C#教程
下一篇:unity shader實(shí)現(xiàn)較完整光照效果
本文標(biāo)題:C#實(shí)現(xiàn)在線點(diǎn)餐系統(tǒng)
本文地址:http://www.jygsgssxh.com/a1/C_jiaocheng/4600.html
您可能感興趣的文章
- 01-10C#實(shí)現(xiàn)txt定位指定行完整實(shí)例
- 01-10WinForm實(shí)現(xiàn)仿視頻播放器左下角滾動(dòng)新聞效果的方法
- 01-10C#實(shí)現(xiàn)清空回收站的方法
- 01-10C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已安裝軟件變化的方法
- 01-10C#實(shí)現(xiàn)多線程下載文件的方法
- 01-10C#實(shí)現(xiàn)Winform中打開網(wǎng)頁(yè)頁(yè)面的方法
- 01-10C#實(shí)現(xiàn)遠(yuǎn)程關(guān)閉計(jì)算機(jī)或重啟計(jì)算機(jī)的方法
- 01-10C#自定義簽名章實(shí)現(xiàn)方法
- 01-10C#文件斷點(diǎn)續(xù)傳實(shí)現(xiàn)方法
- 01-10winform實(shí)現(xiàn)創(chuàng)建最前端窗體的方法


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-10C#通過反射獲取當(dāng)前工程中所有窗體并
- 01-10關(guān)于ASP網(wǎng)頁(yè)無法打開的解決方案
- 01-10WinForm限制窗體不能移到屏幕外的方法
- 01-10WinForm繪制圓角的方法
- 01-10C#實(shí)現(xiàn)txt定位指定行完整實(shí)例
- 01-10WinForm實(shí)現(xiàn)仿視頻播放器左下角滾動(dòng)新
- 01-10C#停止線程的方法
- 01-10C#實(shí)現(xiàn)清空回收站的方法
- 01-10C#通過重寫Panel改變邊框顏色與寬度的
- 01-10C#實(shí)現(xiàn)讀取注冊(cè)表監(jiān)控當(dāng)前操作系統(tǒng)已
隨機(jī)閱讀
- 01-10delphi制作wav文件的方法
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 04-02jquery與jsp,用jquery
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 01-10C#中split用法實(shí)例總結(jié)


