Esempio n. 1
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;
     }
 }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CheckEmpty())
            {
                DeskInfoBLL dkBll = new DeskInfoBLL();
                DeskInfo dk = new DeskInfo();
                dk.DeskName = txtDeskName.Text;
                dk.DeskRegion = txtDeskRegion.Text;//描述信息
                dk.DeskRemark = txtDeskRemark.Text;//备注
                dk.RoomId = Convert.ToInt32(cmbRoom.SelectedValue);//房间的id

                if (Temp == 1)//新增
                {
                    dk.DelFlag = 0;
                    dk.DeskState = 0;//空闲===1===就餐
                    dk.SubBy = 1;
                    dk.SubTime = System.DateTime.Now;
                }
                else if (Temp == 2)//修改操作
                {
                    dk.DeskId = Convert.ToInt32(labId.Text);
                }
                md.MsgDivShow(dkBll.AddOrUpdateDeskInfo(dk, Temp) ? "操作成功" : "操作失败", 1, Bind);
            }
        }
Esempio n. 3
0
 private void btnDDesk_Click(object sender, EventArgs e)
 {
     //判断是否选中的要删除的餐桌
     if (dgvDesk.SelectedRows.Count <= 0)
     {
         md1.MsgDivShow("请选中要删除的餐桌", 1);
         return;
     }
     if (MessageBox.Show("确定要删除该餐桌吗?", "删除餐桌", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
     {
         int id = ((DeskInfo)dgvDesk.SelectedRows[0].DataBoundItem).DeskId;
         DeskInfoBLL dkBll = new DeskInfoBLL();
         md1.MsgDivShow(dkBll.SoftDeleteDeskByDeskId(id) ? "操作成功" : "操作失败", 1);
         LoadAllDeskInfoByDelFlag(0);
         return;
     }
     md1.MsgDivShow("您已经取消了删除该餐桌的操作", 1);
 }
Esempio n. 4
0
        //结账
        private void btnAccounts_Click(object sender, EventArgs e)
        {
            //餐桌状态发生改变
            DeskInfoBLL dkbll = new DeskInfoBLL();
            bool dkResult = dkbll.UpdateDeskInfoStateByDeskId(Convert.ToInt32(labdkId.Text), 0);
            //订单状态发生改变
            OrderInfoBll orderBll = new OrderInfoBll();
            OrderInfo order = new OrderInfo();
            order.EndTime = System.DateTime.Now;//当前的时间
            order.OrderMoney = Convert.ToDouble(lblMoney.Text);//结账后的金额
            order.OrderState = 2;//状态
            order.OrderId = Convert.ToInt32(labOrderId.Text);
            if (cmbMember.SelectedIndex != 0)
            {
                //获取选中的会员对象
                MemberInfo mem = (MemberInfo)cmbMember.SelectedItem;
                order.OrderMemberId = mem.MemberId;//会员的id
                order.DisCount = mem.MemDiscount;//折扣

                //根据会员的id更新该会员的金额
                MemberInfoBl memBll = new MemberInfoBl();
                //得到会员的金额
                double money = Convert.ToDouble(labyuMoney.Text) - Convert.ToDouble(lblMoney.Text);
                //更新会员余额
                memBll.UpdateMemberMoneyById(mem.MemberId, money);//==不接收了
            }

            //更新订单中的金额
            bool orderResult = orderBll.UpdateOrderInfo(order);
            //会员结账----更改会员余额
            //改变订单对应的订单和菜单的中间表中的菜的状态
            R_Order_ProductBll ropBll = new R_Order_ProductBll();
            bool ropResult = ropBll.UpdateR_Order_ProductDelFlagByOrderId(Convert.ToInt32(labOrderId.Text));
            if (dkResult && orderResult & ropResult)
            {
                md.MsgDivShow("顾客结账成功", 1);
            }
            else
            {
                md.MsgDivShow("结账失败了", 1);
            }
        }
Esempio n. 5
0
        private void btnDRoom_Click(object sender, EventArgs e)
        {
            if (dgvRoom.SelectedRows.Count <= 0)
            {
                md.MsgDivShow("请选中要删除的房间", 1);
                return;
            }
            if (MessageBox.Show("确认删除该房间吗?", "删除房间", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                int id = ((RoomInfo)dgvRoom.SelectedRows[0].DataBoundItem).RoomId;

                //判断该房间下是否有餐桌,有餐桌就不删除该房间
                DeskInfoBLL dkBll = new DeskInfoBLL();
                if (dkBll.GetDeskInfoCountByRoomId(id)>0)
                {
                    md.MsgDivShow("对不起,该房间下有餐桌", 1);
                    return;
                }
                //该房间下没有餐桌--可以删除选中的房间
                RoomInfoBLL rBll = new RoomInfoBLL();
                md.MsgDivShow(rBll.SoftDeleteRoomInfoByRoomId(id) ? "操作成功" : "操作失败", 1);
                LoadAllRoomInfoByDelFlag(0);//刷新
                return;
            }
            md.MsgDivShow("您已经取消了删除该房间");
        }
Esempio n. 6
0
 //加载餐桌
 private void LoadAllDeskInfoByDelFlag(int p)
 {
     DeskInfoBLL dkBll = new DeskInfoBLL();
     dgvDesk.AutoGenerateColumns = false;
     dgvDesk.DataSource = dkBll.GetAllDeskInfoByDelFlag(p);
     dgvDesk.ClearSelection();//清楚默认选中的行
 }
Esempio n. 7
0
 //根据房间的id显示里面的餐桌
 private void LoadDeakInfoByTabpageSelect(TabPage tp)
 {
     RoomInfo room = (RoomInfo)tp.Tag;//获取房间对象
     //获取tabpage控件中的listview控件
     ListView lv = (ListView)tp.Controls[0];//获取包含在控件内的控件
     lv.Clear();//清除
     //根据房间Id查询该房间下所有的餐桌
     DeskInfoBLL dkBll = new DeskInfoBLL();
     List<DeskInfo> listDesk = dkBll.GetAllDeskInfoByRoomId(room.RoomId);
     for (int i = 0; i < listDesk.Count; i++)
     {
         lv.Items.Add(listDesk[i].DeskName, listDesk[i].DeskState);//用指定的文本和图像创建一个项并添加到集合中
         lv.Items[i].Tag = listDesk[i];//餐桌对象存起来
     }
 }