public void Ready() { DealLog = DealLogService.GetById(Convert.ToInt32(ServerSerialNo)); if (!DealLog.IsCancelEnabled) { DealLog = null; } else { ShopName = DealLog.ShopName; AccountName = DealLog.AccountName; } }
public void Ready() { var id = 0; if (!int.TryParse(ServerSerialNo, out id)) { return; } DealLog = DealLogService.GetById(id); if (DealLog == null) { return; } if (DealLog.State != DealLogStates.Normal || DealLog.DealType != DealTypes.Deal) { DealLog = null; return; } var user = SecurityHelper.GetCurrentUser().CurrentUser; AdminUser adminUser = user as AdminUser; if (adminUser != null) { if (DealLog.SourceShopName != Constants.SystemShopName) { DealLog = null; return; } } ShopUser shopUser = user as ShopUser; if (shopUser != null) { var shop = ShopService.GetById(shopUser.ShopId); if (DealLog.SourceShopName != shop.Name) { DealLog = null; return; } } }
public void Init(AccountServiceResponse rsp, int dealType) { Code = rsp.Code; Error = ModelHelper.GetBoundText(this, x => x.Code); if (Code == ResponseCode.Success) { var dealLog = DealLogService.GetById(Convert.ToInt32(rsp.SerialServerNo)); ShopName = dealLog.ShopName; PosName = dealLog.SourcePosName; AccountName = dealLog.AccountName; Amount = dealLog.Amount; SerialNo = dealLog.SerialNo; ServerSerialNo = dealLog.SerialServerNo; if (Code == ResponseCode.Success) { var account = AccountService.GetByName(AccountName); var shop = ShopService.GetByName(ShopName); var pos = PosService.GetById(dealLog.SourcePosId); var currentUser = SecurityHelper.GetCurrentUser().CurrentUser; switch (dealType) { case DealTypes.Deal: if (!string.IsNullOrWhiteSpace(HostSite.TicketTemplateOfDeal)) { this.Ticket = MessageFormator.FormatTickForDeal(HostSite.TicketTemplateOfDeal, HostSite, dealLog, account, shop, pos, currentUser); } break; case DealTypes.CancelDeal: if (!string.IsNullOrWhiteSpace(HostSite.TicketTemplateOfCancelDeal)) { this.Ticket = MessageFormator.FormatTickForDeal(HostSite.TicketTemplateOfCancelDeal, HostSite, dealLog, account, shop, pos, currentUser); } break; } } } }
public void Ready() { var user = SecurityHelper.GetCurrentUser().CurrentUser; // debug var posName = ""; AdminUser adminUser = user as AdminUser; if (adminUser != null) { _sourceShopName = Constants.SystemShopName; var pos = this.PosEndPointService.GetByCurrentUserId(adminUser.UserId); if (pos == null) { Error = "请先创建终端,再进行交易!"; return; } posName = pos.Name; } ShopUser shopUser = user as ShopUser; if (shopUser != null) { var pos = PosEndPointService.Query(new PosEndPointRequest() { ShopId = shopUser.ShopId, State = PosEndPointStates.Normal }).FirstOrDefault(); if (pos == null) { Error = "请先创建终端,再进行交易!"; return; } posName = pos.Name; var shop = ShopService.GetById(shopUser.ShopId); _sourceShopName = shop.Name; ShopName = shop.Name; } // debug end IPasswordService passwordService = UnityContainer.Resolve <IPasswordService>(HostSite.PasswordType); var password = passwordService.Decrypto(Password); var dealLog = DealLogService.GetById(Convert.ToInt32(ServerSerialNo)); ShopName = dealLog.ShopName; Amount = dealLog.Amount; AccountName = dealLog.AccountName; _oldSerialNo = dealLog.SerialNo; var account = AccountService.GetByName(AccountName); var token = account == null ? "" : account.AccountToken; Response = InnerCall(token, posName, password); this.Code = Response.Code; ServerSerialNo = Response.SerialServerNo; if (Response.Code == ResponseCode.InvalidatePassword) { IsRetry = true; Error = ModelHelper.GetBoundText(this, x => x.Code); } else if (Response.Code != ResponseCode.Success) { Error = ModelHelper.GetBoundText(this, x => x.Code); } }