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#是一个简单、通用、面向对象的编程语言,它由微软Microsoft开发,继承了C和C++强大功能,并且去掉了一些它们的复杂特性,C#综合了VB简单的可视化操作和C++的高运行效率,以其强大的操作能力、优雅的语法风格、创新的语言特性和便捷的面向组件编程从而成为.NET开发的首选语言,但它不适用于编写时间急迫或性能非常高的代码,因为C#缺乏性能极高的应用程序所需要的关键功能。
关于“C#怎么实现餐饮管理系统”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
分享名称:C#怎么实现餐饮管理系统
分享地址:http://lswzjz.com/article/jjoddi.html