SoFunction
Updated on 2025-03-08

C# realizes the complete version of the catering management system

The complete version of C# catering management system is for everyone to share and learn together.

Part of the code:

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;

/// <summary>
///Summary description of Dataoperator/// </summary>
public class Dataoperator
{
 public Dataoperator()
 {
 //
 //TODO: Add constructor logic here //
 }
  public static SqlConnection creatcon()
  {
    string strcon = ["ConnStr"].ConnectionString;

    SqlConnection con = new SqlConnection(strcon);
    return con;
  }
/// Whether the query data already exists  /// </summary>
  /// <param name="sql">SQL statements that need to be executed</param>  /// <returns> Returns a boolean value, true means already exist, false means not exist</returns>  public static bool isData(string sql)
  {
    //Create a database connection    SqlConnection con = creatcon();
    //Open the database connection    ();
    //Create Command object    SqlCommand com = new SqlCommand(sql, con);
    //Get the value returned by the ExecuteScalar method    int ex = Convert.ToInt32(());
    //Close the database connection    ();
    //Judge integer variable and return the corresponding boolean value    if (ex &gt; 0)
    {
      return true;
    }
    else
    {
      return false;
    }


  }
  /// Perform update, insert, and delete operations in the database  /// &lt;/summary&gt;
  /// <param name="sql">SQL statements that need to be executed</param>  /// <returns> Returns a boolean value, true means already exist, false means not exist</returns>  public static bool exSql(string sql)
  {
    SqlConnection con = creatcon();
    ();
    SqlCommand com = new SqlCommand(sql, con);
    int rows = Convert.ToInt32(());
    if (rows &gt; 0)
      return true;
    else
      return false;


  }
  public static string getTier(string sql) //Return the value of the specified column  {
    //SqlConnection con = creatcon()
    //();
    //SqlCommand cmd = new SqlCommand(sql, con);
    //// Obtain record line    //SqlDataReader sdr = ();
    //();
    //string str = sdr[0].ToString();
    //();
    //return str;
    SqlConnection con = creatcon();
    SqlDataAdapter sda = new SqlDataAdapter(sql, con);
    DataSet ds = new DataSet();
    (ds);
    string str = [0].Rows[0][0].ToString();
    return str;
  }

  public static DataSet getRows(string sql)  //Return all data in the query table  {

    //Create a database connection    SqlConnection con = creatcon();
    //Open the data connection    //Create DataAdapter object    SqlDataAdapter sda = new SqlDataAdapter(sql, con);
    //Create DataSet object    DataSet ds = new DataSet();
    //By Fill method    (ds);
    //Close the database connection    //Return DataSet object    return ds;


  }
   
}

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;

/// &lt;summary&gt;
///Summary description of MessageBox/// &lt;/summary&gt;
public class MessageBox
{
 public MessageBox()
 {
 //
 //TODO: Add constructor logic here //
 }
  public static void Show(string messageInfo)
  {
    ("&lt;script&gt;alert('"+messageInfo+"')&lt;/script&gt;");
  }
  public static void Show(string messageInfo, string pagePath)
  {
    ("&lt;script&gt;alert('"+messageInfo+"');location='"+pagePath+"'&lt;/script&gt;");
  }
  public static void ShowPath(string pagePath)
  {
    ("&lt;script&gt;location='" + pagePath + "'&lt;/script&gt;");
  }
}

#pragma warning disable 1591
//------------------------------------------------------------------------------
// &lt;auto-generated&gt;
// This code is generated by the tool.// Runtime library version: 2.0.50727.1891//
// Changes to this file may cause incorrect behavior and if// Regenerate the code and these changes will be lost.// &lt;/auto-generated&gt;
//------------------------------------------------------------------------------

using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;


[(Name="MenuLinq")]
public partial class UserInformationDataContext : 
{
 
 private static  mappingSource = new AttributeMappingSource();
 
 #region Extensibility Method Definitions
 partial void OnCreated();
 partial void InsertUser Information(User Information instance);
 partial void UpdateUser Information(User Information instance);
 partial void DeleteUser Information(User Information instance);
 partial void InsertOrdering information(Ordering information instance);
 partial void UpdateOrdering information(Ordering information instance);
 partial void DeleteOrdering information(Ordering information instance);
 partial void InsertVegetable sample information(Vegetable sample information instance);
 partial void UpdateVegetable sample information(Vegetable sample information instance);
 partial void DeleteVegetable sample information(Vegetable sample information instance);
 #endregion
 
 public UserInformationDataContext() : 
  base(global::["ConnStr"].ConnectionString, mappingSource)
 {
 OnCreated();
 }
 
 public UserInformationDataContext(string connection) : 
  base(connection, mappingSource)
 {
 OnCreated();
 }
 
 public UserInformationDataContext( connection) : 
  base(connection, mappingSource)
 {
 OnCreated();
 }
 
 public UserInformationDataContext(string connection,  mappingSource) : 
  base(connection, mappingSource)
 {
 OnCreated();
 }
 
 public UserInformationDataContext( connection,  mappingSource) : 
  base(connection, mappingSource)
 {
 OnCreated();
 }
 
 public &lt;User Information&gt; User Information
 {
 get
 {
  return &lt;User Information&gt;();
 }
 }
 
 public &lt;Ordering information&gt; Ordering information
 {
 get
 {
  return &lt;Ordering information&gt;();
 }
 }
 
 public &lt;Vegetable sample information&gt; Vegetable sample information
 {
 get
 {
  return &lt;Vegetable sample information&gt;();
 }
 }
}

[Table(Name="dbo.user information")]
public partial class User Information : INotifyPropertyChanging, INotifyPropertyChanged
{
 
 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs();
 
 private int _Serial number;
 
 private string _username;
 
 private string _User Password;
 
 private string _Mail;
 
 private string _address;
 
 private string _Phone number;
 
  #region Extensibility Method Definitions
  partial void OnLoaded();
  partial void OnValidate( action);
  partial void OnCreated();
  partial void OnSerial numberChanging(int value);
  partial void OnSerial numberChanged();
  partial void OnusernameChanging(string value);
  partial void OnusernameChanged();
  partial void OnUser PasswordChanging(string value);
  partial void OnUser PasswordChanged();
  partial void OnMailChanging(string value);
  partial void OnMailChanged();
  partial void OnaddressChanging(string value);
  partial void OnaddressChanged();
  partial void OnPhone numberChanging(string value);
  partial void OnPhone numberChanged();
  #endregion
 
 public User Information()
 {
 OnCreated();
 }
 
 [Column(Storage="_Serial Number", AutoSync=, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
 public int Serial number
 {
 get
 {
  return this._Serial number;
 }
 set
 {
  if ((this._Serial number != value))
  {
  Serial numberChanging(value);
  ();
  this._Serial number = value;
  ("Serial Number");
  Serial numberChanged();
  }
 }
 }
 
 [Column(Storage="_username", DbType="NChar(10)")]
 public string username
 {
 get
 {
  return this._username;
 }
 set
 {
  if ((this._username != value))
  {
  usernameChanging(value);
  ();
  this._username = value;
  ("username");
  usernameChanged();
  }
 }
 }
 
 [Column(Storage="_User Password", DbType="VarChar(50)")]
 public string User Password
 {
 get
 {
  return this._User Password;
 }
 set
 {
  if ((this._User Password != value))
  {
  User PasswordChanging(value);
  ();
  this._User Password = value;
  ("User Password");
  User PasswordChanged();
  }
 }
 }
 
 [Column(Storage="_Mail", DbType="VarChar(50)")]
 public string Mail
 {
 get
 {
  return this._Mail;
 }
 set
 {
  if ((this._Mail != value))
  {
  MailChanging(value);
  ();
  this._Mail = value;
  ("Mail");
  MailChanged();
  }
 }
 }
 
 [Column(Storage="_address", DbType="VarChar(50)")]
 public string address
 {
 get
 {
  return this._address;
 }
 set
 {
  if ((this._address != value))
  {
  addressChanging(value);
  ();
  this._address = value;
  ("address");
  addressChanged();
  }
 }
 }
 
 [Column(Storage="_Phone number", DbType="VarChar(50)")]
 public string Phone number
 {
 get
 {
  return this._Phone number;
 }
 set
 {
  if ((this._Phone number != value))
  {
  Phone numberChanging(value);
  ();
  this._Phone number = value;
  ("Phone number");
  Phone numberChanged();
  }
 }
 }
 
 public event PropertyChangingEventHandler PropertyChanging;
 
 public event PropertyChangedEventHandler PropertyChanged;
 
 protected virtual void SendPropertyChanging()
 {
 if (( != null))
 {
  (this, emptyChangingEventArgs);
 }
 }
 
 protected virtual void SendPropertyChanged(String propertyName)
 {
 if (( != null))
 {
  (this, new PropertyChangedEventArgs(propertyName));
 }
 }
}

[Table(Name="dbo.Subscription Information")]
public partial class Ordering information : INotifyPropertyChanging, INotifyPropertyChanged
{
 
 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs();
 
 private int _Serial number;
 
 private &lt;int&gt; _Vegetable sample number;
 
 private string _Dish name;
 
 private string _Vegetable sample pictures;
 
 private &lt;int&gt; _Number of copies;
 
 private &lt;int&gt; _Vegetable price;
 
 private &lt;int&gt; _Amounts payable;
 
 private string _Order date;
 
 private string _username;
 
  #region Extensibility Method Definitions
  partial void OnLoaded();
  partial void OnValidate( action);
  partial void OnCreated();
  partial void OnSerial numberChanging(int value);
  partial void OnSerial numberChanged();
  partial void OnVegetable sample numberChanging(&lt;int&gt; value);
  partial void OnVegetable sample numberChanged();
  partial void OnDish nameChanging(string value);
  partial void OnDish nameChanged();
  partial void OnVegetable sample picturesChanging(string value);
  partial void OnVegetable sample picturesChanged();
  partial void OnNumber of copiesChanging(&lt;int&gt; value);
  partial void OnNumber of copiesChanged();
  partial void OnVegetable priceChanging(&lt;int&gt; value);
  partial void OnVegetable priceChanged();
  partial void OnAmounts payableChanging(&lt;int&gt; value);
  partial void OnAmounts payableChanged();
  partial void OnOrder dateChanging(string value);
  partial void OnOrder dateChanged();
  partial void OnusernameChanging(string value);
  partial void OnusernameChanged();
  #endregion
 
 public Ordering information()
 {
 OnCreated();
 }
 
 [Column(Storage="_Serial Number", AutoSync=, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
 public int Serial number
 {
 get
 {
  return this._Serial number;
 }
 set
 {
  if ((this._Serial number != value))
  {
  Serial numberChanging(value);
  ();
  this._Serial number = value;
  ("Serial Number");
  Serial numberChanged();
  }
 }
 }
 
 [Column(Storage="_Dish Sample Number", DbType="Int")]
 public &lt;int&gt; Vegetable sample number
 {
 get
 {
  return this._Vegetable sample number;
 }
 set
 {
  if ((this._Vegetable sample number != value))
  {
  Vegetable sample numberChanging(value);
  ();
  this._Vegetable sample number = value;
  ("Dish sample number");
  Vegetable sample numberChanged();
  }
 }
 }
 
 [Column(Storage="_Dish Name", DbType="NChar(10)")]
 public string Dish name
 {
 get
 {
  return this._Dish name;
 }
 set
 {
  if ((this._Dish name != value))
  {
  Dish nameChanging(value);
  ();
  this._Dish name = value;
  ("Dish Name");
  Dish nameChanged();
  }
 }
 }
 
 [Column(Storage="_Dish-like pictures", DbType="NChar(30)")]
 public string Vegetable sample pictures
 {
 get
 {
  return this._Vegetable sample pictures;
 }
 set
 {
  if ((this._Vegetable sample pictures != value))
  {
  Vegetable sample picturesChanging(value);
  ();
  this._Vegetable sample pictures = value;
  ("Dish-like picture");
  Vegetable sample picturesChanged();
  }
 }
 }
 
 [Column(Storage="_Number of copies", DbType="Int")]
 public &lt;int&gt; Number of copies
 {
 get
 {
  return this._Number of copies;
 }
 set
 {
  if ((this._Number of copies != value))
  {
  Number of copiesChanging(value);
  ();
  this._Number of copies = value;
  ("Count");
  Number of copiesChanged();
  }
 }
 }
 
 [Column(Storage="_Vegetable Price", DbType="Int")]
 public &lt;int&gt; Vegetable price
 {
 get
 {
  return this._Vegetable price;
 }
 set
 {
  if ((this._Vegetable price != value))
  {
  Vegetable priceChanging(value);
  ();
  this._Vegetable price = value;
  ("Vegetable Price");
  Vegetable priceChanged();
  }
 }
 }
 
 [Column(Storage="_Amount Payable", DbType="Int")]
 public &lt;int&gt; Amounts payable
 {
 get
 {
  return this._Amounts payable;
 }
 set
 {
  if ((this._Amounts payable != value))
  {
  Amounts payableChanging(value);
  ();
  this._Amounts payable = value;
  ("Amount Payable");
  Amounts payableChanged();
  }
 }
 }
 
 [Column(Storage="_Date of ordering", DbType="NVarChar(50)")]
 public string Order date
 {
 get
 {
  return this._Order date;
 }
 set
 {
  if ((this._Order date != value))
  {
  Order dateChanging(value);
  ();
  this._Order date = value;
  ("Date of ordering");
  Order dateChanged();
  }
 }
 }
 
 [Column(Storage="_username", DbType="NChar(15)")]
 public string username
 {
 get
 {
  return this._username;
 }
 set
 {
  if ((this._username != value))
  {
  usernameChanging(value);
  ();
  this._username = value;
  ("username");
  usernameChanged();
  }
 }
 }
 
 public event PropertyChangingEventHandler PropertyChanging;
 
 public event PropertyChangedEventHandler PropertyChanged;
 
 protected virtual void SendPropertyChanging()
 {
 if (( != null))
 {
  (this, emptyChangingEventArgs);
 }
 }
 
 protected virtual void SendPropertyChanged(String propertyName)
 {
 if (( != null))
 {
  (this, new PropertyChangedEventArgs(propertyName));
 }
 }
}

[Table(Name="dbo.dish sample information")]
public partial class Vegetable sample information : INotifyPropertyChanging, INotifyPropertyChanged
{
 
 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs();
 
 private int _Serial number;
 
 private int _Vegetable sample number;
 
 private string _Dish name;
 
 private string _Type of dish sample;
 
 private string _Vegetable sample pictures;
 
 private string _chef;
 
 private &lt;int&gt; _Price now;
 
 private &lt;int&gt; _Discounted Price;
 
 private string _Time for creating dishes;
 
  #region Extensibility Method Definitions
  partial void OnLoaded();
  partial void OnValidate( action);
  partial void OnCreated();
  partial void OnSerial numberChanging(int value);
  partial void OnSerial numberChanged();
  partial void OnVegetable sample numberChanging(int value);
  partial void OnVegetable sample numberChanged();
  partial void OnDish nameChanging(string value);
  partial void OnDish nameChanged();
  partial void OnType of dish sampleChanging(string value);
  partial void OnType of dish sampleChanged();
  partial void OnVegetable sample picturesChanging(string value);
  partial void OnVegetable sample picturesChanged();
  partial void OnchefChanging(string value);
  partial void OnchefChanged();
  partial void OnPrice nowChanging(&lt;int&gt; value);
  partial void OnPrice nowChanged();
  partial void OnDiscounted PriceChanging(&lt;int&gt; value);
  partial void OnDiscounted PriceChanged();
  partial void OnTime for creating dishesChanging(string value);
  partial void OnTime for creating dishesChanged();
  #endregion
 
 public Vegetable sample information()
 {
 OnCreated();
 }
 
 [Column(Storage="_Serial Number", AutoSync=, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
 public int Serial number
 {
 get
 {
  return this._Serial number;
 }
 set
 {
  if ((this._Serial number != value))
  {
  Serial numberChanging(value);
  ();
  this._Serial number = value;
  ("Serial Number");
  Serial numberChanged();
  }
 }
 }
 
 [Column(Storage="_Dish Sample Number", DbType="Int NOT NULL")]
 public int Vegetable sample number
 {
 get
 {
  return this._Vegetable sample number;
 }
 set
 {
  if ((this._Vegetable sample number != value))
  {
  Vegetable sample numberChanging(value);
  ();
  this._Vegetable sample number = value;
  ("Dish sample number");
  Vegetable sample numberChanged();
  }
 }
 }
 
 [Column(Storage="_Dish Name", DbType="NChar(10)")]
 public string Dish name
 {
 get
 {
  return this._Dish name;
 }
 set
 {
  if ((this._Dish name != value))
  {
  Dish nameChanging(value);
  ();
  this._Dish name = value;
  ("Dish Name");
  Dish nameChanged();
  }
 }
 }
 
 [Column(Storage="_Dish Sample Type", DbType="NChar(10)")]
 public string Type of dish sample
 {
 get
 {
  return this._Type of dish sample;
 }
 set
 {
  if ((this._Type of dish sample != value))
  {
  Type of dish sampleChanging(value);
  ();
  this._Type of dish sample = value;
  ("Dish Sample Type");
  Type of dish sampleChanged();
  }
 }
 }
 
 [Column(Storage="_Dish-like pictures", DbType="NVarChar(50)")]
 public string Vegetable sample pictures
 {
 get
 {
  return this._Vegetable sample pictures;
 }
 set
 {
  if ((this._Vegetable sample pictures != value))
  {
  Vegetable sample picturesChanging(value);
  ();
  this._Vegetable sample pictures = value;
  ("Dish-like picture");
  Vegetable sample picturesChanged();
  }
 }
 }
 
 [Column(Storage="_chef", DbType="NChar(15)")]
 public string chef
 {
 get
 {
  return this._chef;
 }
 set
 {
  if ((this._chef != value))
  {
  chefChanging(value);
  ();
  this._chef = value;
  ("chef");
  chefChanged();
  }
 }
 }
 
 [Column(Storage="_Price Now", DbType="Int")]
 public &lt;int&gt; Price now
 {
 get
 {
  return this._Price now;
 }
 set
 {
  if ((this._Price now != value))
  {
  Price nowChanging(value);
  ();
  this._Price now = value;
  ("Price now");
  Price nowChanged();
  }
 }
 }
 
 [Column(Storage="_Promotional Price", DbType="Int")]
 public &lt;int&gt; Discounted Price
 {
 get
 {
  return this._Discounted Price;
 }
 set
 {
  if ((this._Discounted Price != value))
  {
  Discounted PriceChanging(value);
  ();
  this._Discounted Price = value;
  ("Promotional Price");
  Discounted PriceChanged();
  }
 }
 }
 
 [Column(Storage="_Creation time", DbType="NChar(20)")]
 public string Time for creating dishes
 {
 get
 {
  return this._Time for creating dishes;
 }
 set
 {
  if ((this._Time for creating dishes != value))
  {
  Time for creating dishesChanging(value);
  ();
  this._Time for creating dishes = value;
  ("Cooking time");
  Time for creating dishesChanged();
  }
 }
 }
 
 public event PropertyChangingEventHandler PropertyChanging;
 
 public event PropertyChangedEventHandler PropertyChanged;
 
 protected virtual void SendPropertyChanging()
 {
 if (( != null))
 {
  (this, emptyChangingEventArgs);
 }
 }
 
 protected virtual void SendPropertyChanged(String propertyName)
 {
 if (( != null))
 {
  (this, new PropertyChangedEventArgs(propertyName));
 }
 }
}
#pragma warning restore 1591

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.