Example #1
0
 public void SubmitForm(AreaEntity areaEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         areaEntity.Modify(keyValue);
         service.Update(areaEntity);
     }
     else
     {
         areaEntity.Create();
         service.Insert(areaEntity);
     }
 }
Example #2
0
        public async Task SaveForm(AreaEntity entity)
        {
            if (entity.Id.IsNullOrZero())
            {
                await entity.Create();

                await this.BaseRepository().Insert <AreaEntity>(entity);
            }
            else
            {
                await entity.Modify();

                await this.BaseRepository().Update <AreaEntity>(entity);
            }
        }
Example #3
0
        /// <summary>
        /// 保存区域表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="areaEntity">区域实体</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, AreaEntity areaEntity)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                areaEntity.Modify(keyValue);
                this.BaseRepository().Update(areaEntity);
            }
            else
            {
                areaEntity.Create();
                this.BaseRepository().Insert(areaEntity);
            }

            CacheFactory.GetCacheInstance().RemoveCache("__AreaCache");
        }
Example #4
0
 public void SubmitForm(AreaEntity areaEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         areaEntity.Modify(keyValue);
         service.Update(areaEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "修改区域信息=>" + areaEntity.FullName, Enums.DbLogType.Update, "区域管理");
     }
     else
     {
         areaEntity.Create();
         service.Insert(areaEntity);
         //添加日志
         LogHelp.logHelp.WriteDbLog(true, "添加区域信息=>" + areaEntity.FullName, Enums.DbLogType.Create, "区域管理");
     }
 }
Example #5
0
 /// <summary>
 /// 保存区域表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="{">区域实体</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, AreaEntity areaEntity)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         areaEntity.Modify(keyValue);
         Base_Area area = Base_Area.SingleOrDefault("where AreaId=@0", keyValue);
         area        = EntityConvertTools.CopyToModel <AreaEntity, Base_Area>(areaEntity, area);
         area.AreaId = keyValue;
         area.Update();
     }
     else
     {
         areaEntity.Create();
         Base_Area area = EntityConvertTools.CopyToModel <AreaEntity, Base_Area>(areaEntity, null);
         area.Insert();
     }
 }
Example #6
0
        public Task <int> SubmitForm <TDto>(AreaEntity entity, TDto dto) where TDto : class
        {
            var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity;

            claimsIdentity.CheckArgumentIsNull(nameof(claimsIdentity));
            var claim = claimsIdentity?.FindFirst(t => t.Type.Equals(ClaimTypes.NameIdentifier));

            if (!string.IsNullOrEmpty(entity.F_Id))
            {
                entity.Modify(entity.F_Id);
                entity.F_LastModifyUserId = claim?.Value;
                return(_service.UpdateAsync(entity, dto));
            }
            else
            {
                entity.Create();
                entity.F_CreatorUserId = claim?.Value;
                return(_service.InsertAsync(entity));
            }
        }
Example #7
0
        public Task <int> SubmitForm(AreaEntity areaEntity, string keyValue)
        {
            var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity;

            claimsIdentity.CheckArgumentIsNull(nameof(claimsIdentity));
            var claim = claimsIdentity?.FindFirst(t => t.Type.Equals(ClaimTypes.NameIdentifier));

            if (!string.IsNullOrEmpty(keyValue))
            {
                areaEntity.Modify(keyValue);
                areaEntity.F_LastModifyUserId = claim?.Value;
                return(_service.UpdateAsync(areaEntity));
            }
            else
            {
                areaEntity.Create();
                areaEntity.F_CreatorUserId = claim?.Value;
                return(_service.InsertAsync(areaEntity));
            }
        }
Example #8
0
 /// <summary>
 /// 操作区域信息
 /// </summary>
 /// <param name="areaEntity"></param>
 /// <param name="keyValue"></param>
 public void SubmitForm(AreaEntity areaEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))//编辑区域信息
     {
         areaEntity.Modify(keyValue);
         ResultClass <int> _ret = service.Update(areaEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
     else//新增区域信息
     {
         areaEntity.Create();
         ResultClass <int> _ret = service.Insert(areaEntity);
         if (!_ret.Result)
         {
             throw new Exception(_ret.ErrorMessage);
         }
     }
 }