示例#1
0
 public void SubmitForm(ItemsEntity itemsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         itemsEntity.Modify(keyValue);
         service.Update(itemsEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改数据字典分类信息【" + itemsEntity.F_FullName + "】成功!");
         }
         catch { }
     }
     else
     {
         itemsEntity.Create();
         service.Insert(itemsEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建数据字典分类信息【" + itemsEntity.F_FullName + "】成功!");
         }
         catch { }
     }
 }
示例#2
0
 public void SubmitForm(ItemsEntity itemsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         itemsEntity.Modify(keyValue);
         service.Update(itemsEntity);
     }
     else
     {
         itemsEntity.Create();
         service.Insert(itemsEntity);
     }
 }
示例#3
0
        public async Task <bool> SubmitFormAsync(ItemsEntity entity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))//修改
            {
                _repository.ShadowCopy(_repository.FindById(keyValue), entity);
                await entity.Modify(keyValue);

                return(await _repository.UpdateAsync(entity));
            }
            //新增
            await entity.Create();

            entity.DeleteMark = false;
            return(await _repository.InsertAsync(entity) >= 1);
        }
示例#4
0
文件: ItemsApp.cs 项目: gongthub/CMS
 public void SubmitForm(ItemsEntity itemsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         itemsEntity.Modify(keyValue);
         service.Update(itemsEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "修改字典信息=>" + itemsEntity.FullName, Enums.DbLogType.Update, "字典管理");
     }
     else
     {
         itemsEntity.Create();
         service.Insert(itemsEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "添加字典信息=>" + itemsEntity.FullName, Enums.DbLogType.Create, "字典管理");
     }
 }
示例#5
0
 public async Task<bool> SubmitFormAsync(ItemsEntity entity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))//修改
     {
         _repository.ShadowCopy(_repository.FindById(keyValue), entity);
         await entity.Modify(keyValue);
         return await _repository.UpdateAsync(entity);
     }
     //新增
     try
     {
         await entity.Create();
         entity.DeleteMark = false;
         return await _repository.InsertAsync(entity) >= 1;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
示例#6
0
 /// <summary>
 /// 操作数据字典类型信息
 /// </summary>
 /// <param name="itemsEntity"></param>
 /// <param name="keyValue"></param>
 public void SubmitForm(ItemsEntity itemsEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))//数据字典类型信息
     {
         itemsEntity.Modify(keyValue);
         ResultClass <int> _ret = service.Update(itemsEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
     else//新数据字典类型信息
     {
         itemsEntity.Create();
         ResultClass <int> _ret = service.Insert(itemsEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
 }
示例#7
0
        public Task <int> SubmitForm <TDto>(ItemsEntity itemsEntity, TDto dto) where TDto : class
        {
            var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity;
            var claim          = claimsIdentity?.FindFirst(t => t.Type.Equals(ClaimTypes.NameIdentifier));

            if (!string.IsNullOrEmpty(itemsEntity.F_Id))
            {
                itemsEntity.Modify(itemsEntity.F_Id);
                if (claim != null)
                {
                    itemsEntity.F_LastModifyUserId = claim.Value;
                }
                return(_service.UpdateAsync(itemsEntity, dto));
            }
            else
            {
                itemsEntity.Create();
                if (claim != null)
                {
                    itemsEntity.F_CreatorUserId = claim.Value;
                }
                return(_service.InsertAsync(itemsEntity));
            }
        }