private void btnOK_Click(object sender, EventArgs e)
        {
            //change desk state
            DeskInfoBLL dkBll = new DeskInfoBLL();
            bool dkFlag = dkBll.UpdateDeskStateByDeskId(this.ID, 1);
            //add an order
            OrderInfoBLL orBll = new OrderInfoBLL();
            OrderInfo or = new OrderInfo();
            or.SubTime = System.DateTime.Now;
            or.OrderMoney = 0;
            or.DelFlag = 0;
            or.OrderState = 1;
            or.Remark = txtPersonCount.Text + txtDescription.Text;
            or.SubBy = 1;
            int orderId = orBll.AddOrderInfo(or);

            //add R_Order_Desk
            R_Order_DeskBLL rodBll = new R_Order_DeskBLL();
            R_Order_Desk rod = new R_Order_Desk();
            rod.DeskId = this.ID;
            rod.OrderId = orderId;
            bool rodFlag = rodBll.AddROrderDesk(rod);

            if(dkFlag && rodFlag)
            {
                MessageBox.Show("开单成功");
                if(ckbMeal.Checked)
                {
                    MyEventArgs mea = new MyEventArgs();
                    //deskName
                    mea.Name = labDeskName.Text;
                    //Order Id
                    mea.Temp = orderId;
                    FrmAddMoney fam = new FrmAddMoney();
                    this.evtFrmMoney += new EventHandler(fam.SetText);
                    if(this.evtFrmMoney != null)
                    {
                        this.evtFrmMoney(this, mea);
                        fam.FormClosed += new FormClosedEventHandler(fam_FormClosed);
                        fam.ShowDialog();
                    }
                }
            }
            else
            {
                MessageBox.Show("开单失败");
            }
        }
        private void btnMoney_Click(object sender, EventArgs e)
        {
            TabPage tp = tabControl1.SelectedTab;
            ListView lv = tp.Controls[0] as ListView;

            if (lv.SelectedItems.Count <= 0)
            {
                MessageBox.Show("请选中");
                return;
            }

            //desk State
            if ((lv.SelectedItems[0].Tag as DeskInfo).DeskState != 1)
            {
                MessageBox.Show("请选择要开单的餐桌");
                return;
            }

            //注册事件
            FrmAddMoney fam = new FrmAddMoney();
            this.evtFrmMoney += new EventHandler(fam.SetText);
            MyEventArgs mea = new MyEventArgs();
            mea.Name = (lv.SelectedItems[0].Tag as DeskInfo).DeskName;
            OrderInfoBLL bll = new OrderInfoBLL();
            mea.Temp = bll.GetOrderIdByDeskId((lv.SelectedItems[0].Tag as DeskInfo).DeskId);
            //窗体传值
            if(this.evtFrmMoney != null)
            {
                this.evtFrmMoney(this, mea);
                fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed);
                fam.ShowDialog();
            }
        }
        //Pay
        private void btnPay_Click(object sender, EventArgs e)
        {
            TabPage tp = tabControl1.SelectedTab;
            ListView lv = tp.Controls[0] as ListView;

            if (lv.SelectedItems.Count <= 0)
            {
                MessageBox.Show("请选中");
                return;
            }

            //desk State
            if ((lv.SelectedItems[0].Tag as DeskInfo).DeskState != 1)
            {
                MessageBox.Show("请选择要开单的餐桌");
                return;
            }
            
            FrmBalance fb = new FrmBalance();
            this.evtFBalance += new EventHandler(fb.SetText);
            MyEventArgs meaFB = new MyEventArgs();
            meaFB.Obj = lv.SelectedItems[0].Tag;
            if(this.evtFBalance != null)
            {
                this.evtFBalance(this, meaFB);
                fb.FormClosed += new FormClosedEventHandler(fbi_FormClosed);
                fb.ShowDialog();
            }
            
        }
        private void btn_Bill_Click(object sender, EventArgs e)
        {
            TabPage tp = tabControl1.SelectedTab;
            ListView lv = tp.Controls[0] as ListView;

            if (lv.SelectedItems.Count <= 0)
            {
                MessageBox.Show("请选中");
                return;
            }

            //desk State
            if((lv.SelectedItems[0].Tag as DeskInfo).DeskState != 0)
            {
                MessageBox.Show("请选择未开单的餐桌");
                return;
            }
            MyEventArgs mea = new MyEventArgs();
            mea.Obj = lv.SelectedItems[0].Tag;

            FrmBilling fb = new FrmBilling();
            
            //RoomType, RoomMinimumConsume
            mea.Name = (tp.Tag as RoomInfo).RoomName;
            mea.Money =Convert.ToDecimal( (tp.Tag as RoomInfo).RoomMinimunConsume);

            this.evtFBI += new EventHandler(fb.SetText);
            if(this.evtFBI != null)
            {
                this.evtFBI(this, mea);
                fb.FormClosed += new FormClosedEventHandler(fbi_FormClosed);
                fb.ShowDialog();
            }
        }