C#实现餐饮管理系统完整版

这篇文章主要为大家详细介绍了C#实现餐饮管理系统的完整版,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

完整版的C#餐饮管理系统,供大家一起共同分享学习。

部分代码:

Dataoperator.cs

 using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; ///  ///Dataoperator 的摘要说明 ///  public class Dataoperator { public Dataoperator() { // //TODO: 在此处添加构造函数逻辑 // } public static SqlConnection creatcon() { string strcon = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection con = new SqlConnection(strcon); return con; } /// 查询的数据是否已经存在 ///  /// 需要执行的SQL语句 /// 返回布尔值,true表示已经存在,false表示不存在 public static bool isData(string sql) { //创建数据库连接 SqlConnection con = creatcon(); //打开数据库连接 con.Open(); //创建Command对象 SqlCommand com = new SqlCommand(sql, con); //获取ExecuteScalar方法所返回的值 int ex = Convert.ToInt32(com.ExecuteScalar()); //关闭数据库连接 con.Close(); //判断整型变量并返回相应的布尔值 if (ex > 0) { return true; } else { return false; } } /// 执行数据库中的更新、插入、删除操作 ///  /// 需要执行的SQL语句 /// 返回布尔值,true表示已存在,false表示不存在 public static bool exSql(string sql) { SqlConnection con = creatcon(); con.Open(); SqlCommand com = new SqlCommand(sql, con); int rows = Convert.ToInt32(com.ExecuteNonQuery()); if (rows > 0) return true; else return false; } public static string getTier(string sql) //返回指定列的值 { //SqlConnection con = creatcon() //con.Open(); //SqlCommand cmd = new SqlCommand(sql, con); ////获得记录行 //SqlDataReader sdr = cmd.ExecuteReader(); //sdr.Read(); //string str = sdr[0].ToString(); //con.Close(); //return str; SqlConnection con = creatcon(); SqlDataAdapter sda = new SqlDataAdapter(sql, con); DataSet ds = new DataSet(); sda.Fill(ds); string str = ds.Tables[0].Rows[0][0].ToString(); return str; } public static DataSet getRows(string sql)  //返回所查询表中所有数据 { //创建数据库连接 SqlConnection con = creatcon(); //打开数据连接 //创建DataAdapter对象 SqlDataAdapter sda = new SqlDataAdapter(sql, con); //创建DataSet对象 DataSet ds = new DataSet(); //通过Fill方法 sda.Fill(ds); //关闭数据库连接 //返回DataSet对象 return ds; } }

MessageBox.cs

 using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; ///  ///MessageBox 的摘要说明 ///  public class MessageBox { public MessageBox() { // //TODO: 在此处添加构造函数逻辑 // } public static void Show(string messageInfo) { HttpContext.Current.Response.Write(""); } public static void Show(string messageInfo, string pagePath) { HttpContext.Current.Response.Write(""); } public static void ShowPath(string pagePath) { HttpContext.Current.Response.Write(""); } } 

UserInformation.designer.cs

 #pragma warning disable 1591 //------------------------------------------------------------------------------ //  //   此代码由工具生成。 //   运行库版本:2.0.50727.1891 // //   对此文件的更改可能会导致不正确的行为,并且如果 //   重新生成代码,这些更改将会丢失。 //  //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Linq; using System.Linq.Expressions; using System.Reflection; [System.Data.Linq.Mapping.DatabaseAttribute(Name="MenuLinq")] public partial class UserInformationDataContext : System.Data.Linq.DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); #region Extensibility Method Definitions partial void OnCreated(); partial void Insert用户信息(用户信息 instance); partial void Update用户信息(用户信息 instance); partial void Delete用户信息(用户信息 instance); partial void Insert订餐信息(订餐信息 instance); partial void Update订餐信息(订餐信息 instance); partial void Delete订餐信息(订餐信息 instance); partial void Insert菜样信息(菜样信息 instance); partial void Update菜样信息(菜样信息 instance); partial void Delete菜样信息(菜样信息 instance); #endregion public UserInformationDataContext() : base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString, mappingSource) { OnCreated(); } public UserInformationDataContext(string connection) : base(connection, mappingSource) { OnCreated(); } public UserInformationDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } public UserInformationDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } public UserInformationDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } public System.Data.Linq.Table<用户信息> 用户信息 { get { return this.GetTable<用户信息>(); } } public System.Data.Linq.Table<订餐信息> 订餐信息 { get { return this.GetTable<订餐信息>(); } } public System.Data.Linq.Table<菜样信息> 菜样信息 { get { return this.GetTable<菜样信息>(); } } } [Table(Name="dbo.用户信息")] public partial class 用户信息 : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _序号; private string _用户名; private string _用户密码; private string _邮箱; private string _住址; private string _手机号; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void On序号Changing(int value); partial void On序号Changed(); partial void On用户名Changing(string value); partial void On用户名Changed(); partial void On用户密码Changing(string value); partial void On用户密码Changed(); partial void On邮箱Changing(string value); partial void On邮箱Changed(); partial void On住址Changing(string value); partial void On住址Changed(); partial void On手机号Changing(string value); partial void On手机号Changed(); #endregion public 用户信息() { OnCreated(); } [Column(Storage="_序号", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] public int 序号 { get { return this._序号; } set { if ((this._序号 != value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号 = value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_用户名", DbType="NChar(10)")] public string 用户名 { get { return this._用户名; } set { if ((this._用户名 != value)) { this.On用户名Changing(value); this.SendPropertyChanging(); this._用户名 = value; this.SendPropertyChanged("用户名"); this.On用户名Changed(); } } } [Column(Storage="_用户密码", DbType="VarChar(50)")] public string 用户密码 { get { return this._用户密码; } set { if ((this._用户密码 != value)) { this.On用户密码Changing(value); this.SendPropertyChanging(); this._用户密码 = value; this.SendPropertyChanged("用户密码"); this.On用户密码Changed(); } } } [Column(Storage="_邮箱", DbType="VarChar(50)")] public string 邮箱 { get { return this._邮箱; } set { if ((this._邮箱 != value)) { this.On邮箱Changing(value); this.SendPropertyChanging(); this._邮箱 = value; this.SendPropertyChanged("邮箱"); this.On邮箱Changed(); } } } [Column(Storage="_住址", DbType="VarChar(50)")] public string 住址 { get { return this._住址; } set { if ((this._住址 != value)) { this.On住址Changing(value); this.SendPropertyChanging(); this._住址 = value; this.SendPropertyChanged("住址"); this.On住址Changed(); } } } [Column(Storage="_手机号", DbType="VarChar(50)")] public string 手机号 { get { return this._手机号; } set { if ((this._手机号 != value)) { this.On手机号Changing(value); this.SendPropertyChanging(); this._手机号 = value; this.SendPropertyChanged("手机号"); this.On手机号Changed(); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [Table(Name="dbo.订餐信息")] public partial class 订餐信息 : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _序号; private System.Nullable _菜样编号; private string _菜名; private string _菜样图片; private System.Nullable _份数; private System.Nullable _菜价; private System.Nullable _应付金额; private string _订餐日期; private string _用户名; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void On序号Changing(int value); partial void On序号Changed(); partial void On菜样编号Changing(System.Nullable value); partial void On菜样编号Changed(); partial void On菜名Changing(string value); partial void On菜名Changed(); partial void On菜样图片Changing(string value); partial void On菜样图片Changed(); partial void On份数Changing(System.Nullable value); partial void On份数Changed(); partial void On菜价Changing(System.Nullable value); partial void On菜价Changed(); partial void On应付金额Changing(System.Nullable value); partial void On应付金额Changed(); partial void On订餐日期Changing(string value); partial void On订餐日期Changed(); partial void On用户名Changing(string value); partial void On用户名Changed(); #endregion public 订餐信息() { OnCreated(); } [Column(Storage="_序号", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] public int 序号 { get { return this._序号; } set { if ((this._序号 != value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号 = value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_菜样编号", DbType="Int")] public System.Nullable 菜样编号 { get { return this._菜样编号; } set { if ((this._菜样编号 != value)) { this.On菜样编号Changing(value); this.SendPropertyChanging(); this._菜样编号 = value; this.SendPropertyChanged("菜样编号"); this.On菜样编号Changed(); } } } [Column(Storage="_菜名", DbType="NChar(10)")] public string 菜名 { get { return this._菜名; } set { if ((this._菜名 != value)) { this.On菜名Changing(value); this.SendPropertyChanging(); this._菜名 = value; this.SendPropertyChanged("菜名"); this.On菜名Changed(); } } } [Column(Storage="_菜样图片", DbType="NChar(30)")] public string 菜样图片 { get { return this._菜样图片; } set { if ((this._菜样图片 != value)) { this.On菜样图片Changing(value); this.SendPropertyChanging(); this._菜样图片 = value; this.SendPropertyChanged("菜样图片"); this.On菜样图片Changed(); } } } [Column(Storage="_份数", DbType="Int")] public System.Nullable 份数 { get { return this._份数; } set { if ((this._份数 != value)) { this.On份数Changing(value); this.SendPropertyChanging(); this._份数 = value; this.SendPropertyChanged("份数"); this.On份数Changed(); } } } [Column(Storage="_菜价", DbType="Int")] public System.Nullable 菜价 { get { return this._菜价; } set { if ((this._菜价 != value)) { this.On菜价Changing(value); this.SendPropertyChanging(); this._菜价 = value; this.SendPropertyChanged("菜价"); this.On菜价Changed(); } } } [Column(Storage="_应付金额", DbType="Int")] public System.Nullable 应付金额 { get { return this._应付金额; } set { if ((this._应付金额 != value)) { this.On应付金额Changing(value); this.SendPropertyChanging(); this._应付金额 = value; this.SendPropertyChanged("应付金额"); this.On应付金额Changed(); } } } [Column(Storage="_订餐日期", DbType="NVarChar(50)")] public string 订餐日期 { get { return this._订餐日期; } set { if ((this._订餐日期 != value)) { this.On订餐日期Changing(value); this.SendPropertyChanging(); this._订餐日期 = value; this.SendPropertyChanged("订餐日期"); this.On订餐日期Changed(); } } } [Column(Storage="_用户名", DbType="NChar(15)")] public string 用户名 { get { return this._用户名; } set { if ((this._用户名 != value)) { this.On用户名Changing(value); this.SendPropertyChanging(); this._用户名 = value; this.SendPropertyChanged("用户名"); this.On用户名Changed(); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [Table(Name="dbo.菜样信息")] public partial class 菜样信息 : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _序号; private int _菜样编号; private string _菜名; private string _菜样类型; private string _菜样图片; private string _厨师; private System.Nullable _现在价格; private System.Nullable _优惠价格; private string _创菜时间; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void On序号Changing(int value); partial void On序号Changed(); partial void On菜样编号Changing(int value); partial void On菜样编号Changed(); partial void On菜名Changing(string value); partial void On菜名Changed(); partial void On菜样类型Changing(string value); partial void On菜样类型Changed(); partial void On菜样图片Changing(string value); partial void On菜样图片Changed(); partial void On厨师Changing(string value); partial void On厨师Changed(); partial void On现在价格Changing(System.Nullable value); partial void On现在价格Changed(); partial void On优惠价格Changing(System.Nullable value); partial void On优惠价格Changed(); partial void On创菜时间Changing(string value); partial void On创菜时间Changed(); #endregion public 菜样信息() { OnCreated(); } [Column(Storage="_序号", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] public int 序号 { get { return this._序号; } set { if ((this._序号 != value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号 = value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_菜样编号", DbType="Int NOT NULL")] public int 菜样编号 { get { return this._菜样编号; } set { if ((this._菜样编号 != value)) { this.On菜样编号Changing(value); this.SendPropertyChanging(); this._菜样编号 = value; this.SendPropertyChanged("菜样编号"); this.On菜样编号Changed(); } } } [Column(Storage="_菜名", DbType="NChar(10)")] public string 菜名 { get { return this._菜名; } set { if ((this._菜名 != value)) { this.On菜名Changing(value); this.SendPropertyChanging(); this._菜名 = value; this.SendPropertyChanged("菜名"); this.On菜名Changed(); } } } [Column(Storage="_菜样类型", DbType="NChar(10)")] public string 菜样类型 { get { return this._菜样类型; } set { if ((this._菜样类型 != value)) { this.On菜样类型Changing(value); this.SendPropertyChanging(); this._菜样类型 = value; this.SendPropertyChanged("菜样类型"); this.On菜样类型Changed(); } } } [Column(Storage="_菜样图片", DbType="NVarChar(50)")] public string 菜样图片 { get { return this._菜样图片; } set { if ((this._菜样图片 != value)) { this.On菜样图片Changing(value); this.SendPropertyChanging(); this._菜样图片 = value; this.SendPropertyChanged("菜样图片"); this.On菜样图片Changed(); } } } [Column(Storage="_厨师", DbType="NChar(15)")] public string 厨师 { get { return this._厨师; } set { if ((this._厨师 != value)) { this.On厨师Changing(value); this.SendPropertyChanging(); this._厨师 = value; this.SendPropertyChanged("厨师"); this.On厨师Changed(); } } } [Column(Storage="_现在价格", DbType="Int")] public System.Nullable 现在价格 { get { return this._现在价格; } set { if ((this._现在价格 != value)) { this.On现在价格Changing(value); this.SendPropertyChanging(); this._现在价格 = value; this.SendPropertyChanged("现在价格"); this.On现在价格Changed(); } } } [Column(Storage="_优惠价格", DbType="Int")] public System.Nullable 优惠价格 { get { return this._优惠价格; } set { if ((this._优惠价格 != value)) { this.On优惠价格Changing(value); this.SendPropertyChanging(); this._优惠价格 = value; this.SendPropertyChanged("优惠价格"); this.On优惠价格Changed(); } } } [Column(Storage="_创菜时间", DbType="NChar(20)")] public string 创菜时间 { get { return this._创菜时间; } set { if ((this._创菜时间 != value)) { this.On创菜时间Changing(value); this.SendPropertyChanging(); this._创菜时间 = value; this.SendPropertyChanged("创菜时间"); this.On创菜时间Changed(); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } #pragma warning restore 1591

源码下载:C#实现餐饮管理系统

以上就是C#实现餐饮管理系统完整版的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程