Ejemplo n.º 1
0
        public bool CreatePrePayOrder(PayingOrder payingOrder)
        {
            bool returnValue = false;

            _daoManager.BeginTransaction();
            try
            {
                if (payingOrder != null)
                {
                    //日结
                    string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo();
                    //更新Order
                    if (_orderDao.UpdatePrePayOrder(payingOrder.order))
                    {
                        //更新OrderDetails
                        foreach (OrderDetails item in payingOrder.orderDetailsList)
                        {
                            _orderDetailsDao.UpdateOrderDetailsDiscount(item);
                        }
                        //插入OrderDiscount
                        if (payingOrder.orderDiscountList != null && payingOrder.orderDiscountList.Count > 0)
                        {
                            foreach (OrderDiscount item in payingOrder.orderDiscountList)
                            {
                                item.DailyStatementNo = dailyStatementNo;
                                _orderDiscountDao.CreateOrderDiscount(item);
                            }
                        }
                        returnValue = true;
                    }
                }
                _daoManager.CommitTransaction();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[CreatePrePayOrder]参数:payingOrder_{0}", JsonConvert.SerializeObject(payingOrder)), exception);
                _daoManager.RollBackTransaction();
                returnValue = false;
            }
            return(returnValue);
        }
Ejemplo n.º 2
0
        public bool ModifyForOrder(ModifiedPaidOrder modifiedOrder)
        {
            bool returnValue = false;

            _daoManager.BeginTransaction();
            try
            {
                if (modifiedOrder != null)
                {
                    //日结
                    string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo();
                    //更新Order
                    if (_orderDao.UpdatePaidOrderPrice(modifiedOrder.order))
                    {
                        //更新OrderDetails
                        foreach (OrderDetails item in modifiedOrder.orderDetailsList)
                        {
                            _orderDetailsDao.UpdateOrderDetailsDiscount(item);
                        }
                        if (modifiedOrder.orderDiscountList != null && modifiedOrder.orderDiscountList.Count > 0)
                        {
                            foreach (OrderDiscount item in modifiedOrder.orderDiscountList)
                            {
                                //删除OrderDiscount
                                _orderDiscountDao.DeleteOrderSingleDiscount(item.OrderDetailsID);
                                //插入OrderDiscount
                                item.DailyStatementNo = dailyStatementNo;
                                _orderDiscountDao.CreateOrderDiscount(item);
                            }
                        }
                        _orderPayoffDao.DeleteOrderPayoff(modifiedOrder.order.OrderID);
                        //插入OrderPayoff
                        foreach (OrderPayoff item in modifiedOrder.orderPayoffList)
                        {
                            item.DailyStatementNo = dailyStatementNo;
                            _orderPayoffDao.CreateOrderPayoff(item);
                        }
                        returnValue = true;
                    }
                }
                _daoManager.CommitTransaction();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[ModifyForOrder]参数:modifiedOrder_{0}", JsonConvert.SerializeObject(modifiedOrder)), exception);
                _daoManager.RollBackTransaction();
                returnValue = false;
            }
            return(returnValue);
        }
Ejemplo n.º 3
0
        public bool UpdateOrderDetailsDiscount(OrderDetails orderDetails)
        {
            bool result = false;

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