Csharp/C#教程:C#实现餐饮管理系统完整版分享

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

部分代码:

Dataoperator.cs

usingSystem; usingSystem.Data; usingSystem.Configuration; usingSystem.Linq; usingSystem.Web; usingSystem.Web.Security; usingSystem.Web.UI; usingSystem.Web.UI.HtmlControls; usingSystem.Web.UI.WebControls; usingSystem.Web.UI.WebControls.WebParts; usingSystem.Xml.Linq; usingSystem.Data.SqlClient; ///<summary> ///Dataoperator的摘要说明 ///</summary> publicclassDataoperator { publicDataoperator() { // //TODO:在此处添加构造函数逻辑 // } publicstaticSqlConnectioncreatcon() { stringstrcon=ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnectioncon=newSqlConnection(strcon); returncon; } ///查询的数据是否已经存在 ///</summary> ///<paramname="sql">需要执行的SQL语句</param> ///<returns>返回布尔值,true表示已经存在,false表示不存在</returns> publicstaticboolisData(stringsql) { //创建数据库连接 SqlConnectioncon=creatcon(); //打开数据库连接 con.Open(); //创建Command对象 SqlCommandcom=newSqlCommand(sql,con); //获取ExecuteScalar方法所返回的值 intex=Convert.ToInt32(com.ExecuteScalar()); //关闭数据库连接 con.Close(); //判断整型变量并返回相应的布尔值 if(ex>0) { returntrue; } else { returnfalse; } } ///执行数据库中的更新、插入、删除操作 ///</summary> ///<paramname="sql">需要执行的SQL语句</param> ///<returns>返回布尔值,true表示已存在,false表示不存在</returns> publicstaticboolexSql(stringsql) { SqlConnectioncon=creatcon(); con.Open(); SqlCommandcom=newSqlCommand(sql,con); introws=Convert.ToInt32(com.ExecuteNonQuery()); if(rows>0) returntrue; else returnfalse; } publicstaticstringgetTier(stringsql)//返回指定列的值 { //SqlConnectioncon=creatcon() //con.Open(); //SqlCommandcmd=newSqlCommand(sql,con); ////获得记录行 //SqlDataReadersdr=cmd.ExecuteReader(); //sdr.Read(); //stringstr=sdr[0].ToString(); //con.Close(); //returnstr; SqlConnectioncon=creatcon(); SqlDataAdaptersda=newSqlDataAdapter(sql,con); DataSetds=newDataSet(); sda.Fill(ds); stringstr=ds.Tables[0].Rows[0][0].ToString(); returnstr; } publicstaticDataSetgetRows(stringsql)//返回所查询表中所有数据 { //创建数据库连接 SqlConnectioncon=creatcon(); //打开数据连接 //创建DataAdapter对象 SqlDataAdaptersda=newSqlDataAdapter(sql,con); //创建DataSet对象 DataSetds=newDataSet(); //通过Fill方法 sda.Fill(ds); //关闭数据库连接 //返回DataSet对象 returnds; } }

MessageBox.cs

usingSystem; usingSystem.Data; usingSystem.Configuration; usingSystem.Linq; usingSystem.Web; usingSystem.Web.Security; usingSystem.Web.UI; usingSystem.Web.UI.HtmlControls; usingSystem.Web.UI.WebControls; usingSystem.Web.UI.WebControls.WebParts; usingSystem.Xml.Linq; ///<summary> ///MessageBox的摘要说明 ///</summary> publicclassMessageBox { publicMessageBox() { // //TODO:在此处添加构造函数逻辑 // } publicstaticvoidShow(stringmessageInfo) { HttpContext.Current.Response.Write("<script>alert('"+messageInfo+"')</script>"); } publicstaticvoidShow(stringmessageInfo,stringpagePath) { HttpContext.Current.Response.Write("<script>alert('"+messageInfo+"');location='"+pagePath+"'</script>"); } publicstaticvoidShowPath(stringpagePath) { HttpContext.Current.Response.Write("<script>location='"+pagePath+"'</script>"); } }

UserInformation.designer.cs

#pragmawarningdisable1591 //------------------------------------------------------------------------------ //<auto-generated> //此代码由工具生成。 //运行库版本:2.0.50727.1891 // //对此文件的更改可能会导致不正确的行为,并且如果 //重新生成代码,这些更改将会丢失。 //</auto-generated> //------------------------------------------------------------------------------ usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Data.Linq; usingSystem.Data.Linq.Mapping; usingSystem.Linq; usingSystem.Linq.Expressions; usingSystem.Reflection; [System.Data.Linq.Mapping.DatabaseAttribute(Name="MenuLinq")] publicpartialclassUserInformationDataContext:System.Data.Linq.DataContext { privatestaticSystem.Data.Linq.Mapping.MappingSourcemappingSource=newAttributeMappingSource(); #regionExtensibilityMethodDefinitions partialvoidOnCreated(); partialvoidInsert用户信息(用户信息instance); partialvoidUpdate用户信息(用户信息instance); partialvoidDelete用户信息(用户信息instance); partialvoidInsert订餐信息(订餐信息instance); partialvoidUpdate订餐信息(订餐信息instance); partialvoidDelete订餐信息(订餐信息instance); partialvoidInsert菜样信息(菜样信息instance); partialvoidUpdate菜样信息(菜样信息instance); partialvoidDelete菜样信息(菜样信息instance); #endregion publicUserInformationDataContext(): base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString,mappingSource) { OnCreated(); } publicUserInformationDataContext(stringconnection): base(connection,mappingSource) { OnCreated(); } publicUserInformationDataContext(System.Data.IDbConnectionconnection): base(connection,mappingSource) { OnCreated(); } publicUserInformationDataContext(stringconnection,System.Data.Linq.Mapping.MappingSourcemappingSource): base(connection,mappingSource) { OnCreated(); } publicUserInformationDataContext(System.Data.IDbConnectionconnection,System.Data.Linq.Mapping.MappingSourcemappingSource): base(connection,mappingSource) { OnCreated(); } publicSystem.Data.Linq.Table<用户信息>用户信息 { get { returnthis.GetTable<用户信息>(); } } publicSystem.Data.Linq.Table<订餐信息>订餐信息 { get { returnthis.GetTable<订餐信息>(); } } publicSystem.Data.Linq.Table<菜样信息>菜样信息 { get { returnthis.GetTable<菜样信息>(); } } } [Table(Name="dbo.用户信息")] publicpartialclass用户信息:INotifyPropertyChanging,INotifyPropertyChanged { privatestaticPropertyChangingEventArgsemptyChangingEventArgs=newPropertyChangingEventArgs(String.Empty); privateint_序号; privatestring_用户名; privatestring_用户密码; privatestring_邮箱; privatestring_住址; privatestring_手机号; #regionExtensibilityMethodDefinitions partialvoidOnLoaded(); partialvoidOnValidate(System.Data.Linq.ChangeActionaction); partialvoidOnCreated(); partialvoidOn序号Changing(intvalue); partialvoidOn序号Changed(); partialvoidOn用户名Changing(stringvalue); partialvoidOn用户名Changed(); partialvoidOn用户密码Changing(stringvalue); partialvoidOn用户密码Changed(); partialvoidOn邮箱Changing(stringvalue); partialvoidOn邮箱Changed(); partialvoidOn住址Changing(stringvalue); partialvoidOn住址Changed(); partialvoidOn手机号Changing(stringvalue); partialvoidOn手机号Changed(); #endregion public用户信息() { OnCreated(); } [Column(Storage="_序号",AutoSync=AutoSync.OnInsert,DbType="IntNOTNULLIDENTITY",IsPrimaryKey=true,IsDbGenerated=true)] publicint序号 { get { returnthis._序号; } set { if((this._序号!=value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号=value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_用户名",DbType="NChar(10)")] publicstring用户名 { get { returnthis._用户名; } set { if((this._用户名!=value)) { this.On用户名Changing(value); this.SendPropertyChanging(); this._用户名=value; this.SendPropertyChanged("用户名"); this.On用户名Changed(); } } } [Column(Storage="_用户密码",DbType="VarChar(50)")] publicstring用户密码 { get { returnthis._用户密码; } set { if((this._用户密码!=value)) { this.On用户密码Changing(value); this.SendPropertyChanging(); this._用户密码=value; this.SendPropertyChanged("用户密码"); this.On用户密码Changed(); } } } [Column(Storage="_邮箱",DbType="VarChar(50)")] publicstring邮箱 { get { returnthis._邮箱; } set { if((this._邮箱!=value)) { this.On邮箱Changing(value); this.SendPropertyChanging(); this._邮箱=value; this.SendPropertyChanged("邮箱"); this.On邮箱Changed(); } } } [Column(Storage="_住址",DbType="VarChar(50)")] publicstring住址 { get { returnthis._住址; } set { if((this._住址!=value)) { this.On住址Changing(value); this.SendPropertyChanging(); this._住址=value; this.SendPropertyChanged("住址"); this.On住址Changed(); } } } [Column(Storage="_手机号",DbType="VarChar(50)")] publicstring手机号 { get { returnthis._手机号; } set { if((this._手机号!=value)) { this.On手机号Changing(value); this.SendPropertyChanging(); this._手机号=value; this.SendPropertyChanged("手机号"); this.On手机号Changed(); } } } publiceventPropertyChangingEventHandlerPropertyChanging; publiceventPropertyChangedEventHandlerPropertyChanged; protectedvirtualvoidSendPropertyChanging() { if((this.PropertyChanging!=null)) { this.PropertyChanging(this,emptyChangingEventArgs); } } protectedvirtualvoidSendPropertyChanged(StringpropertyName) { if((this.PropertyChanged!=null)) { this.PropertyChanged(this,newPropertyChangedEventArgs(propertyName)); } } } [Table(Name="dbo.订餐信息")] publicpartialclass订餐信息:INotifyPropertyChanging,INotifyPropertyChanged { privatestaticPropertyChangingEventArgsemptyChangingEventArgs=newPropertyChangingEventArgs(String.Empty); privateint_序号; privateSystem.Nullable<int>_菜样编号; privatestring_菜名; privatestring_菜样图片; privateSystem.Nullable<int>_份数; privateSystem.Nullable<int>_菜价; privateSystem.Nullable<int>_应付金额; privatestring_订餐日期; privatestring_用户名; #regionExtensibilityMethodDefinitions partialvoidOnLoaded(); partialvoidOnValidate(System.Data.Linq.ChangeActionaction); partialvoidOnCreated(); partialvoidOn序号Changing(intvalue); partialvoidOn序号Changed(); partialvoidOn菜样编号Changing(System.Nullable<int>value); partialvoidOn菜样编号Changed(); partialvoidOn菜名Changing(stringvalue); partialvoidOn菜名Changed(); partialvoidOn菜样图片Changing(stringvalue); partialvoidOn菜样图片Changed(); partialvoidOn份数Changing(System.Nullable<int>value); partialvoidOn份数Changed(); partialvoidOn菜价Changing(System.Nullable<int>value); partialvoidOn菜价Changed(); partialvoidOn应付金额Changing(System.Nullable<int>value); partialvoidOn应付金额Changed(); partialvoidOn订餐日期Changing(stringvalue); partialvoidOn订餐日期Changed(); partialvoidOn用户名Changing(stringvalue); partialvoidOn用户名Changed(); #endregion public订餐信息() { OnCreated(); } [Column(Storage="_序号",AutoSync=AutoSync.OnInsert,DbType="IntNOTNULLIDENTITY",IsPrimaryKey=true,IsDbGenerated=true)] publicint序号 { get { returnthis._序号; } set { if((this._序号!=value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号=value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_菜样编号",DbType="Int")] publicSystem.Nullable<int>菜样编号 { get { returnthis._菜样编号; } set { if((this._菜样编号!=value)) { this.On菜样编号Changing(value); this.SendPropertyChanging(); this._菜样编号=value; this.SendPropertyChanged("菜样编号"); this.On菜样编号Changed(); } } } [Column(Storage="_菜名",DbType="NChar(10)")] publicstring菜名 { get { returnthis._菜名; } set { if((this._菜名!=value)) { this.On菜名Changing(value); this.SendPropertyChanging(); this._菜名=value; this.SendPropertyChanged("菜名"); this.On菜名Changed(); } } } [Column(Storage="_菜样图片",DbType="NChar(30)")] publicstring菜样图片 { get { returnthis._菜样图片; } set { if((this._菜样图片!=value)) { this.On菜样图片Changing(value); this.SendPropertyChanging(); this._菜样图片=value; this.SendPropertyChanged("菜样图片"); this.On菜样图片Changed(); } } } [Column(Storage="_份数",DbType="Int")] publicSystem.Nullable<int>份数 { get { returnthis._份数; } set { if((this._份数!=value)) { this.On份数Changing(value); this.SendPropertyChanging(); this._份数=value; this.SendPropertyChanged("份数"); this.On份数Changed(); } } } [Column(Storage="_菜价",DbType="Int")] publicSystem.Nullable<int>菜价 { get { returnthis._菜价; } set { if((this._菜价!=value)) { this.On菜价Changing(value); this.SendPropertyChanging(); this._菜价=value; this.SendPropertyChanged("菜价"); this.On菜价Changed(); } } } [Column(Storage="_应付金额",DbType="Int")] publicSystem.Nullable<int>应付金额 { get { returnthis._应付金额; } set { if((this._应付金额!=value)) { this.On应付金额Changing(value); this.SendPropertyChanging(); this._应付金额=value; this.SendPropertyChanged("应付金额"); this.On应付金额Changed(); } } } [Column(Storage="_订餐日期",DbType="NVarChar(50)")] publicstring订餐日期 { get { returnthis._订餐日期; } set { if((this._订餐日期!=value)) { this.On订餐日期Changing(value); this.SendPropertyChanging(); this._订餐日期=value; this.SendPropertyChanged("订餐日期"); this.On订餐日期Changed(); } } } [Column(Storage="_用户名",DbType="NChar(15)")] publicstring用户名 { get { returnthis._用户名; } set { if((this._用户名!=value)) { this.On用户名Changing(value); this.SendPropertyChanging(); this._用户名=value; this.SendPropertyChanged("用户名"); this.On用户名Changed(); } } } publiceventPropertyChangingEventHandlerPropertyChanging; publiceventPropertyChangedEventHandlerPropertyChanged; protectedvirtualvoidSendPropertyChanging() { if((this.PropertyChanging!=null)) { this.PropertyChanging(this,emptyChangingEventArgs); } } protectedvirtualvoidSendPropertyChanged(StringpropertyName) { if((this.PropertyChanged!=null)) { this.PropertyChanged(this,newPropertyChangedEventArgs(propertyName)); } } } [Table(Name="dbo.菜样信息")] publicpartialclass菜样信息:INotifyPropertyChanging,INotifyPropertyChanged { privatestaticPropertyChangingEventArgsemptyChangingEventArgs=newPropertyChangingEventArgs(String.Empty); privateint_序号; privateint_菜样编号; privatestring_菜名; privatestring_菜样类型; privatestring_菜样图片; privatestring_厨师; privateSystem.Nullable<int>_现在价格; privateSystem.Nullable<int>_优惠价格; privatestring_创菜时间; #regionExtensibilityMethodDefinitions partialvoidOnLoaded(); partialvoidOnValidate(System.Data.Linq.ChangeActionaction); partialvoidOnCreated(); partialvoidOn序号Changing(intvalue); partialvoidOn序号Changed(); partialvoidOn菜样编号Changing(intvalue); partialvoidOn菜样编号Changed(); partialvoidOn菜名Changing(stringvalue); partialvoidOn菜名Changed(); partialvoidOn菜样类型Changing(stringvalue); partialvoidOn菜样类型Changed(); partialvoidOn菜样图片Changing(stringvalue); partialvoidOn菜样图片Changed(); partialvoidOn厨师Changing(stringvalue); partialvoidOn厨师Changed(); partialvoidOn现在价格Changing(System.Nullable<int>value); partialvoidOn现在价格Changed(); partialvoidOn优惠价格Changing(System.Nullable<int>value); partialvoidOn优惠价格Changed(); partialvoidOn创菜时间Changing(stringvalue); partialvoidOn创菜时间Changed(); #endregion public菜样信息() { OnCreated(); } [Column(Storage="_序号",AutoSync=AutoSync.OnInsert,DbType="IntNOTNULLIDENTITY",IsPrimaryKey=true,IsDbGenerated=true)] publicint序号 { get { returnthis._序号; } set { if((this._序号!=value)) { this.On序号Changing(value); this.SendPropertyChanging(); this._序号=value; this.SendPropertyChanged("序号"); this.On序号Changed(); } } } [Column(Storage="_菜样编号",DbType="IntNOTNULL")] publicint菜样编号 { get { returnthis._菜样编号; } set { if((this._菜样编号!=value)) { this.On菜样编号Changing(value); this.SendPropertyChanging(); this._菜样编号=value; this.SendPropertyChanged("菜样编号"); this.On菜样编号Changed(); } } } [Column(Storage="_菜名",DbType="NChar(10)")] publicstring菜名 { get { returnthis._菜名; } set { if((this._菜名!=value)) { this.On菜名Changing(value); this.SendPropertyChanging(); this._菜名=value; this.SendPropertyChanged("菜名"); this.On菜名Changed(); } } } [Column(Storage="_菜样类型",DbType="NChar(10)")] publicstring菜样类型 { get { returnthis._菜样类型; } set { if((this._菜样类型!=value)) { this.On菜样类型Changing(value); this.SendPropertyChanging(); this._菜样类型=value; this.SendPropertyChanged("菜样类型"); this.On菜样类型Changed(); } } } [Column(Storage="_菜样图片",DbType="NVarChar(50)")] publicstring菜样图片 { get { returnthis._菜样图片; } set { if((this._菜样图片!=value)) { this.On菜样图片Changing(value); this.SendPropertyChanging(); this._菜样图片=value; this.SendPropertyChanged("菜样图片"); this.On菜样图片Changed(); } } } [Column(Storage="_厨师",DbType="NChar(15)")] publicstring厨师 { get { returnthis._厨师; } set { if((this._厨师!=value)) { this.On厨师Changing(value); this.SendPropertyChanging(); this._厨师=value; this.SendPropertyChanged("厨师"); this.On厨师Changed(); } } } [Column(Storage="_现在价格",DbType="Int")] publicSystem.Nullable<int>现在价格 { get { returnthis._现在价格; } set { if((this._现在价格!=value)) { this.On现在价格Changing(value); this.SendPropertyChanging(); this._现在价格=value; this.SendPropertyChanged("现在价格"); this.On现在价格Changed(); } } } [Column(Storage="_优惠价格",DbType="Int")] publicSystem.Nullable<int>优惠价格 { get { returnthis._优惠价格; } set { if((this._优惠价格!=value)) { this.On优惠价格Changing(value); this.SendPropertyChanging(); this._优惠价格=value; this.SendPropertyChanged("优惠价格"); this.On优惠价格Changed(); } } } [Column(Storage="_创菜时间",DbType="NChar(20)")] publicstring创菜时间 { get { returnthis._创菜时间; } set { if((this._创菜时间!=value)) { this.On创菜时间Changing(value); this.SendPropertyChanging(); this._创菜时间=value; this.SendPropertyChanged("创菜时间"); this.On创菜时间Changed(); } } } publiceventPropertyChangingEventHandlerPropertyChanging; publiceventPropertyChangedEventHandlerPropertyChanged; protectedvirtualvoidSendPropertyChanging() { if((this.PropertyChanging!=null)) { this.PropertyChanging(this,emptyChangingEventArgs); } } protectedvirtualvoidSendPropertyChanged(StringpropertyName) { if((this.PropertyChanged!=null)) { this.PropertyChanged(this,newPropertyChangedEventArgs(propertyName)); } } } #pragmawarningrestore1591

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

您可能感兴趣的文章:c#实现KTV点歌系统C#图书管理系统附源码下载C#实现学员信息管理系统C#实现简单学生信息管理系统C#实现餐饮管理系统C#实现餐厅管理系统C#实现汽车租赁系统项目C#实现影院售票系统C#超市收银系统设计C#实现在线点餐系统

标签: 系统

C#实现餐饮管理系统

C#实现餐厅管理系统

上述就是C#学习教程:C#实现餐饮管理系统完整版分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/908352.html

(0)
上一篇 2021年10月25日
下一篇 2021年10月25日

精彩推荐