Example #1
0
        public void Ready()
        {
            _hasError = true;

            Rollback = RollbackService.GetById(Id);
            State    = ModelHelper.GetBoundText(Rollback, x => x.State);
            var currentUser = SecurityHelper.GetCurrentUser().CurrentUser;
            var shop        = ShopService.GetById(Rollback.ShopId);

            var shopDealLog = ShopDealLogService.GetById(Rollback.ShopDealLogId);

            this.SubmitTime      = Rollback.SubmitTime;
            this.DealSubmitTime  = shopDealLog.SubmitTime;
            this.Amount          = shopDealLog.Amount;
            this.AccountName     = shopDealLog.AccountName;
            this.PosName         = shopDealLog.SourcePosName;
            this.ShopName        = shop.Name;
            this.ShopDisplayName = shop.DisplayName;

            SerialServerNo = shopDealLog.SerialServerNo;
            DealType       = ModelHelper.GetBoundText(shopDealLog, x => DealType);
            _hasError      = false;
        }
Example #2
0
        public SimpleAjaxResult Ready()
        {
            var user   = this.SecurityHelper.GetCurrentUser().CurrentUser as ShopUser;
            var shopId = user.ShopId;

            foreach (var id in Ids)
            {
                using (var tran = TransactionHelper.BeginTransaction())
                {
                    var shopDealLog = ShopDealLogService.GetById(id);
                    if (shopDealLog.State == DealLogStates.Normal_)
                    {
                        return(new SimpleAjaxResult("该交易已冲正"));
                    }
                    if (shopDealLog.ShopId != shopId)
                    {
                        return(new SimpleAjaxResult("只能提交自己商户的申请"));
                    }

                    var rollback = this.RollbackShopDealLogService.GetByShopDealLogId(shopDealLog.ShopDealLogId);
                    if (rollback != null)
                    {
                        return(new SimpleAjaxResult("该交易取消请求已经存在"));
                    }
                    rollback = new RollbackShopDealLog
                    {
                        ShopDealLogId = shopDealLog.ShopDealLogId,
                        ShopId        = shopDealLog.ShopId,
                        State         = RollbackShopDealLogState.Processing,
                    };

                    RollbackShopDealLogService.Create(rollback);
                    tran.Commit();
                }
            }
            return(new SimpleAjaxResult());
        }