• 大小: 3.99M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: 系统  管理  管理系统  

资源简介

【实例简介】

用于火锅自助店管理系统,这个是实际火锅店使用的系统。已打包可以直接安装运行

收银员和管理员 密码均为:123

另外因为用的access数据库,所以请运行x86版本
【实例截图】


【核心代码】

private void loadDB()
        {
            DBClass db = new DBClass();
            DataTable desk = db.selectDB("select * from [desk] where startup=1");
            int i = 0, x = 0, y = 0;
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                int [,] cz=new int[10,6];
                for (i = 0; i < desk.Rows.Count; i )
                {
                    btn = new Button(); //生成按钮
                    btn.Name = "btn" desk.Rows[i][1].ToString();   //设置按钮的ID
                    btn.Height = 104;
                    btn.Width = 108;
                    btn.Text = desk.Rows[i][1].ToString();
                    if (desk.Rows[i][3].ToString() == "0")
                    {
                        btn.Tag = "虚席以待";
                        btn.BackgroundImage = imageList1.Images[0];
                    }
                    else if (desk.Rows[i][3].ToString() == "1")
                    {
                        btn.Tag = "使用中";
                        btn.BackgroundImage = imageList1.Images[1];
                    }
                    else if (desk.Rows[i][3].ToString() == "2")
                    {
                        btn.Tag = "预定中";
                        btn.BackgroundImage = imageList1.Images[2];
                    }
                    else if (desk.Rows[i][3].ToString() == "3")
                    {
                        btn.Tag = "已停用";
                        btn.BackgroundImage = imageList1.Images[3];
                    }
                    else
                    {
                        btn.Tag = "超时";
                        btn.BackgroundImage = imageList1.Images[4];
                    }
                    btn.BackgroundImageLayout = ImageLayout.Stretch;
                    btn.Click = new System.EventHandler(this.btn_Click);
                    //btn.DoubleClick = new EventHandler(this.btn_DoubleClick);
                    btn.MouseDown = new System.Windows.Forms.MouseEventHandler(this.bt_MouseDown);
                    toolTip1.SetToolTip(btn, desk.Rows[i][2].ToString());
                    btn.TextAlign = ContentAlignment.TopCenter;
                    btn.Font = new System.Drawing.Font("宋体", 50F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                    btn.ForeColor = System.Drawing.Color.Red;
                    btn.ContextMenuStrip = contextMenuStrip1;
                    if (i == 0)
                    {
                        btn.ForeColor = System.Drawing.Color.Blue;
                        label1.Text = btn.Text "  号桌   " btn.Tag;
                        leftbt = btn;
                        if (desk.Rows[i][3].ToString() == "1" || desk.Rows[i][3].ToString() == "4")
                        {
                            openInfo(btn.Text);
                        }
                        else
                        {
                            label3.Text = "编    号:";
                            label4.Text = "开始时间:";
                            label5.Text = "就餐用时:";
                            label6.Text = "锅    底:";
                            label7.Text = "消费金额:";
                            label8.Text = "超时金额:";
                            label9.Text = "已付金额:";
                            label10.Text = "未付金额:";
                            label11.Text = "成人:";
                            label12.Text = "免费:";
                            label13.Text = "半价:";
                        }
                    }
                    sunbtn[i] = btn;
                    for (x = 0; x < 10; x )
                    {
                        for (y = 0; y < 6; y )
                        {
                            if (cz[x, y] == 0)
                            {
                                btn.Location = new System.Drawing.Point(y * 114 10, x * 114 10);
                                cz[x, y] = 1;
                                goto xh;
                            }
                        }
                    }
                xh:
                    this.panel1.Controls.Add(btn);
                }
            }
            label14.Text = "";//时间基数
            label15.Text = "";//免费
            label16.Text = "";//半价
            label17.Text = "";//成人
            desk = db.selectDB("select * from [sort] where id in(3,4,5,10)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                for (int s = 0; s < desk.Rows.Count; s )
                {
                    if (desk.Rows[s][1].ToString() == "超时")
                    {
                        label14.Tag = desk.Rows[s]["sort"].ToString();
                    }
                    else if (desk.Rows[s][1].ToString() == "免费")
                    {
                        label15.Tag = desk.Rows[s]["money"].ToString();
                    }
                    else if (desk.Rows[s][1].ToString() == "半价")
                    {
                        label16.Tag = desk.Rows[s]["money"].ToString();
                    }
                    else
                    {
                        label17.Tag = desk.Rows[s]["money"].ToString();
                    }
                }
            }
        }
    
        private void btn_Click(object sender, EventArgs e)
        {
            Button b1 = (Button)sender;//将触发此事件的对象转换为该Button对象
            leftbt.ForeColor = System.Drawing.Color.Red;
            leftbt = b1;
            b1.ForeColor = System.Drawing.Color.Blue;

            label1.Text = b1.Text "  号桌   " b1.Tag;

           
            if (b1.Name == btname)
            {
                TimeSpan span = DateTime.Now - clickTime;
                if (span.Milliseconds < SystemInformation.DoubleClickTime - 150)
                {
                    btn_DoubleClick(sender, e);
                }
            }

            btname = b1.Name;
            clickTime = DateTime.Now;
            if (b1.Tag.ToString() == "使用中" || btn.Tag.ToString() == "超时")
            {
                openInfo(b1.Text);
            }
            else
            {
                label3.Text = "编    号:";
                label4.Text = "开始时间:";
                label5.Text = "就餐用时:";
                label6.Text = "锅    底:";
                label7.Text = "消费金额:";
                label8.Text = "超时金额:";
                label9.Text = "已付金额:";
                label10.Text = "未付金额:";
                label11.Text = "成人:";
                label12.Text = "免费:";
                label13.Text = "半价:";
            }
        }
        private void openInfo(string deskNo)
        {
            DataTable desk = db.selectDB("select a2.*,adult addadult-deladult as adult1,bairn addbairn-delbairn as bairn1,elder addelder-delelder as elder1 from [desk] as a1,[consumed] as a2 where a1.consumedNo=a2.consumedno  and deskNO=" deskNo);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                for (int i = 0; i < desk.Rows.Count; i )
                {
                    label3.Text = "编    号:" desk.Rows[i]["consumedno"].ToString();
                    label4.Text = "开始时间:" DateTime.Parse(desk.Rows[i]["startdate"].ToString()).ToString("HH:mm:ss");
                    label5.Text = "就餐用时:" desk.Rows[i]["depletedate"].ToString() "小时";
                   
                    label7.Text = "消费金额:" desk.Rows[i]["consumedmoney"].ToString();
                    label8.Text = "超时金额:" desk.Rows[i]["overtime"].ToString();
                    label9.Text = "已付金额:" desk.Rows[i]["paymentmoney"].ToString();
                    label10.Text = "未付金额:" desk.Rows[i]["nonpaymentmoney"].ToString();
                    label11.Text = "成人:" desk.Rows[i]["adult1"].ToString();
                    label12.Text = "免费:" desk.Rows[i]["elder1"].ToString();
                    label13.Text = "半价:" desk.Rows[i]["bairn1"].ToString();

                    desk = db.selectDB("select * from [sort] where id=" desk.Rows[i]["boiler"].ToString());
                    if (desk.DataSet != null && desk.Rows.Count > 0)
                    {
                        label6.Text = "锅    底:" desk.Rows[0][1].ToString();//
                    }
                }
            }
        }
        private string status(Button IL)
        {
            string str = "";
            if (IL.BackgroundImage == imageList1.Images[0])
            { str = "虚席以待"; }
            else if (IL.BackgroundImage == imageList1.Images[1])
            { str = "使用中"; }
            else if (IL.BackgroundImage == imageList1.Images[2])
            { str = "预留中"; }
            else if (IL.BackgroundImage == imageList1.Images[3])
            { str = "停用中"; }
            else if (IL.BackgroundImage == imageList1.Images[4])
            { str = "超时了"; }
            return str;
        }
        private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                DialogResult r = MessageBox.Show("确定要退出程序?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (r == DialogResult.OK)
                {
                    Application.Exit();
                }
                else
                {
                    e.Cancel = true;
                }
            }
        }

        private void MDIMain_Load(object sender, EventArgs e)
        {
            this.toolStripStatusLabel1.Text = "欢迎使用慧创软件";
            this.toolStripStatusLabel2.BorderSides = ToolStripStatusLabelBorderSides.Left;
            this.toolStripStatusLabel2.Text = "用户名:" loginName;
            this.toolStripStatusLabel2.BorderSides = ToolStripStatusLabelBorderSides.Right;
            this.toolStripStatusLabel2.Spring = true;
            this.toolStripStatusLabel3.Text = "系统当前时间:" DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            panel1.Height = 620;
            panel1.Width = 710;

            panel2.Height = 620;
            panel2.Width = 310;
            panel2.Location = new System.Drawing.Point(713,60);
            label1.Height = 50;
            label1.Width = 310;
            label1.Location = new System.Drawing.Point(0, 0);
            label2.Location = new System.Drawing.Point(0, 50);

            label3.Location = new System.Drawing.Point(20, 100);//编号
            label4.Location = new System.Drawing.Point(20, 140);//开始时间
            label5.Location = new System.Drawing.Point(20, 180);//就餐用时
            label6.Location = new System.Drawing.Point(20, 220);//锅底

            groupBox1.Location = new System.Drawing.Point(20, 260);//人数
            label11.Location = new System.Drawing.Point(5, 30);//成人
            label12.Location = new System.Drawing.Point(5, 60);//免费
            label13.Location = new System.Drawing.Point(5, 90);//小孩

            label8.Location = new System.Drawing.Point(20, 410);//超时金额
            label7.Location = new System.Drawing.Point(20, 450);//总金额
            label9.Location = new System.Drawing.Point(20, 490);//已付款
            label10.Location = new System.Drawing.Point(20, 530);//未付款
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.toolStripStatusLabel3.Text = "系统当前时间:" DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            this.label2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); 
        }

        //开台
        private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(0,2) and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                start st = new start(xzbt.Text);
                st.mdi = this;
                st.ShowDialog();
                xzbt.Tag = "使用中";
            }
            else
            {
                MessageBox.Show("当前桌子还在使用中!");
            }
        }
        //换台
        private void toolStripMenuItem8_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4) and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                exchange ex = new exchange(xzbt.Text);
                ex.mdi = this;
                ex.ShowDialog();
            }
            else
            {
                MessageBox.Show("当前桌子还没开台!");
            }
        }
        //清台
        private void toolStripMenuItem9_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,2,3,4) and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                CleanDesk clean = new CleanDesk(xzbt.Text);
                clean.mdi = this;
                clean.ShowDialog();
                xzbt.Tag = "虚席以待";
            }
            else
            {
                MessageBox.Show("当前桌子还没开台或预定或停用!");
            }
        }
        //打印
        private void toolStripMenuItem10_Click(object sender, EventArgs e)
        {

        }
        //加人
        private void toolStripMenuItem11_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4) and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                AddMan man = new AddMan(xzbt.Text);
                man.mdi = this;
                man.ShowDialog();
            }
            else
            {
                MessageBox.Show("当前桌子还没开台,请先开台!");
            }
        }
        //预留
        private void toolStripMenuItem12_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status=0 and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                db.EditDB("update [desk] set status=2 where deskNO=" xzbt.Text);
                xzbt.BackgroundImage = imageList1.Images[2];
                xzbt.Tag = "预留中";
            }
            else
            {
                MessageBox.Show("当前桌子正在使用或者预定中,请先清台!");
            }
        }
        //停用
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status=0 and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                db.EditDB("update [desk] set status=3 where deskNO=" xzbt.Text);
                xzbt.BackgroundImage = imageList1.Images[3];
                xzbt.Tag = "停用中";
            }
            else
            {
                MessageBox.Show("当前桌子正在使用或者预定中,请先清台!");
            }
        }

        private void bt_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                Button b1 = (Button)sender;
                xzbt = b1;
            }
        }
        //退出
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            DialogResult r = MessageBox.Show("确定要退出程序?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (r == DialogResult.OK)
            {
                Application.Exit();
            }
        }
        //双击
        private void btn_DoubleClick(object sender, EventArgs e)
        {
            Button b1 = (Button)sender;//将触发此事件的对象转换为该Button对象
            desk = db.selectDB("select * from [desk] where startup=1 and status in(0,2) and deskNO=" b1.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                start st = new start(b1.Text);
                st.mdi = this;
                st.ShowDialog();
                b1.Tag = "使用中";
                label1.Text = b1.Text "  号桌    使用中";
                if (deskNo != "")
                    openInfo(deskNo);
            }
            else
                MessageBox.Show("当前桌正在使用不能开台,请先清台!");
           
        }
       //开台
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(0,2)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                start st = new start("");
                st.mdi = this;
                st.ShowDialog();
            }
            else
                MessageBox.Show("目前没有空余的桌子!");
        }
      

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [user] where type=0 and userName='" loginName "'");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
            setup set = new setup();
            set.ShowDialog();
            }
            else
                MessageBox.Show("对不起,管理员才有此权限!");
        }

        private void toolStripButton8_Click(object sender, EventArgs e)
        {
            PWD pwd = new PWD(loginName);
            pwd.ShowDialog();
        }
        //换台
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                desk = db.selectDB("select * from [desk] where startup=1 and status in(0,2)");
                if (desk.DataSet != null && desk.Rows.Count > 0)
                {
                    exchange ex = new exchange("");
                    ex.mdi = this;
                    ex.ShowDialog();
                }
                else
                    MessageBox.Show("目前没有空余的桌子可换!");
            }
            else
            {
                MessageBox.Show("目前前还没开台!");
            }
        }
        //清台
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(2,1,4,3)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                CleanDesk clean = new CleanDesk("");
                clean.mdi = this;
                clean.ShowDialog();
            }
            else
                MessageBox.Show("目前没有开台的桌子!");
        }
        //加人
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
            AddMan man = new AddMan("");
            man.mdi = this;
            man.ShowDialog();
            if (deskNo != "")
                openInfo(deskNo);
            }
            else
                MessageBox.Show("目前没有开台的桌子!");
        }

        private void toolStripButton9_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [user] where type=0 and userName='" loginName "'");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                search se = new search();
                se.ShowDialog();
            }
            else
                MessageBox.Show("对不起,管理员才有此权限!");
        }
        //计算超时金额
        private void timer2_Tick(object sender, EventArgs e)
        {
            DateTime dtone ;
            TimeSpan span ;
            string timeMoney="";
            int cr = 0;
            int et = 0;
            int lr = 0;
            desk = db.selectDB("select a2.*,adult addadult-deladult as adult1,bairn addbairn-delbairn as bairn1,elder addelder-delelder as elder1 from [desk] as a1,[consumed] as a2 where a1.consumedNo=a2.consumedno and a1.startup=1 and a1.status in(1,4)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                for (int i = 0; i < desk.Rows.Count;i )
                {
                    dtone = Convert.ToDateTime(desk.Rows[i]["startdate"].ToString());
                    span = DateTime.Now.Subtract(dtone);
                    //timeMoney= ((Math.Ceiling(span.TotalHours / double.Parse(label14.Tag.ToString())) - 1) * int.Parse(label15.Tag.ToString())).ToString();
                    cr= int.Parse(label17.Tag.ToString())*int.Parse(desk.Rows[i]["adult1"].ToString());
                    et= int.Parse(label16.Tag.ToString())*int.Parse(desk.Rows[i]["bairn1"].ToString());
                    lr= int.Parse(label15.Tag.ToString())*int.Parse(desk.Rows[i]["elder1"].ToString());
                    timeMoney = ((Math.Ceiling(span.TotalHours / double.Parse(label14.Tag.ToString())) - 1) * (et cr lr)).ToString();
                    db.EditDB("update [consumed] set depletedate=" span.TotalHours.ToString("0.00") ",overtime=" timeMoney " where consumedno=" desk.Rows[i]["consumedno"].ToString());//, nonpaymentmoney=nonpaymentmoney " timeMoney "
                    if (int.Parse(timeMoney) > 0)
                        db.EditDB("update [desk] set status=4 deskNO=" desk.Rows[i]["desk"].ToString());
                }
            }
        }
        //打印
        private void toolStripButton7_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4)");
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                delMan man = new delMan("");
                man.mdi = this;
                man.ShowDialog();
                if (deskNo != "")
                    openInfo(deskNo);
            }
            else
                MessageBox.Show("目前没有开台的桌子!");
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Point pt = new Point(0, 0);
        }
        //减人
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            desk = db.selectDB("select * from [desk] where startup=1 and status in(1,4) and deskNO=" xzbt.Text);
            if (desk.DataSet != null && desk.Rows.Count > 0)
            {
                delMan man = new delMan(xzbt.Text);
                man.mdi = this;
                man.ShowDialog();
            }
            else
            {
                MessageBox.Show("当前桌子还没开台,请先开台!");
            }
        }

 

资源截图

代码片段和文件信息

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     1931132  2018-02-12 22:58  XCHGSystem_Vs2005.zip
     文件     2251360  2018-02-12 22:57  XCHGSystem_Vs2017.zip

评论

共有 条评论