public void Delete(int id) { var item = AccountLevelPolicyService.GetById(id); if (item != null) { AccountLevelPolicyService.Delete(item); Logger.LogWithSerialNo(LogTypes.AccountLevelDelete, SerialNoHelper.Create(), item.Level, item.DisplayName); AddMessage("delete.success", item.Level, item.DisplayName); CacheService.Refresh(CacheKeys.PointPolicyKey); } }
public void Suspend(int id) { var item = AccountLevelPolicyService.GetById(id); if (item != null && item.State == AccountLevelPolicyStates.Normal) { item.State = AccountLevelPolicyStates.Invalid; AccountLevelPolicyService.Update(item); Logger.LogWithSerialNo(LogTypes.AccountLevelSuspend, SerialNoHelper.Create(), item.Level, item.DisplayName); AddMessage("suspend.success", item.Level, item.DisplayName); } }
public void Save() { var serialNo = SerialNoHelper.Create(); var item = AccountLevelPolicyService.GetById(AccountLevelPolicyId); if (item != null) { item.DisplayName = DisplayName; item.TotalPointStart = TotalPointStart; OnSave(item); AccountLevelPolicyService.Update(item); AddMessage("success", item.Level, DisplayName); Logger.LogWithSerialNo(LogTypes.AccountLevelEdit, serialNo, item.Level, DisplayName); CacheService.Refresh(CacheKeys.PointPolicyKey); } }
public void Resume(int id) { var item = AccountLevelPolicyService.GetById(id); if (item != null && item.State == AccountLevelPolicyStates.Invalid) { if (AccountLevelPolicyService.Query().Any(x => x.State == AccountLevelPolicyStates.Normal && x.Level == item.Level && x.AccountTypeId == item.AccountTypeId)) { AddError("resume.fail", item.Level, item.DisplayName); } else { item.State = AccountLevelPolicyStates.Normal; AccountLevelPolicyService.Update(item); Logger.LogWithSerialNo(LogTypes.AccountLevelResume, SerialNoHelper.Create(), item.Level, item.DisplayName); AddMessage("resume.success", item.Level, item.DisplayName); } } }
public void Read(int id) { this.SetInnerObject(AccountLevelPolicyService.GetById(id)); }