Ejemplo n.º 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
            {
            }
        }
Ejemplo n.º 2
0
 private void LoadDeskInfoByRoomIdAndTabIndex(TabPage tp)
 {
     if (tp != null)
     {
         RoomInfo r  = tp.Tag as RoomInfo;
         ListView lv = tp.Controls[0] as ListView;
         lv.Clear();
         DeskInfoBll     dbll     = new DeskInfoBll();
         List <DeskInfo> listDesk = dbll.GetAllDeskInfoByRoomId(Convert.ToInt32(r.RoomId));
         for (int i = 0; i < listDesk.Count; i++)
         {
             lv.Items.Add(listDesk[i].DeskName, Convert.ToInt32(listDesk[i].DeskState));
             lv.Items[i].Tag = listDesk[i];
         }
     }
 }
Ejemplo n.º 3
0
        private void btnAccounts_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtMoney.Text))
            {
                MessageBox.Show("想吃霸王餐做你的美梦去吧");
                return;
            }
            if (Convert.ToDecimal(txtMoney.Text) < Convert.ToDecimal(lblMoney.Text))
            {
                MessageBox.Show("这点钱只能买个茶叶蛋");
                return;
            }
            //餐桌状态改变
            DeskInfoBll dbll   = new DeskInfoBll();
            bool        dkFlag = dbll.UpdateDeskStateByDeskId(this.dkId, 0);
            OrderInfo   order  = new OrderInfo();

            if (cmbMemmber.SelectedIndex != 0)
            {
                MemmberInfo mem = cmbMemmber.SelectedItem as MemmberInfo;
                order.OrderMemId = mem.MemmberId;   //会员的id
                order.DisCount   = mem.MemDiscount; //折扣
                //会员的余额.
                decimal money = Convert.ToDecimal(mem.MemMoney) - Convert.ToDecimal(lblMoney.Text);
                //判断给你们了

                //更新会员卡内的钱
                MemmberInfoBll memBll  = new MemmberInfoBll();
                bool           memFlag = memBll.UpdateMoneyByMemId(mem.MemmberId, money);
            }
            //订单的状态改变,钱,会员的id,折扣
            order.EndTime    = System.DateTime.Now;//结束时间
            order.OrderId    = Convert.ToInt32(labOrderId.Text);
            order.OrderMoney = Convert.ToDecimal(lblMoney.Text);

            OrderInfoBll obll  = new OrderInfoBll();
            bool         oFlag = obll.UpdateOrderInfoMoney(order);

            if (dkFlag && oFlag)
            {
                MessageBox.Show("结账成功");
            }
            else
            {
                MessageBox.Show("失败");
            }
        }