C#课程设计餐饮管理系统 下载本文

{

public frmMain() {

InitializeComponent(); }

public SqlDataReader sdr; public string power; public string Names; public string Times;

private void frmMain_Load(object sender, EventArgs e) {

switch (power) {

case \: toolStripStatusLabel13.Text = \超级管理员\; break;

case \: toolStripStatusLabel13.Text = \经理\; break; case \: toolStripStatusLabel13.Text = \一般用户\; break; }

toolStripStatusLabel10.Text = Names; toolStripStatusLabel16.Text = Times; if (power == \) {

系统维护SToolStripMenuItem.Enabled = false; 基础信息MToolStripMenuItem.Enabled = false; }

if (power == \) {

系统维护SToolStripMenuItem.Enabled = false; } }

private void AddItems(string rzt) {

if (rzt == \使用\) {

13

lvDesk.Items.Add(sdr[\].ToString(), 1); } else {

lvDesk.Items.Add(sdr[\].ToString(), 0); } }

private void 开台ToolStripMenuItem_Click(object sender, EventArgs e) {

if (lvDesk.SelectedItems.Count != 0) {

string names = lvDesk.SelectedItems[0].SubItems[0].Text; frmOpen openroom = new frmOpen(); openroom.name = names; openroom.ShowDialog(); } else {

MessageBox.Show(\请选择桌台\); } }

private void frmMain_Activated(object sender, EventArgs e) {

lvDesk.Items.Clear();

SqlConnection conn = BaseClass.DBConn.CyCon(); conn.Open();

SqlCommand cmd = new SqlCommand(\, conn);

sdr = cmd.ExecuteReader(); while (sdr.Read()) {

string zt = sdr[\].ToString().Trim();

14

AddItems(zt); }

conn.Close(); }

private void 点菜ToolStripMenuItem_Click(object sender, EventArgs e) {

if (lvDesk.SelectedItems.Count != 0) {

string names = lvDesk.SelectedItems[0].SubItems[0].Text; frmDC dc = new frmDC(); dc.RName = names; dc.ShowDialog(); } else {

MessageBox.Show(\请选择桌台\); } }

private void 消费查询ToolStripMenuItem_Click(object sender, EventArgs e) {

if (lvDesk.SelectedItems.Count != 0) {

string names = lvDesk.SelectedItems[0].SubItems[0].Text; frmSerch serch = new frmSerch(); serch.RName = names; serch.ShowDialog(); } else {

MessageBox.Show(\请选择桌台\); } }

private void 结账ToolStripMenuItem_Click(object sender, EventArgs e)

15

{

if (lvDesk.SelectedItems.Count != 0) {

string names = lvDesk.SelectedItems[0].SubItems[0].Text; frmJZ jz = new frmJZ(); jz.Rname = names; jz.ShowDialog(); } else {

MessageBox.Show(\请选择桌台\); }

}

private void lvDesk_DoubleClick(object sender, EventArgs e) {

frmDetails details = new frmDetails();

details.TableName = lvDesk.SelectedItems[0].SubItems[0].Text; details.ShowDialog(); }

private void lvDesk_Click(object sender, EventArgs e) {

string names = lvDesk.SelectedItems[0].SubItems[0].Text; SqlConnection conn = BaseClass.DBConn.CyCon(); conn.Open();

SqlCommand cmd = new SqlCommand(\where RoomName='\ + names + \, conn);

SqlDataReader sdr = cmd.ExecuteReader(); sdr.Read();

string zt = sdr[\].ToString().Trim(); sdr.Close(); if (zt == \使用\) {

this.contextMenuStrip1.Items[0].Enabled = false; this.contextMenuStrip1.Items[1].Enabled = true;

16