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 = ""; } }
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; } }