Esempio n. 1
0
        private void btnBilling_Click(object sender, EventArgs e)
        {
            var tb = tabc.SelectedTab;
            var lv = tb.Controls[0] as ListView;

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

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

            var mea = new MyEventArgs();

            mea.Obj   = lv.SelectedItems[0].Tag;                                    //传递DeskInfo
            mea.Name  = (tb.Tag as RoomInfo).RoomName;
            mea.Money = Convert.ToDecimal((tb.Tag as RoomInfo).RoomMinimunConsume); //房间的最低消费

            var fbi = new FrmBilling();

            this.evtFbi += new EventHandler(fbi.SetText);
            if (this.evtFbi != null)
            {
                this.evtFbi(this, mea);
                fbi.FormClosed += new FormClosedEventHandler(fbi_FormClosed);
                fbi.ShowDialog();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TabPage  tp = tabControl1.SelectedTab;
            ListView lv = tp.Controls[0] as ListView;

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

            mea.Obj = lv.SelectedItems[0].Tag;
            FrmBilling fbm = new FrmBilling();

            mea.Name     = (tp.Tag as RoomInfo).RoomName;
            mea.Money    = Convert.ToDecimal((tp.Tag as RoomInfo).RoomMinimunConsume);
            this.evtFbm += new EventHandler(fbm.SetText);
            if (evtFbm != null)
            {
                this.evtFbm(this, mea);
                fbm.FormClosed += new FormClosedEventHandler(fbm_Formclosed);
                fbm.ShowDialog();
            }
        }
Esempio n. 3
0
        public event EventHandler evtBill;//开单事件
        //顾客开单
        private void btnFrmBilling_Click(object sender, EventArgs e)
        {
            //方式一
            //TabPage tb= tcin.SelectedTab;
            //方式二 获取当前选中的选项卡
            TabPage tp = tcin.TabPages[tcin.SelectedIndex];
            //获取当前选中房间的名字
            RoomInfo     room = tp.Tag as RoomInfo;
            FrmEventArgs fea  = new FrmEventArgs();

            fea.Money = Convert.ToDecimal(room.RoomMinimunConsume);
            fea.Name  = room.RoomName;

            //string roomName = room.RoomName;
            //最低消费

            //获取当前选项卡中的listview控件
            ListView lv = tp.Controls[0] as ListView;

            //判断是否有选中的餐桌
            if (lv.SelectedItems.Count > 0)
            {
                //获取当前选中的餐桌
                DeskInfo dk = lv.SelectedItems[0].Tag as DeskInfo;
                if (dk.DeskState == 0)
                {
                    fea.obj = dk;
                    FrmBilling fbi = new FrmBilling();
                    this.evtBill += new EventHandler(fbi.SetText);//注册事件
                    if (this.evtBill != null)
                    {
                        this.evtBill(this, fea);
                    }

                    fbi.FormClosed += new FormClosedEventHandler(fbi_FormClosed);

                    fbi.ShowDialog();
                }
                else
                {
                    MessageBox.Show("当前餐桌在使用");
                }
            }
            else
            {
                MessageBox.Show("没选中");
            }
        }
Esempio n. 4
0
        //顾客开单
        private void button1_Click(object sender, EventArgs e)
        {
            TabPage  tp = tcInFo.SelectedTab;         //获取当前餐桌所在的房间的选项卡
            RoomInfo r  = tp.Tag as RoomInfo;         //从tag中获取房间的对象==坑---名字,最低消费
            ListView lv = tp.Controls[0] as ListView; //获取listview

            if (lv.SelectedItems.Count > 0)
            {
                ListViewItem lvt = lv.SelectedItems[0]; //获取当前listview中选中的项
                DeskInfo     dk  = lvt.Tag as DeskInfo; //可以获取该选中的餐桌的编号还有id
                if (dk.DeskState == 0)
                {
                    FrmBilling fbl = new FrmBilling();
                    this.evtBill += new EventHandler(fbl.SetLab);
                    //获取要传递的参数后  显示开单的窗体
                    FrmEventArgs fea = new FrmEventArgs();
                    fea.Obj   = dk;         //餐桌的对象
                    fea.Name  = r.RoomName; //房间的名字,  //获取该餐桌所在的房间,这个房间的最低消费
                    fea.Money = Convert.ToDecimal(r.RoomMinimunConsume);
                    if (this.evtBill != null)
                    {
                        this.evtBill(this, fea);
                    }
                    //此窗体关闭后 一定要进行刷新.
                    fbl.FormClosed += new FormClosedEventHandler(fbl_FormClosed);
                    fbl.ShowDialog();//开单的窗体
                }
                else
                {
                    MessageBox.Show("请选择未开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("请看好目标后再下手");
            }
        }
        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();
            }
        }