Exemplo n.º 1
0
        public void AddNLPOST(NetherlandsParcelRespons netherlandsParcelRespons, WayBillInfo wayBillInfo)
        {
            if (netherlandsParcelRespons == null)
            {
                throw new BusinessLogicException("数据不能为空!");
            }
            var result = _netherlandsParcelResponsRepository.Exists(p => p.WayBillNumber == netherlandsParcelRespons.WayBillNumber);

            if (result)
            {
                throw new BusinessLogicException("该数据已存在!");
            }
            netherlandsParcelRespons.LastUpdatedBy = _workContext.User.UserUame;
            netherlandsParcelRespons.LastUpdatedOn = DateTime.Now;
            netherlandsParcelRespons.CreatedBy     = _workContext.User.UserUame;
            netherlandsParcelRespons.CreatedOn     = DateTime.Now;
            _netherlandsParcelResponsRepository.Add(netherlandsParcelRespons);

            wayBillInfo.LastUpdatedBy = _workContext.User.UserUame;
            wayBillInfo.LastUpdatedOn = DateTime.Now;
            wayBillInfo.CustomerOrderInfo.LastUpdatedBy = _workContext.User.UserUame;
            wayBillInfo.CustomerOrderInfo.LastUpdatedOn = DateTime.Now;
            _wayBillInfoRepository.Modify(wayBillInfo);

            using (var tran = new TransactionScope())
            {
                _netherlandsParcelResponsRepository.UnitOfWork.Commit();
                _wayBillInfoRepository.UnitOfWork.Commit();
                AddDeliveryChannelChangeLog(wayBillInfo.WayBillNumber, wayBillInfo.OutShippingMethodID.Value, wayBillInfo.VenderCode);
                tran.Complete();
            }
        }
Exemplo n.º 2
0
        public void UpdateNLPOST(NetherlandsParcelRespons netherlandsParcelRespons)
        {
            if (netherlandsParcelRespons == null)
            {
                throw new BusinessLogicException("数据不能为空!");
            }
            var result = _netherlandsParcelResponsRepository.Single(p => p.WayBillNumber == netherlandsParcelRespons.WayBillNumber);

            if (result == null)
            {
                throw new BusinessLogicException("该数据不存在!");
            }
            result.LastUpdatedBy = _workContext.User.UserUame;
            result.LastUpdatedOn = DateTime.Now;
            result.Status        = netherlandsParcelRespons.Status;
            _netherlandsParcelResponsRepository.Modify(result);
            _netherlandsParcelResponsRepository.UnitOfWork.Commit();
        }