示例#1
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
            {
            }
        }
示例#2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //首先改变餐桌状态
            DeskInfoBLL dkBll  = new DeskInfoBLL();
            bool        dkFlag = dkBll.UpdateDeskInfoStateByDeskId(Convert.ToInt32(labId.Text), 1);
            //添加一个订单 返回该订单ID
            OrderInfo order = new  OrderInfo();

            order.BeginTime  = System.DateTime.Now;                             //订单的开始时间
            order.DelFlag    = 0;                                               //删除标识
            order.DisCount   = 0;                                               //折扣==针对会员
            order.OrderMoney = 0;                                               //订单消费的金额默认值为0
            order.OrderState = 1;                                               //订单状态1===使用
            order.Remark     = txtPersonCount.Text + "个" + txtDescription.Text; //备注
            order.SubBy      = 1;                                               //提交人默认1
            order.SubTime    = System.DateTime.Now;
            OrderInfoBll oBll = new OrderInfoBll();
            //获得订单的id
            object orderIdObj = oBll.AddOrderInfo(order);
            //为餐桌和订单的中间表添加一条记录
            R_Order_Desk rod = new R_Order_Desk();

            rod.DeskId  = Convert.ToInt32(labId.Text); //餐桌的id
            rod.OrderId = Convert.ToInt32(orderIdObj); //订单的id
            ordId       = rod.OrderId;                 //存储订单的id
            R_Order_DeskBll rodBll  = new R_Order_DeskBll();
            bool            rodFlag = rodBll.AddR_Order_Desk(rod);

            if (dkFlag && rodFlag)
            {
                md.MsgDivShow("开单成功", 1, Bind);
            }
            else
            {
                md.MsgDivShow("开单失败,请联系程序员", 1);
                return;
            }
        }