欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)餐飲管理系統(tǒng)

 更新時(shí)間:2019年01月31日 10:09:07   作者:wxtydd123  
這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)餐飲管理系統(tǒng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了C#實(shí)現(xiàn)餐飲管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

此系統(tǒng)采用C#語(yǔ)言的Winfrom和ADO.NET技術(shù)搭建的簡(jiǎn)單的CS系統(tǒng)。

部分代碼:

frmBook.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;

namespace Catering
{
  public partial class frmBook : Form
  {
    public frmBook()
    {
      InitializeComponent();
    }
    public void getData()
    {
      string Filter = " WHERE 1 = 1 ";

      if (txtName.Text.Trim() != "")
      {
        Filter += " AND Name Like '%" + txtName.Text + "%'";

      }

      BookEntity book = new BookEntity();
      DataTable dt = book.Query(Filter);
      this.dataGridView1.DataSource = dt;

      for (int i = 1; i < this.dataGridView1.Columns.Count; i++)
      {
        this.dataGridView1.Columns[i].ReadOnly = true;
      }

    }

    private void frmBook_Load(object sender, EventArgs e)
    {
      getData();
    }

    //全選
    private void btnChose_Click(object sender, EventArgs e)
    {
      bool b = false;
      if (btnChose.Text == "全 選")
      {
        b = true;
        btnChose.Text = "取消全選";
      }
      else
      {
        b = false;
        btnChose.Text = "全 選";
      }

      for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
      {
        dataGridView1.Rows[i].Cells[0].Value = b;
      }
      this.dataGridView1.EndEdit();
      this.dataGridView1.CurrentCell = null;
    }

    //刪除
    private void btnDelete_Click(object sender, EventArgs e)
    {
      dataGridView1.EndEdit();
      dataGridView1.CurrentCell = null;
      DataTable dt = (DataTable)this.dataGridView1.DataSource;
      DataRow[] drs = dt.Select("選擇=1");
      if (drs.Length == 0)
      {
        MessageBox.Show("請(qǐng)選擇要?jiǎng)h除的記錄!");
        return;
      }
      foreach (DataRow dr in drs)
      {
        BookEntity book = new BookEntity();
        book.Id = Convert.ToInt32(dr["編號(hào)"].ToString());
        book.Delete();
      }
      MessageBox.Show("刪除成功!");
      getData();
    }

    //查詢(xún)
    private void btnSearch_Click(object sender, EventArgs e)
    {
      getData();
    }

    //雙擊修改
    private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
    {
      if (this.dataGridView1.CurrentRow.Index > -1)
      {
        frmBookEdit frm = new frmBookEdit();
        frm.StartPosition = FormStartPosition.CenterScreen;
        
        frm.IdNo = dataGridView1.CurrentRow.Cells[1].Value.ToString();
        if (frm.ShowDialog() == DialogResult.OK)
        {
          getData();
        }
      }
    }
  }
}

frmControl.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;

namespace Catering
{
  public partial class frmControl : Form
  {
    public frmControl()
    {
      InitializeComponent();
    }

    private void frmControl_Load(object sender, EventArgs e)
    {
      #region 生成餐桌信息

      TableNoEntity table = new TableNoEntity();
      DataTable dt = table.Query(" ORDER BY DispalyIndex ");
      int x = 46;
      int y = 66;
      int width = 150;
      int height = 95;

      //動(dòng)態(tài)生成餐臺(tái)
      for (int i = 0; i < dt.Rows.Count; i = i + 5)
      {
        for (int j = 0; j < 5 && (i + j) < dt.Rows.Count; j++)
        {
          DataRow dr = dt.Rows[i + j];
          //生成餐臺(tái)圖片控件
          PictureBox pictureBox = new PictureBox();
          pictureBox.ContextMenuStrip = this.contextMenuStrip1;

          pictureBox.Image = Image.FromFile(Application.StartupPath + "\\res\\綠.gif");
          
          //判斷是否有預(yù)定
          BookEntity book = new BookEntity();
          DataTable dat = book.Query(" where TableNo ='" + dr["TableNo"] + "' AND BookTime>getdate()");
          if (dat.Rows.Count > 0)
          {
            pictureBox.Image = Image.FromFile(Application.StartupPath + "\\res\\黃.gif");
          }

          //判斷是否在使用
          OrdersEntity orders = new OrdersEntity();
          DataTable dats = orders.Query(" where TableNo ='" + dr["TableNo"] + "' and PayORnot ='否'");

          if (dats.Rows.Count > 0)
          {
            pictureBox.Image = Image.FromFile(Application.StartupPath + "\\res\\紅.gif");
          }
          pictureBox.Location = new System.Drawing.Point(x, y);
          pictureBox.Name = "pictureBox_" + dr["TableNo"].ToString();
          pictureBox.Size = new System.Drawing.Size(width, height);
          pictureBox.TabStop = false;
          pictureBox.Visible = true;
          pictureBox.SendToBack();
          this.Controls.Add(pictureBox);

          //生成餐臺(tái)說(shuō)明信息
          Label lbl = new Label();
          lbl.Name = "lbl_" + dr["TableNo"].ToString();
          lbl.Text = dr["TableNo"].ToString() + " " + dr["SitCount"].ToString() + "座位";
          lbl.Font = new Font("宋體", 10);
          lbl.BackColor = Color.Transparent;
          lbl.Location = new Point(25, 30);
          pictureBox.Controls.Add(lbl);

          x = x + 200;

        }

        y = y + 150;
        x = 46;
      }

      #endregion


    }

    private void 預(yù)定ToolStripMenuItem_Click(object sender, EventArgs e)
    {
      string Name = contextMenuStrip1.SourceControl.Name;
      string[] str = Name.Split('_');
      frmBookEdit frm = new frmBookEdit();
      frm.StartPosition = FormStartPosition.CenterScreen;

      frm.TopMost = true;
      frm.Id = str[1];
      if (frm.ShowDialog() == DialogResult.OK)
      {
        ((PictureBox)contextMenuStrip1.SourceControl).Image = Image.FromFile(Application.StartupPath + "\\res\\黃.gif");
      }
    }




    private void 結(jié)賬ToolStripMenuItem_Click(object sender, EventArgs e)
    {
      string Name = contextMenuStrip1.SourceControl.Name;
      string[] str = Name.Split('_');
      frmPayEdit frm = new frmPayEdit();
      frm.StartPosition = FormStartPosition.CenterScreen;
      //frm.TopMost = true;
      frm.Id = str[1];
      if (frm.ShowDialog() == DialogResult.OK)
      {
        ((PictureBox)contextMenuStrip1.SourceControl).Image = Image.FromFile(Application.StartupPath + "\\res\\綠.gif");
      }


    }

    private void 退訂ToolStripMenuItem_Click(object sender, EventArgs e)
    {

    }

    private void 點(diǎn)菜ToolStripMenuItem1_Click(object sender, EventArgs e)
    {
      string Name = contextMenuStrip1.SourceControl.Name;
      string[] str = Name.Split('_');
      frmOrdersEdit frm = new frmOrdersEdit();
      frm.StartPosition = FormStartPosition.CenterScreen;
      frm.TopMost = true;
      frm.Id = str[1];
      if (frm.ShowDialog() == DialogResult.OK)
      {
        ((PictureBox)contextMenuStrip1.SourceControl).Image = Image.FromFile(Application.StartupPath + "\\res\\紅.gif");
      }

    }

    private void btnRefesh_Click(object sender, EventArgs e)
    {
      
    }


  }
}

源碼下載:C#實(shí)現(xiàn)餐飲管理系統(tǒng)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C#實(shí)現(xiàn)類(lèi)型的比較示例詳解

    C#實(shí)現(xiàn)類(lèi)型的比較示例詳解

    這篇文章主要給大家介紹了關(guān)于C#實(shí)現(xiàn)類(lèi)型的比較的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用C#具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • C#中線程同步對(duì)象的方法分析

    C#中線程同步對(duì)象的方法分析

    這篇文章主要介紹了C#中線程同步對(duì)象的方法,較為詳細(xì)的分析了線程同步的原理與實(shí)現(xiàn)方法,并給出了實(shí)例總結(jié),是比較實(shí)用的技巧,需要的朋友可以參考下
    2014-12-12
  • C#實(shí)現(xiàn)Stripe支付的方法實(shí)踐

    C#實(shí)現(xiàn)Stripe支付的方法實(shí)踐

    本文主要介紹了C#實(shí)現(xiàn)Stripe支付的方法實(shí)踐,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • C#中圖片、二進(jìn)制與字符串的相互轉(zhuǎn)換方法

    C#中圖片、二進(jìn)制與字符串的相互轉(zhuǎn)換方法

    這篇文章主要介紹了C#中圖片、二進(jìn)制與字符串的相互轉(zhuǎn)換方法,涉及C#針對(duì)不同數(shù)據(jù)類(lèi)型的解析與轉(zhuǎn)換操作技巧,需要的朋友可以參考下
    2016-06-06
  • C#判斷程序是否是管理員權(quán)限運(yùn)行的方法代碼示例

    C#判斷程序是否是管理員權(quán)限運(yùn)行的方法代碼示例

    這篇文章主要介紹了C#判斷程序是否是管理員權(quán)限運(yùn)行的方法代碼示例,本文直接給出實(shí)現(xiàn)代碼例子,需要的朋友可以參考下
    2015-03-03
  • c# 可疑文件掃描代碼(找到木馬)(簡(jiǎn))

    c# 可疑文件掃描代碼(找到木馬)(簡(jiǎn))

    c# 可疑文件掃描代碼(找到木馬),需要的朋友可以參考下。
    2010-05-05
  • C#驗(yàn)證身份證的函數(shù)

    C#驗(yàn)證身份證的函數(shù)

    因做項(xiàng)目需要,參考網(wǎng)上資料寫(xiě)了一個(gè)身份證驗(yàn)證的C#方法,本方法是在VS2005[C/S] 下寫(xiě)的。前面2個(gè)是網(wǎng)友們的實(shí)現(xiàn)方法,第三個(gè)才是項(xiàng)目中使用的哦,小伙伴們參考下吧。
    2015-05-05
  • C# 打開(kāi)電子郵件軟件的具體方法

    C# 打開(kāi)電子郵件軟件的具體方法

    這篇文章介紹了C# 打開(kāi)電子郵件軟件的具體方法,有需要的朋友可以參考一下
    2013-11-11
  • asp.net頁(yè)面中如何獲取Excel表的內(nèi)容

    asp.net頁(yè)面中如何獲取Excel表的內(nèi)容

    在瀏覽網(wǎng)頁(yè)時(shí),一定會(huì)看到我們需要保存的信息,我們比較常用的方法就是拖動(dòng)鼠標(biāo),選中我們需要的內(nèi)容,然后ctrl+c,然后在保持到excel當(dāng)中去,那么如何用asp.net獲取excel表的內(nèi)容呢,下面小編就給大家介紹asp.net獲取excel表的內(nèi)容,需要的朋友可以參考下
    2015-08-08
  • C#創(chuàng)建磁性窗體的實(shí)現(xiàn)方法

    C#創(chuàng)建磁性窗體的實(shí)現(xiàn)方法

    經(jīng)常會(huì)遇到一種情況,即當(dāng)拖動(dòng)一個(gè)窗體(主窗體)時(shí),其他窗體(子窗體)隨著該窗體移動(dòng),當(dāng)拖動(dòng)子窗體時(shí),其他窗體將不跟隨移動(dòng),這就是磁性窗體,所以本文給大家介紹了C#創(chuàng)建磁性窗體的實(shí)現(xiàn)方法,需要的朋友可以參考下
    2024-04-04

最新評(píng)論