예제 #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;
     }
 }
예제 #2
0
 /// <summary>
 /// 添加一个餐桌和订单的中间表的一条数据
 /// </summary>
 /// <param name="rod">中间表的对象</param>
 /// <returns>受影响的行数</returns>
 public bool AddR_Order_Desk(R_Order_Desk rod)
 {
     return rodDal.AddR_Order_Desk(rod) > 0;
 }