SoFunction
Updated on 2025-03-06

C# implements catering management system

This article shares the specific code of C# implementing the catering management system for your reference. The specific content is as follows

This system uses Winfrom and technology in C# language to build a simple CS system.

Part of the code:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using DAL;

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

      if (() != "")
      {
        Filter += " AND Name Like '%" +  + "%'";

      }

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

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

    }

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

    //Select all    private void btnChose_Click(object sender, EventArgs e)
    {
      bool b = false;
      if ( == "Select all")
      {
        b = true;
         = "Cancel all";
      }
      else
      {
        b = false;
         = "Select all";
      }

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

    //delete    private void btnDelete_Click(object sender, EventArgs e)
    {
      ();
       = null;
      DataTable dt = (DataTable)this.;
      DataRow[] drs = ("choose=1");
      if ( == 0)
      {
        ("Please select the record you want to delete!");
        return;
      }
      foreach (DataRow dr in drs)
      {
        BookEntity book = new BookEntity();
         = Convert.ToInt32(dr["serial number"].ToString());
        ();
      }
      ("Delete successfully!");
      getData();
    }

    //Inquiry    private void btnSearch_Click(object sender, EventArgs e)
    {
      getData();
    }

    //Double click to modify    private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
    {
      if (this. > -1)
      {
        frmBookEdit frm = new frmBookEdit();
         = ;
        
         = [1].();
        if (() == )
        {
          getData();
        }
      }
    }
  }
}

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using DAL;

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

    private void frmControl_Load(object sender, EventArgs e)
    {
      #region Generate table information
      TableNoEntity table = new TableNoEntity();
      DataTable dt = (" ORDER BY DispalyIndex ");
      int x = 46;
      int y = 66;
      int width = 150;
      int height = 95;

      //Dynamic table generation      for (int i = 0; i < ; i = i + 5)
      {
        for (int j = 0; j < 5 && (i + j) < ; j++)
        {
          DataRow dr = [i + j];
          //Generate dining table picture control          PictureBox pictureBox = new PictureBox();
           = this.contextMenuStrip1;

           = ( + "\\res\\green.gif");
          
          //Judge whether there is a reservation          BookEntity book = new BookEntity();
          DataTable dat = (" where TableNo ='" + dr["TableNo"] + "' AND BookTime>getdate()");
          if ( > 0)
          {
             = ( + "\\res\\yellow.gif");
          }

          //Judge whether it is in use          OrdersEntity orders = new OrdersEntity();
          DataTable dats = (" where TableNo ='" + dr["TableNo"] + "' and PayORnot ='no'");

          if ( > 0)
          {
             = ( + "\\res\\red.gif");
          }
           = new (x, y);
           = "pictureBox_" + dr["TableNo"].ToString();
           = new (width, height);
           = false;
           = true;
          ();
          (pictureBox);

          //Generate table instructions information          Label lbl = new Label();
           = "lbl_" + dr["TableNo"].ToString();
           = dr["TableNo"].ToString() + " " + dr["SitCount"].ToString() + "seat";
           = new Font("Song-style", 10);
           = ;
           = new Point(25, 30);
          (lbl);

          x = x + 200;

        }

        y = y + 150;
        x = 46;
      }

      #endregion


    }

    private void ReserveToolStripMenuItem_Click(object sender, EventArgs e)
    {
      string Name = ;
      string[] str = ('_');
      frmBookEdit frm = new frmBookEdit();
       = ;

       = true;
       = str[1];
      if (() == )
      {
        ((PictureBox)).Image = ( + "\\res\\yellow.gif");
      }
    }




    private void Bill, pleaseToolStripMenuItem_Click(object sender, EventArgs e)
    {
      string Name = ;
      string[] str = ('_');
      frmPayEdit frm = new frmPayEdit();
       = ;
      // = true;
       = str[1];
      if (() == )
      {
        ((PictureBox)).Image = ( + "\\res\\green.gif");
      }


    }

    private void UnsubscribeToolStripMenuItem_Click(object sender, EventArgs e)
    {

    }

    private void Order dishesToolStripMenuItem1_Click(object sender, EventArgs e)
    {
      string Name = ;
      string[] str = ('_');
      frmOrdersEdit frm = new frmOrdersEdit();
       = ;
       = true;
       = str[1];
      if (() == )
      {
        ((PictureBox)).Image = ( + "\\res\\red.gif");
      }

    }

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


  }
}

Source code download:C# implements catering management system

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.