介绍
使用c#怎么编写一个餐饮管理系统?针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
frmBook。cs
using 系统; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using 来; using 包含; using System.Windows.Forms; using 木豆; namespace 餐饮 { public 才能;partial  class frmBook :形式 {才能 ,,,public frmBook () ,,,{ ,,,,,InitializeComponent (); ,,,} ,,,public void getData () ,,,{ ,,,,,string Filter =,,, WHERE 1,=, 1,“; ,,,,,if (txtName.Text.Trim (), !=,,,) ,,,,,{ ,,,,,,,Filter +=,,,以及Name Like & # 39; %,, +, txtName.Text +,“% & # 39;“; ,,,,,} ,,,,,BookEntity book =, new BookEntity (); ,,,,,DataTable dt =, book.Query(过滤器); ,,,,,this.dataGridView1.DataSource =, dt; ,,,,,for (int 小姐:=,1;,小姐:& lt;, this.dataGridView1.Columns.Count;,我+ +) ,,,,,{ ,,,,,,,this.dataGridView1.Columns[我].ReadOnly =,真的; ,,,,,} ,,,} ,,,private void frmBook_Load (object ,发送方,EventArgs e) ,,,{ ,,,,,getData (); ,,,} ,,,//全选 ,,,private void btnChose_Click (object ,发送方,EventArgs e) ,,,{ ,,,,,bool b =,假; ,,,,,if (btnChose.Text ==,“全,选“) ,,,,,{ ,,,,,,,b =,真的; ,,,,,,,btnChose.Text =,“取消全选“; ,,,,,} ,,,,, ,,,,,{ ,,,,,,,b =,假; ,,,,,,,btnChose.Text =,“全,选“; ,,,,,} ,,,,,for (int 小姐:=,0;,小姐:& lt;, this.dataGridView1.Rows.Count;,我+ +) ,,,,,{ ,,,,,,,dataGridView1.Rows[我].Cells [0] .Value =, b; ,,,,,} ,,,,,this.dataGridView1.EndEdit (); ,,,,,this.dataGridView1.CurrentCell =,空; ,,,} ,,,//删除 ,,,private void btnDelete_Click (object ,发送方,EventArgs e) ,,,{ ,,,,,dataGridView1.EndEdit (); ,,,,,dataGridView1.CurrentCell =,空; ,,,,,DataTable dt =,(数据表)this.dataGridView1.DataSource; ,,,,,我们[],drs =, dt.Select(“选择=1“); ,,,,,if (drs.Length ==, 0) ,,,,,{ ,,,,,,,MessageBox.Show(“请选择要删除的记录!“); ,,,,,,,返回; ,,,,,} ,,,,,foreach (DataRow dr  drs拷贝) ,,,,,{ ,,,,,,,BookEntity book =, new BookEntity (); ,,,,,,,book.Id =, Convert.ToInt32(博士(“编号“].ToString ()); ,,,,,,,book.Delete (); ,,,,,} ,,,,,MessageBox.Show(“删除成功!“); ,,,,,getData (); ,,,} ,,,//查询 ,,,private void btnSearch_Click (object ,发送方,EventArgs e) ,,,{ ,,,,,getData (); ,,,} ,,,//双击修改 null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null使用c#怎么编写一个餐饮管理系统