Beispiel #1
0
        public void Apply()
        {
            var id = 0;

            if (!int.TryParse(this.SerialServerNo, out id))
            {
                this.AddError(0, "nonfound", SerialServerNo);
                DisableApply = true;
                return;
            }
            ShopDealLog = ShopDealLogService.GetByAddin(id);
            if (ShopDealLog == null)
            {
                this.AddError(0, "nonfound", SerialServerNo);
                DisableApply = true;
                return;
            }
            if (ShopDealLog.State == DealLogStates.Normal_)
            {
                DisableApply = true;
                return;
            }
            State = ModelHelper.GetBoundText(ShopDealLog, x => x.State);

            var rollbackItem = RollbackService.GetByShopDealLogId(ShopDealLog.ShopDealLogId);

            if (rollbackItem != null)
            {
                AddError(0, "alreadyExisting", SerialServerNo);
            }
            else
            {
                RollbackShopDealLog item = new RollbackShopDealLog()
                {
                    ShopDealLogId = ShopDealLog.ShopDealLogId,
                    State         = RollbackShopDealLogState.Processing,
                    ShopId        = ShopDealLog.ShopId,
                    SubmitTime    = DateTime.Now,
                };

                RollbackService.Create(item);
                this.AddMessage("success", SerialServerNo);

                Amount          = 0;
                AccountName     = "";
                PosName         = "";
                ShopName        = "";
                ShopDisplayName = "";
                SubmitTime      = null;
                DealType        = "";
                State           = "";
                SerialServerNo  = "";
            }
        }
Beispiel #2
0
        public SimpleAjaxResult Ready()
        {
            var user     = this.SecurityHelper.GetCurrentUser().CurrentUser as ShopUser;
            var rollback = RollbackService.GetById(Id);

            try
            {
                var cmd = new DeleteRollbackCommand(this.Id);
                UnityContainer.BuildUp(cmd);
                cmd.Execute(user);
                return(new SimpleAjaxResult());
            }
            catch (Exception ex)
            {
                return(new SimpleAjaxResult(ex.Message));
            }
        }
Beispiel #3
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;
        }
Beispiel #4
0
        public void Ready()
        {
            DisableApply = true;
            var id = 0;

            if (!int.TryParse(this.SerialServerNo, out id))
            {
                this.AddError(0, "nonfound", SerialServerNo);
                DisableApply = true;
                return;
            }
            ShopDealLog = ShopDealLogService.GetByAddin(id);
            if (ShopDealLog == null)
            {
                this.AddError(0, "nonfound", SerialServerNo);
                DisableApply = true;
                return;
            }
            State = ModelHelper.GetBoundText(ShopDealLog, x => x.State);

            Amount      = ShopDealLog.Amount;
            PosName     = ShopDealLog.SourcePosName;
            SubmitTime  = ShopDealLog.SubmitTime;
            AccountName = ShopDealLog.AccountName;
            DealType    = ModelHelper.GetBoundText(ShopDealLog, x => x.DealType);

            var shop = ShopService.GetById(ShopDealLog.ShopId);

            ShopDisplayName = shop.DisplayName;
            ShopName        = shop.Name;

            var account = AccountService.GetById(ShopDealLog.AccountId);

            if (account.OwnerId.HasValue)
            {
                var owner = MembershipService.GetUserById(account.OwnerId.Value);
                if (owner != null)
                {
                    OwnerMobile      = owner.Mobile;
                    OwnerDisplayName = owner.DisplayName;
                }
            }
            var accountShop = ShopService.GetById(account.ShopId);

            if (accountShop != null)
            {
                AccountShopName = accountShop.DisplayName;
            }
            var rollbackItem = RollbackService.GetByShopDealLogId(ShopDealLog.ShopDealLogId);

            if (rollbackItem != null)
            {
                if (rollbackItem.State == RollbackShopDealLogState.Processing)
                {
                    ApplyState = "ÒѾ­ÉêÇë";
                }
                else
                {
                    ApplyState = "ÒÑÉêÇë³É¹¦";
                }
            }
            else
            {
                if (ShopDealLog.State != DealLogStates.Normal_)
                {
                    ApplyState = "δÉêÇë";
                }
                DisableApply = false;
            }
        }