Exemplo n.º 1
0
        //确定开单
        private void btnOK_Click(object sender, EventArgs e)
        {
            //开单用了三张表
            //先改变餐桌的状态,需要餐桌的id
            DeskInfoBLL dkBll  = new DeskInfoBLL();
            bool        dkFlag = dkBll.UpdateDeskStateByDeskId(this.ID, 1);
            //添加一个订单
            OrderInfo order = new OrderInfo();

            order.DelFlag    = 0;
            order.OrderState = 1;
            order.Remark     = txtPersonCount.Text + "," + txtDescription.Text;
            order.SubBy      = 1;
            order.SubTime    = System.DateTime.Now;
            OrderInfoBLL orderBll = new OrderInfoBLL();
            //插入一条数据返回该数据的主键id
            int orderId = orderBll.AddOrderInfo(order);
            //再把订单的id和餐桌的id存到中间表中
            ROrderDeskBLL rodBll = new ROrderDeskBLL();
            ROrderDesk    rod    = new ROrderDesk();

            rod.DeskId  = this.ID; //餐桌的id
            rod.OrderId = orderId; //订单的id
            bool rodFlag = rodBll.AddROrderDesk(rod);

            if (dkFlag && rodFlag)
            {
                MessageBox.Show("开单成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("开单失败");
            }
        }
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
        private void btnOk_Click(object sender, EventArgs e)
        {
            //顾客开单
            //更新餐桌状态
            DeskInfoBLL dbll   = new DeskInfoBLL();
            int         deksId = Convert.ToInt32(labId.Text);

            bool isDesk = dbll.UpdateDeskInfoStateByDeskId(deksId, 1);//1标识正在使用
            //生成订单
            OrderInfoBLL obll  = new OrderInfoBLL();
            OrderInfo    order = new OrderInfo();

            order.BeginTime  = DateTime.Now;
            order.DelFlag    = 0;
            order.DisCount   = 0;
            order.OrderMoney = 0;
            order.OrderState = 1;//表示已经开单
            order.Remark     = txtPersonCount.Text + "个人" + txtDescription.Text;
            order.SubBy      = 1;
            order.SubTime    = System.DateTime.Now;

            object obj = obll.AddOrderInfo(order);//返回的是刚刚插入的订单的主键id;
            //向中间表插入一条数据
            R_Order_DeskBLL rodbll = new R_Order_DeskBLL();
            R_Order_Desk    rod    = new R_Order_Desk();

            rod.DeskId  = deksId;
            rod.OrderId = Convert.ToInt32(obj);
            ordId       = Convert.ToInt32(obj);
            bool isRod = rodbll.AddR_Order_Desk(rod);

            if (!isDesk || !isRod)
            {
                md.MsgDivShow("开单失败,请联系管理员", 1);
                return;
            }
            md.MsgDivShow("开单成功", 1, Bind);

            //  md.MsgDivShow("开单成功",1,Bind);
        }