예제 #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));
            }
        }