コード例 #1
0
 protected void PreCheckResponsibleUser(ResponsibleUserInfo entity)
 {
     if (!entity.IncomeStyle.HasValue && !entity.PayTypeSysNo.HasValue && !entity.ShipTypeSysNo.HasValue && !entity.CustomerSysNo.HasValue)
     {
         ThrowBizException("TrackingInfo_ValueCantAllEmpty");
     }
     if (String.IsNullOrEmpty(entity.ResponsibleUserName))
     {
         ThrowBizException("TrackingInfo_UserNameIsRequird");
     }
     if (!entity.Status.HasValue)
     {
         ThrowBizException("TrackingInfo_StatusIsRequird");
     }
     if (String.IsNullOrEmpty(entity.EmailAddress))
     {
         ThrowBizException("TrackingInfo_EmailAddressIsRequird");
     }
     if (entity.CustomerSysNo.HasValue)
     {
         if (!ExternalDomainBroker.ExistsCustomer(entity.CustomerSysNo.Value))
         {
             ThrowBizException("TrackingInfo_CustomerNotFound");
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// 创建顾客余额退款信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual BalanceRefundInfo Create(BalanceRefundInfo entity)
        {
            if (entity.ReturnPrepayAmt <= 0)
            {
                //throw new BizException("退款金额必须大于等于0。");
                ThrowBizException("BalanceRefund_RefundAmoutNeedMoreThan0");
            }
            if (!ExternalDomainBroker.ExistsCustomer(entity.CustomerSysNo.Value))
            {
                //throw new BizException(string.Format("编号为{0}的顾客不存在。", entity.CustomerSysNo));
                ThrowBizException("BalanceRefund_NotExsistCustomer", entity.CustomerSysNo);
            }

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = IsolationLevel.ReadUncommitted;
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, options))
            {
                ExternalDomainBroker.AdjustCustomerPerpayAmount(entity.CustomerSysNo.Value, 0, -entity.ReturnPrepayAmt.Value, PrepayType.BalanceReturn, "余额账户转银行退款");

                entity.Status = BalanceRefundStatus.Origin;
                entity        = m_BalanceRefundDA.Create(entity);

                //发送创建Message
                EventPublisher.Publish(new CreateBalanceRefundMessage()
                {
                    ReturnPrepaySysNo = entity.SysNo.Value,
                    CurrentUserSysNo  = ServiceContext.Current.UserSysNo
                });


                ts.Complete();
            }

            return(entity);
        }