コード例 #1
0
ファイル: FrmMain.cs プロジェクト: aishangleyufu/c---learning
        private void btnJieZhang_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 != 1)
            {
                MessageBox.Show("请选择开单的餐桌");
                return;
            }
            MyEventArgs mea_jiezhang = new MyEventArgs();
            FrmBalance  fb           = new FrmBalance();

            this.evtjz      += new EventHandler(fb.SetText);
            mea_jiezhang.Obj = lv.SelectedItems[0].Tag;
            if (this.evtjz != null)
            {
                this.evtjz(this, mea_jiezhang);
                fb.FormClosed += new FormClosedEventHandler(fb_Formclosed);
                fb.ShowDialog();
            }
        }
コード例 #2
0
ファイル: FrmMain.cs プロジェクト: chenmo1378/ItcastCater
        //结账按钮
        private void button3_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 == 1)
                {
                    FrmBalance fb = new FrmBalance();
                    this.evtBalance += new EventHandler(fb.SetTxt);//传值
                    //获取要传递的参数后  显示开单的窗体
                    FrmEventArgs fea = new FrmEventArgs();

                    fea.Name  = dk.DeskName; //餐桌的编号
                    fea.DkIdZ = dk.DeskId;   //餐桌的id
                    //这里必须要获取该餐桌的订单id===============坑
                    OrderInfoBLL obll    = new OrderInfoBLL();
                    int          orderId = obll.GetOrderIdByDeskId(dk.DeskId); //获取订单的id(当前餐桌)
                    fea.Temp = orderId;                                        //订单id传到消费窗体中
                    if (this.evtBalance != null)
                    {
                        this.evtBalance(this, fea);
                    }
                    //此窗体关闭后 一定要进行刷新.
                    fb.FormClosed += new FormClosedEventHandler(fbl_FormClosed);//调用上面的方法
                    fb.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择已经开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("请看好目标后再下手");
            }
        }
コード例 #3
0
        //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();
            }
            
        }