C#实现餐饮管理系统完整版
更新时间:2020年6月25日 11:15 点击:1911
完整版的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; /// <summary> ///Dataoperator 的摘要说明 /// </summary> public class Dataoperator { public Dataoperator() { // //TODO: 在此处添加构造函数逻辑 // } public static SqlConnection creatcon() { string strcon = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection con = new SqlConnection(strcon); return con; } /// 查询的数据是否已经存在 /// </summary> /// <param name="sql">需要执行的SQL语句</param> /// <returns>返回布尔值,true表示已经存在,false表示不存在</returns> 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; } } /// 执行数据库中的更新、插入、删除操作 /// </summary> /// <param name="sql">需要执行的SQL语句</param> /// <returns>返回布尔值,true表示已存在,false表示不存在</returns> 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; /// <summary> ///MessageBox 的摘要说明 /// </summary> public class MessageBox { public MessageBox() { // //TODO: 在此处添加构造函数逻辑 // } public static void Show(string messageInfo) { HttpContext.Current.Response.Write("<script>alert('"+messageInfo+"')</script>"); } public static void Show(string messageInfo, string pagePath) { HttpContext.Current.Response.Write("<script>alert('"+messageInfo+"');location='"+pagePath+"'</script>"); } public static void ShowPath(string pagePath) { HttpContext.Current.Response.Write("<script>location='" + pagePath + "'</script>"); } }
UserInformation.designer.cs
#pragma warning disable 1591 //------------------------------------------------------------------------------ // <auto-generated> // 此代码由工具生成。 // 运行库版本:2.0.50727.1891 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // </auto-generated> //------------------------------------------------------------------------------ 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<int> _菜样编号; private string _菜名; private string _菜样图片; private System.Nullable<int> _份数; private System.Nullable<int> _菜价; private System.Nullable<int> _应付金额; 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<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(System.Nullable<int> value); partial void On份数Changed(); partial void On菜价Changing(System.Nullable<int> value); partial void On菜价Changed(); partial void On应付金额Changing(System.Nullable<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(); #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<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(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<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<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<int> 应付金额 { 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<int> _现在价格; private System.Nullable<int> _优惠价格; 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<int> value); partial void On现在价格Changed(); partial void On优惠价格Changing(System.Nullable<int> 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<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<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(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#实现剪刀石头布游戏
相关文章
- 我们在使用C#做项目的时候,基本上都需要制作登录界面,那么今天我们就来一步步看看,如果简单的实现登录界面呢,本文给出2个例子,由简入难,希望大家能够喜欢。...2020-06-25
- 这篇文章主要介绍了C# 字段和属性的的相关资料,文中示例代码非常详细,供大家参考和学习,感兴趣的朋友可以了解下...2020-11-03
- 这篇文章主要介绍了C#中截取字符串的的基本方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-11-03
- 本文给大家分享C#连接SQL数据库和查询数据功能的操作技巧,本文通过图文并茂的形式给大家介绍的非常详细,需要的朋友参考下吧...2021-05-17
- 这篇文章主要介绍了C#实现简单的Http请求的方法,以实例形式较为详细的分析了C#实现Http请求的具体方法,需要的朋友可以参考下...2020-06-25
- 本文主要介绍了C#中new的几种用法,具有很好的参考价值,下面跟着小编一起来看下吧...2020-06-25
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
这篇文章主要介绍了使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2020-06-25- 这篇文章主要介绍了C#开发Windows窗体应用程序的简单操作步骤,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-04-12
- 这篇文章主要介绍了C#从数据库读取图片并保存的方法,帮助大家更好的理解和使用c#,感兴趣的朋友可以了解下...2021-01-16
- 最近做一个小项目不可避免的需要前端脚本与后台进行交互。由于是在asp.net中实现,故问题演化成asp.net中jiavascript与后台c#如何进行交互。...2020-06-25
- 这篇文章主要用实例讲解C#递归算法的概念以及用法,文中代码非常详细,帮助大家更好的参考和学习,感兴趣的朋友可以了解下...2020-06-25
- 本文通过例子,讲述了C++调用C#的DLL程序的方法,作出了以下总结,下面就让我们一起来学习吧。...2020-06-25
- 轻松学习C#的基础入门,了解C#最基本的知识点,C#是一种简洁的,类型安全的一种完全面向对象的开发语言,是Microsoft专门基于.NET Framework平台开发的而量身定做的高级程序设计语言,需要的朋友可以参考下...2020-06-25
- 本文主要介绍了C#变量命名规则小结,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-09-09
- 这篇文章主要介绍了c#中(&&,||)与(&,|)的区别详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-06-25
- 这篇文章主要介绍了C#绘制曲线图的方法,以完整实例形式较为详细的分析了C#进行曲线绘制的具体步骤与相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
- 本文主要介绍了C# 中取绝对值的函数。具有很好的参考价值。下面跟着小编一起来看下吧...2020-06-25
- 这篇文章主要介绍了c#自带缓存使用方法,包括获取数据缓存、设置数据缓存、移除指定数据缓存等方法,需要的朋友可以参考下...2020-06-25
- 下面小编就为大家带来一篇C#学习笔记- 随机函数Random()的用法详解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2020-06-25
- 这篇文章主要介绍了C#中list用法,结合实例形式分析了C#中list排序、运算、转换等常见操作技巧,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25