コード例 #1
0
        public void Delete(int id)
        {
            var item = PointPolicyService.GetById(id);

            if (item != null)
            {
                PointPolicyService.Delete(item);
                AddMessage("delete.success", item.DisplayName, item.PointPolicyId);
                Logger.LogWithSerialNo(LogTypes.PointPolicyDelete, SerialNoHelper.Create(), id, item.DisplayName, item.PointPolicyId);
                CacheService.Refresh(CacheKeys.PointPolicyKey);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
 public void Read(int id)
 {
     this.SetInnerObject(PointPolicyService.GetById(id));
 }