public void Suspend(int id) { var item = PointPolicyService.GetById(id); if (item != null && item.State == PointPolicyStates.Normal) { item.State = PointPolicyStates.Invalid; PointPolicyService.Update(item); AddMessage("suspend.success", item.DisplayName, item.PointPolicyId); Logger.LogWithSerialNo(LogTypes.PointPolicySuspend, SerialNoHelper.Create(), id, item.DisplayName, item.PointPolicyId); CacheService.Refresh(CacheKeys.PointPolicyKey); } }
public void Save() { var serialNo = SerialNoHelper.Create(); var item = PointPolicyService.GetById(PointPolicyId); if (item != null) { item.Point = Point; item.DisplayName = DisplayName; base.OnSave(item); PointPolicyService.Update(item); AddMessage("success", item.DisplayName); Logger.LogWithSerialNo(LogTypes.PointPolicyEdit, serialNo, item.PointPolicyId, item.DisplayName); CacheService.Refresh(CacheKeys.PointPolicyKey); } }
public void Resume(int id) { var item = PointPolicyService.GetById(id); if (item != null && item.State == PointPolicyStates.Invalid) { if (PointPolicyService.Query().Any(x => x.IncludeLevel(item.PointPolicyId) && item.State == PointPolicyStates.Normal)) { AddError(Localize("resume.fail"), item.DisplayName, item.PointPolicyId); } else { item.State = PointPolicyStates.Normal; PointPolicyService.Update(item); AddMessage("resume.success", item.DisplayName, item.PointPolicyId); Logger.LogWithSerialNo(LogTypes.PointPolicyResume, SerialNoHelper.Create(), id, item.DisplayName, item.PointPolicyId); CacheService.Refresh(CacheKeys.PointPolicyKey); } } }