Exemplo n.º 1
0
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity(UserInfo userInfo, string keyValue, AllotAssetsEntity entity, List <ApplyAssetsEntity> applyAssetsList)
        {
            var db = this.BaseRepository("WFDB").BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    var allotAssetsEntityTmp = GetAllotAssetsEntity(keyValue);
                    entity.Modify(keyValue, userInfo);
                    db.Update(entity);
                    db.Delete <ApplyAssetsEntity>(t => t.F_Id == allotAssetsEntityTmp.F_Id);
                    foreach (ApplyAssetsEntity item in applyAssetsList)
                    {
                        item.Create(userInfo);
                        item.F_Id = allotAssetsEntityTmp.F_Id;
                        db.Insert(item);
                    }
                }
                else
                {
                    entity.Create(userInfo);
                    db.Insert(entity);
                    foreach (ApplyAssetsEntity item in applyAssetsList)
                    {
                        item.Create(userInfo);
                        item.F_Id = entity.F_Id;
                        db.Insert(item);
                    }
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(UserInfo userInfo, string keyValue, AllotAssetsEntity entity, List <ApplyAssetsEntity> applyAssetsList)
 {
     try
     {
         soorderService.SaveEntity(userInfo, keyValue, entity, applyAssetsList);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }