优质的成都网站建设推广,单县网站建设,网站建设教程 湖南岚鸿,银川网站制作一、引言
餐饮收银系统是一种用于管理餐馆、咖啡厅、快餐店等餐饮业务的计算机化工具。它旨在简化点餐、结账、库存管理等任务#xff0c;提高运营效率#xff0c;增强客户体验#xff0c;同时提供准确的财务记录。C# 餐饮收银系统是一种使用C#编程语言开发的餐饮业务管理软…一、引言
餐饮收银系统是一种用于管理餐馆、咖啡厅、快餐店等餐饮业务的计算机化工具。它旨在简化点餐、结账、库存管理等任务提高运营效率增强客户体验同时提供准确的财务记录。C# 餐饮收银系统是一种使用C#编程语言开发的餐饮业务管理软件具有以下主要功能
二、需求分析
分析思维导图
三、程序截图
登录 管理员主界面 添加食物界面 服务员订单界面 修改食物详情界面 未完成订单界面 支付成功界面 四、程序说明
管理员账号和密码admin, admin 服务员账号和密码: test, test 注可自行注册账号并登录但是只能注册服务员账号
五、代码
AdminWindows.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;namespace Cashier
{/// summary/// AdminWindow.xaml 的交互逻辑/// /summarypublic partial class AdminWindow : Window{public AdminWindow(){InitializeComponent();frame.Source new Uri(MenuEditPage.xaml, UriKind.Relative);}private void textBlock2_Copy_Click(object sender, RoutedEventArgs e){Button btn sender as Button;String choice btn.Content.ToString();switch (choice){case 菜单编辑:LoadMenuEditPage();break;case 添加食物:LoadAddFoddPage();break;case 食物编辑:LoadFoodEditPage();break;case 已完成订单:LoadOderCompletedPage();break;case 未完成订单:LoadOderNotPage();break;}}private void LoadMenuEditPage(){frame.Source new Uri(MenuEditPage.xaml, UriKind.Relative);}private void LoadAddFoddPage(){frame.Source new Uri(AddFoodPage.xaml, UriKind.Relative);}private void LoadOderCompletedPage(){frame.Source new Uri(OderCompletedPage.xaml, UriKind.Relative);}private void LoadOderNotPage(){frame.Source new Uri(OderNotPage.xaml, UriKind.Relative);}private void LoadFoodEditPage(){frame.Source new Uri(FoodEditPage.xaml, UriKind.Relative);}}
}
AddFoodPage.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;
namespace Cashier
{/// summary/// AddFoodPage.xaml 的交互逻辑/// /summary/// public partial class AddFoodPage : Page{private String mysqlConnStr serverlocalhost;User Idroot;password;Databasecanyin;public AddFoodPage(){InitializeComponent();}private void btn_Click(object sender, RoutedEventArgs e){InsertFood();}private void InsertFood(){String foodName foodNameBox.Text.ToString();String price priceBox.Text.ToString();String category categoryBox.Text;if(foodName.Equals() || price.Equals() || category.Equals()){resultBox.Text 请将食物信息填写完整;return;}// MessageBox.Show(食物名称是 foodName , 价格是 price 种类是 category);try{MySqlConnection conn new MySqlConnection(mysqlConnStr);conn.Open();String cmd insert into food(name, price, category) values( foodName , price , category );MySqlCommand mycmd new MySqlCommand(cmd, conn);if (mycmd.ExecuteNonQuery() 0){ resultBox.Text 食品添加成功;foodNameBox.Text ;priceBox.Text ;categoryBox.Text ;conn.Close();}}catch (Exception e){resultBox.Text 食品添加失败 e.Message;}}}
}
CommonValue.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace Cashier
{class CommonValue{public static int EDIT_FOOD_ID 5;public static String mysqlConectString serverlocalhost;User Idroot;password;Databasecanyin;public static String USER_NAME;public static int FOOD_PAY_ID 556;}
}
MainWindows.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;namespace Cashier
{/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{//用户账户private String user;private String password;public MainWindow(){InitializeComponent();}private void richTextBox_TextChanged(object sender, TextChangedEventArgs e){}private void textBox_TextChanged(object sender, TextChangedEventArgs e){}//监听注册按钮private void button1_Click(object sender, RoutedEventArgs e){Button btn sender as Button;String choice btn.Content.ToString();switch (choice){case 登录:UserLogin();break;case 注册:UserRegister();break;}}private void button1_Click_1(object sender, RoutedEventArgs e){}private void UserLogin(){//用户登录的逻辑代码user userBox.Text.ToString();password passwordBox.Text.ToString();if(user.Equals()){MessageBox.Show(请输入用户名);}else if(password.Equals()){MessageBox.Show(请输入密码);}else{CheckInfoAndLogin();}}private void UserRegister(){//跳转到登陆界面RegisterWindow register new RegisterWindow();register.Show();this.Close();}//检查用户的数据如果查询失败则返回密码错误private void CheckInfoAndLogin(){try{ MySqlConnection conn new MySqlConnection(CommonValue.mysqlConectString);conn.Open();string cmd select * from user where user user ;MySqlCommand myCmd new MySqlCommand(cmd, conn);MySqlDataReader reader myCmd.ExecuteReader();reader.Read();string dbUser reader[user].ToString();string dbPassword reader[password].ToString();if (password.Equals(dbPassword) dbUser.Equals(admin)){OpenAdminWindow();CommonValue.USER_NAME user;}else if (password.Equals(dbPassword)){OpenWaiterWindow();CommonValue.USER_NAME user;}else{MessageBox.Show(密码输入错误请重新输入!);}conn.Close();}catch(Exception e){String msg e.Message;MessageBox.Show(数据库连接错误 msg);}}//打开管理员窗口private void OpenAdminWindow(){AdminWindow aw new AdminWindow();aw.Show();this.Close();}//打开服务员窗口private void OpenWaiterWindow(){WaiterWindow ww new WaiterWindow();ww.Show();this.Close();}}
}
OderNotPage.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;
using System.Data;namespace Cashier
{/// summary/// OderNotPage.xaml 的交互逻辑/// /summarypublic partial class OderNotPage : Page{public OderNotPage(){InitializeComponent();ShowOders();}private void ShowOders(){try{//获取表格DataTable data new DataTable(oder);data.Columns.Add(new DataColumn(oder_id, typeof(string)));data.Columns.Add(new DataColumn(sum, typeof(string)));MySqlConnection conn new MySqlConnection(CommonValue.mysqlConectString);conn.Open();string cmd select * from oder where complete0;MySqlCommand myCmd new MySqlCommand(cmd, conn);MySqlDataAdapter mda new MySqlDataAdapter(cmd, conn);MySqlDataReader reader myCmd.ExecuteReader();while (reader.Read()){string id reader[oder_id].ToString();string name reader[sum].ToString();data.Rows.Add(id, name);}listView.DataContext data.DefaultView;conn.Close();}catch (Exception e){MessageBox.Show(查询订单失败: e.Message);}}private void button_Click(object sender, RoutedEventArgs e){CommonValue.FOOD_PAY_ID int.Parse(idPayBox.Text.ToString());NavigationWindow window new NavigationWindow();window.Source new Uri(OderDetailPage.xaml, UriKind.Relative);window.Show();}}
}
六、交流与联系
q:969060742 文档、完整代码、sql、程序资源