コード例 #1
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改菜单按钮信息【" + moduleButtonEntity.F_FullName + "】成功!");
         }
         catch { }
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建菜单按钮信息【" + moduleButtonEntity.F_FullName + "】成功!");
         }
         catch { }
     }
 }
コード例 #2
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
     }
 }
コード例 #3
0
 public async Task <int> SubmitFormAsync(ModuleButtonEntity entity, string keyValue)
 {
     if (string.IsNullOrEmpty(keyValue))
     {
         entity.Create();
         return(await buttonRepository.InsertAsync(entity));
     }
     else
     {
         entity.Modify(keyValue);
         return(await buttonRepository.UpdateAsync(entity));
     }
 }
コード例 #4
0
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "修改按钮信息=>" + moduleButtonEntity.FullName, Enums.DbLogType.Update, "按钮管理");
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "添加按钮信息=>" + moduleButtonEntity.FullName, Enums.DbLogType.Create, "按钮管理");
     }
 }
コード例 #5
0
 /// <summary>
 /// 修改菜单按钮信息
 /// </summary>
 /// <param name="moduleButtonEntity"></param>
 /// <param name="keyValue"></param>
 public void SubmitForm(ModuleButtonEntity moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         ResultClass <int> _ret = service.Update(moduleButtonEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
     else
     {
         moduleButtonEntity.Create();
         ResultClass <int> _ret = service.Insert(moduleButtonEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
 }
コード例 #6
0
        public Task <int> SubmitForm <TDto>(ModuleButtonEntity moduleButtonEntity, 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(moduleButtonEntity.F_Id))
            {
                moduleButtonEntity.Modify(moduleButtonEntity.F_Id);
                if (claim != null)
                {
                    moduleButtonEntity.F_LastModifyUserId = claim.Value;
                }
                return(_service.UpdateAsync(moduleButtonEntity, dto));
            }
            else
            {
                moduleButtonEntity.Create();
                if (claim != null)
                {
                    moduleButtonEntity.F_CreatorUserId = claim.Value;
                }
                return(_service.InsertAsync(moduleButtonEntity));
            }
        }