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() { _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; }
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()); }
public void Delete(RollbackShopDealLog item) { _databaseInstance.Delete(item, TableName); }
public void Create(RollbackShopDealLog item) { item.RollbackShopDealLogId = _databaseInstance.Insert(item, TableName); }
public ListRollback(RollbackShopDealLog rollback) { _rollback = rollback; }
public ListShopRollback(RollbackShopDealLog rollback, ShopDealLog shopDealLog) { _rollback = rollback; _shopDealLog = shopDealLog; }