Пример #1
0
        /// <summary>
        /// 更新单据
        /// </summary>
        /// <returns>0:更新失败 1:更新成功 2:单据被其他设备占用</returns>
        public Int32 UpdateSalesOrder(SalesOrder salesOrder)
        {
            int result = 0;

            _daoManager.BeginTransaction();
            try
            {
                Order   order = salesOrder.order;
                BizDesk desk  = _deskDao.GetBizDeskByName(order.DeskName);
                if (desk == null || desk.DeviceNo == order.DeviceNo)
                {
                    if (_orderDao.UpdateOrder(order))
                    {
                        //日结号
                        string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo();
                        //菜单品项序号
                        int seqNumber = _orderDetailsDao.GetSequenceNum(order.OrderID);
                        foreach (OrderDetails item in salesOrder.orderDetailsList)
                        {
                            item.OrderBy          = seqNumber;
                            item.DailyStatementNo = dailyStatementNo;
                            _orderDetailsDao.UpdateOrderDetails(item);
                            seqNumber++;
                        }
                        //折扣信息
                        if (salesOrder.orderDiscountList != null && salesOrder.orderDiscountList.Count > 0)
                        {
                            foreach (OrderDiscount item in salesOrder.orderDiscountList)
                            {
                                _orderDiscountDao.UpdateOrderDiscount(item);
                            }
                        }
                        result = 1;
                    }
                }
                else
                {
                    result = 2;
                }
                _daoManager.CommitTransaction();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[UpdateSalesOrder]参数:salesOrder_{0}", JsonConvert.SerializeObject(salesOrder)), exception);
                result = 0;
                _daoManager.RollBackTransaction();
            }
            return(result);
        }
Пример #2
0
        public bool UpdateOrderDiscount(OrderDiscount orderDiscount)
        {
            bool result = false;

            try
            {
                _daoManager.OpenConnection();
                result = _orderDiscountDao.UpdateOrderDiscount(orderDiscount);
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[UpdateOrderDiscount]参数:orderDiscount_{0}", JsonConvert.SerializeObject(orderDiscount)), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(result);
        }