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 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); }