Exemplo n.º 1
0
        public CancelFltOrderResponseViewModel CancelOnlineCorpOrder(CancelFltOrderRequestViewModel request)
        {
            List <CorpAduitOrderInfoModel> aduitOrderInfoModels =
                _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(request.OrderId);

            if (aduitOrderInfoModels != null && aduitOrderInfoModels.Count > 0)
            {
                if (aduitOrderInfoModels[0].Status != (int)CorpAduitOrderStatusEnum.F &&
                    aduitOrderInfoModels[0].Status != (int)CorpAduitOrderStatusEnum.J)
                {
                    throw new Exception("当前订单处于审批中,不能取消");
                }
            }

            int code = 0;

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    code = _cancelFltOrderServiceBll.CancelOnlineCorpOrder(request.OrderId, request.Cid, "线上客户取消订单");
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }

            return(new CancelFltOrderResponseViewModel()
            {
                Code = code
            });
        }
Exemplo n.º 2
0
        public ResponseBaseViewModel <CancelFltOrderResponseViewModel> CancelOnlineOrder([FromBody] CancelFltOrderRequestViewModel request)
        {
            if (request == null)
            {
                request = new CancelFltOrderRequestViewModel();
            }
            request.Cid = this.GetCid();
            CancelFltOrderResponseViewModel responseViewModel         = _cancelFltOrderApplication.CancelOnlineCorpOrder(request);
            ResponseBaseViewModel <CancelFltOrderResponseViewModel> v = new ResponseBaseViewModel <CancelFltOrderResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = responseViewModel.Code, MojoryToken = this.GetToken()
                },
                Data = responseViewModel
            };

            return(v);
        }