public ResultMsg Delete(int id) { ResultMsg msg = new ResultMsg(); try { var posEndPoint = PosEndPointService.GetById(id); if (posEndPoint != null) { var shop = ShopService.GetById(posEndPoint.ShopId); Logger.LogWithSerialNo(LogTypes.PosDelete, SerialNoHelper.Create(), id, posEndPoint.Name, shop.Name); //AddMessage("delete.success", posEndPoint.Name, shop.Name); msg.Code = 1; msg.CodeText = "删除终端 " + posEndPoint.DisplayName + " 成功"; PosEndPointService.Delete(posEndPoint); CacheService.Refresh(CacheKeys.PosKey); } else { msg.CodeText = "不好意思,没有找到终端"; } return(msg); } catch (Exception ex) { msg.CodeText = "不好意思,系统异常"; Logger.Error("删除终端", ex); return(msg); } }
public ResultMsg Suspend(int id) { ResultMsg msg = new ResultMsg(); try { var posEndPoint = PosEndPointService.GetById(id); if (posEndPoint != null && posEndPoint.State == PosEndPointStates.Normal) { posEndPoint.State = PosEndPointStates.Invalid; PosEndPointService.Update(posEndPoint); var shop = ShopService.GetById(posEndPoint.ShopId); Logger.LogWithSerialNo(LogTypes.PosSuspend, SerialNoHelper.Create(), id, posEndPoint.Name, shop.Name); // AddMessage("suspend.success", posEndPoint.Name, shop.Name); msg.Code = 1; msg.CodeText = "停用终端 " + posEndPoint.DisplayName + " 成功"; CacheService.Refresh(CacheKeys.PosKey); } else { msg.CodeText = "不好意思,没有找到终端"; } return(msg); } catch (Exception ex) { msg.CodeText = "不好意思,系统异常"; Logger.Error("停用终端", ex); return(msg); } }
public void Read(int id) { PosEndPoint item = PosEndPointService.GetById(id); if (item != null) { Shop shop = ShopService.GetById(item.ShopId); InnerShop = shop; base.InnerObject = item; } }
public IMessageProvider Save() { var serialNo = SerialNoHelper.Create(); PosEndPoint item = PosEndPointService.GetById(PosEndPointId); if (item != null) { var shop = ShopService.GetById(item.ShopId); item.DisplayName = DisplayName; if (!string.IsNullOrEmpty(DataKey)) { item.DataKey = DataKey; } PosEndPointService.Update(item); AddMessage("success", item.Name); Logger.LogWithSerialNo(LogTypes.PosEdit, serialNo, item.PosEndPointId, item.Name, shop.DisplayName); CacheService.Refresh(CacheKeys.PosKey); } return(this); }
public DataAjaxResult Print() { try { IPasswordService passwordService = UnityContainer.Resolve <IPasswordService>(HostSite.PasswordType); var password = passwordService.Decrypto(this.Password); if (string.IsNullOrWhiteSpace(this.HostSite.TicketTemplateOfDeal)) { return(new DataAjaxResult(Localize("nonTemplateOfDeal", "请先设置消费打印模板"))); } var shopDealLog = this.ShopDealLogService.GetById(Id); if (shopDealLog == null) { return(new DataAjaxResult(Localize("nonShopDealLog", "指定商户交易未找到"))); } var deallog = this.DealLogService.GetById(shopDealLog.Addin); if (deallog == null) { return(new DataAjaxResult(Localize("nonShopDealLog", "指定会员交易未找到"))); } var account = this.AccountService.GetById(deallog.AccountId); if (account == null) { return(new DataAjaxResult(Localize("nonAccount", "指定会员未找到"))); } if (User.SaltAndHash(password, account.PasswordSalt) != account.Password) { return(new DataAjaxResult(Localize("invalidPassword", "密码错误"))); } var shop = this.ShopService.GetById(deallog.ShopId); if (shop == null) { return(new DataAjaxResult(Localize("nonShop", "指定商户未找到"))); } var dealWay = this.DealWayService.GetById(shop.DealWayId); if (dealWay == null) { return(new DataAjaxResult(Localize("nonDealWay", "指定支付渠道未找到"))); } var msg = this.HostSite.TicketTemplateOfDeal.Trim(); msg = MessageFormator.FormatTickForDeal(msg, HostSite, deallog, account, ShopService.GetById(deallog.ShopId), PosEndPointService.GetById(deallog.SourcePosId), SecurityHelper.GetCurrentUser()); return(new DataAjaxResult() { Data1 = msg }); } catch (System.Exception ex) { return(new DataAjaxResult(ex.Message)); } }