Exemplo n.º 1
0
        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;
            }
            if ((lv.SelectedItems[0].Tag as DeskInfo).DeskState != 1)
            {
                MessageBox.Show("请选择开单的餐桌");
                return;
            }
            MyEventArgs mea_add = new MyEventArgs();
            FrmAddMoney fam     = new FrmAddMoney();

            mea_add.Name = (lv.SelectedItems[0].Tag as DeskInfo).DeskName;
            OrderInfoBll obll = new OrderInfoBll();
            int          orde = obll.GetOrderIdByDeskId((lv.SelectedItems[0].Tag as DeskInfo).DeskId);

            mea_add.Temp = orde;
            this.evtFam += new EventHandler(fam.SetText);
            if (this.evtFam != null)
            {
                this.evtFam(this, mea_add);
                fam.FormClosed += new FormClosedEventHandler(fam_Formclose);
                fam.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //餐桌的状态
            var bllBk  = new DeskInfoBLL();
            var dkFlag = bllBk.UpdateDeskStateByDeskId(_id, 1);

            //添加一个订单
            var odrBll = new OrderInfoBLL();
            var odr    = new OrderInfo();

            odr.BeginTime  = System.DateTime.Now;
            odr.SubTime    = System.DateTime.Now;
            odr.DelFlag    = 0;
            odr.OrderMoney = 0;
            odr.OrderState = 1;
            odr.Remark     = txtPersonCount.Text + txtDescription.Text;
            odr.SubBy      = 1;
            int orderId = odrBll.AddOrderInfo(odr);

            //添加一个中间表
            var rodBll = new R_Order_DeskBLL();
            var rod    = new R_Order_Desk();

            rod.DeskId  = _id;
            rod.OrderId = orderId;
            var rodFlag = rodBll.AddROrderDesk(rod);

            if (dkFlag && rodFlag)
            {
                MessageBox.Show("开单成功");
                if (ckbMeal.Checked)
                {
                    var mea = new MyEventArgs();
                    mea.Name = labDeskName.Text; //餐桌编号
                    mea.Temp = orderId;          //订单Id
                    //窗体传值
                    var 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
                {
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("开单失败");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 确定开单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            //做三件事情
            //1更改餐桌状态
            DeskInfoBll dkbll  = new DeskInfoBll();
            bool        dkFlag = dkbll.UpdateDeskStateByDeskId(this.ID, 1);

            //2添加一个订单
            OrderInfoBll orbll = new OrderInfoBll();
            OrderInfo    o     = new OrderInfo();

            o.SubTime    = System.DateTime.Now;
            o.DelFlag    = 0;
            o.OrderMoney = 0;
            o.OrderState = 1;
            o.Remark     = txtPersonCount.Text + txtDescription.Text;
            o.SubBy      = 1;
            int orderId = orbll.AddOrderInfo(o);

            //3添加一个中间表
            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.AddOrderDesk(rod);

            if (dkFlag && rodFlag)
            {
                MessageBox.Show("开单成功");
            }
            else
            {
                MessageBox.Show("开单失败");
            }

            if (ckbMeal.Checked)
            {
                FrmAddMoney frm_money = new FrmAddMoney();
                mea_money.Name    = labDeskName.Text; //餐桌的编号
                mea_money.Temp    = orderId;          //订单id
                this.evtFrmmoney += new EventHandler(frm_money.SetText);
                if (this.evtFrmmoney != null)
                {
                    this.evtFrmmoney(this, mea_money);
                    frm_money.FormClosed += new FormClosedEventHandler(frm_money_formclosed);
                    frm_money.ShowDialog();
                }
            }
            else
            {
            }
        }
Exemplo n.º 4
0
        //增加消费
        private void button2_Click(object sender, EventArgs e)
        {
            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 == 1)
                {
                    //fea.obj = dk;
                    fea.Name = dk.DeskName;//餐桌的编号
                    //订单的id,根据餐桌的id查找订单的id
                    OrderInfoBLL obll    = new OrderInfoBLL();
                    int          orderId = obll.GetOrderIdByDeskId(dk.DeskId);
                    fea.Temp = orderId;


                    FrmAddMoney fam = new FrmAddMoney();
                    this.evtAddMoney += new EventHandler(fam.SetText);//注册事件
                    if (this.evtAddMoney != null)
                    {
                        this.evtAddMoney(this, fea);
                    }

                    fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed);

                    fam.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请选择开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("没选中");
            }
        }
Exemplo n.º 5
0
        //确定开单
        private void btnOK_Click(object sender, EventArgs e)
        {
            //餐桌的id,改变餐桌的状态
            DeskInfoBLL dkBll    = new DeskInfoBLL();
            bool        dkResult = dkBll.UpdateDeskStateByDeskId(this.Id, 1);//餐桌开单了
            //添加一个订单,需要备注,订单的状态,提交人,提交时间,删除标识
            OrderInfo order = new OrderInfo();

            order.Remark     = txtPersonCount.Text + txtDescription.Text;//人数和描述(备注)直接存到备注信息里
            order.SubBy      = 1;
            order.SubTime    = DateTime.Now;
            order.DelFlag    = 0;
            order.OrderState = 1;                                          //标识的是这个订单正在使用
            OrderInfoBLL odBll   = new OrderInfoBLL();
            int          orderId = odBll.GetOrderIdInsertOrderInfo(order); //插入一个订单的同时获取该订单的id
            //向中间表(订单和餐桌)插入 订单的id还有餐桌的id
            ROrderDeskBLL roddkBll = new ROrderDeskBLL();
            ROrderDesk    rod      = new ROrderDesk();

            rod.DeskId  = this.Id; //餐桌id
            rod.OrderId = orderId; //订单id
            bool RoDResult = roddkBll.AddROrderDesk(rod);

            if (dkResult && RoDResult)
            {
                MessageBox.Show("开单成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("开单失败");
            }

            if (ckbMeal.Checked)
            {
                FrmAddMoney fam = new FrmAddMoney();
                this.evt += new EventHandler(fam.SetTxt);
                FrmEventArgs fea = new FrmEventArgs();
                fea.Name = labDeskName.Text; //餐桌的编号
                fea.Temp = orderId;          //订单的id
                if (this.evt != null)
                {
                    this.evt(this, fea);
                }
                //增加消费的窗体关闭后,当前的开单窗体关闭
                fam.FormClosed += new FormClosedEventHandler(fam_FormClosed);
                fam.ShowDialog();
            }
        }
        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("开单失败");
            }
        }
Exemplo n.º 7
0
        //增加消费
        private void button2_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)
                {
                    FrmAddMoney fam = new FrmAddMoney();
                    this.evtMoney += new EventHandler(fam.SetTxt);//添加事件
                    //获取要传递的参数后  显示开单的窗体
                    FrmEventArgs fea = new FrmEventArgs();
                    //fea.Obj = dk;//餐桌的对象
                    fea.Name = dk.DeskName;//餐桌的编号
                    //这里必须要获取该餐桌的订单id===============坑
                    OrderInfoBLL obll    = new OrderInfoBLL();
                    int          orderId = obll.GetOrderIdByDeskId(dk.DeskId); //获取订单的id(当前餐桌)
                    fea.Temp = orderId;                                        //订单id传到消费窗体中
                    if (this.evtMoney != null)
                    {
                        this.evtMoney(this, fea);
                    }
                    //此窗体关闭后 一定要进行刷新.
                    fam.FormClosed += new FormClosedEventHandler(fbl_FormClosed);
                    fam.ShowDialog();//增加消费的窗体显示出来
                }
                else
                {
                    MessageBox.Show("请选择已经开单的餐桌");
                }
            }
            else
            {
                MessageBox.Show("请看好目标后再下手");
            }
        }
Exemplo n.º 8
0
        private void btnMoney_Click(object sender, EventArgs e)
        {
            var tp = tabc.SelectedTab;
            var 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;
            }
            //注册事件
            var fam = new FrmAddMoney();

            evtFrmMoney += new EventHandler(fam.SetText);
            var mea = new MyEventArgs();
            var dk  = lv.SelectedItems[0].Tag as DeskInfo;

            mea.Name = dk.DeskName;//餐桌编号
            var bll = new OrderInfoBLL();

            //订单的id,选中的开单餐桌的当前订单
            mea.Temp = bll.GetOrderIdByDeskId(dk.DeskId);
            //窗体传值
            if (this.evtFrmMoney != null)
            {
                this.evtFrmMoney(this, mea);
                fam.FormClosed += new FormClosedEventHandler(fbi_FormClosed);
                fam.ShowDialog();
            }
        }
        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();
            }
        }