示例#1
0
        private void FileSystemWatcher_Deleted(object sender, FileSystemEventArgs e)
        {
            Load();
            //kill
            var guid = Path.GetFileNameWithoutExtension(e.Name);

            if (Guid.TryParse(guid, out var result))
            {
                Dev2Logger.Info($"Trigger deleted '{guid}'", GlobalConstants.ServerWorkspaceID.ToString());
                OnDeleted?.Invoke(result);
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="info">要删除的数据id</param>
        /// <param name="logonInfo">登录的用户信息</param>
        /// <returns></returns>
        public ResultView Delete(T info, TokenLogonInfo logonInfo)
        {
            if (info == null)
            {
                throw ApiException.EmptyData("无法找到要删除的数据");
            }
            string id = info.Id.ToString();

            _logger.LogTrace($"逻辑删除 ==> 类型为:[{typeof(T).FullName}]\t删除ID为:[{id}]");
            try
            {
                // 判断对应数据是否可以删除.
                DeleteRemoveCheck(info);
                OnDeleteRemoveCheck?.Invoke(info, logonInfo);
                DeleteCheck(info);
                OnDeleteCheck?.Invoke(info, logonInfo);
                // 逻辑删除的前置操作
                DeleteRemoving(info, logonInfo);
                Deleting(info, logonInfo);
                // 逻辑删除前置事件处理
                OnDeleting?.Invoke(info, logonInfo);
                // 设置逻辑删除状态
                info.UpdateDate  = DateTime.Now;
                info.UpdaterId   = logonInfo.Id;
                info.UpdaterName = logonInfo.Name;
                info.IsDelete    = true;

                // 持久化数据
                _Dal.UpdateObject(info);
                // 逻辑删除的后置处理
                Deleted(info, logonInfo);
                DeleteRemoved(info, logonInfo);
                // 逻辑删除后置事件处理
                OnDeleted?.Invoke(info, logonInfo);
                // 返回保存结果
                return(ResultView.Success(id));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"逻辑删除异常 ==> 类型为:[{typeof(T).FullName}]\t删除ID为:[{id}]\r\n删除对象:[{info.ToJson()}]");
                throw;
            }
        }
示例#3
0
 internal void RaiseOnDeleted()
 {
     OnDeleted?.Invoke(this);
 }
示例#4
0
 public virtual void Delete()
 {
     OnDeleted?.Invoke();
 }
示例#5
0
 public virtual void Delete()
 {
     From.Disconnect(this, false);
     To.Disconnect(this, false);
     OnDeleted?.Invoke();
 }
示例#6
0
 public void CallOnDeleted(Guid guid)
 {
     OnDeleted?.Invoke(guid);
 }