Beispiel #1
0
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity(string keyValue, TNRD_Pact_DatailsEntity entity)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    var tNRD_Pact_DatailsEntityTmp = GetTNRD_Pact_DatailsEntity(keyValue);
                    entity.Modify(keyValue);
                    db.Update(entity);
                    db.Delete <TNRD_Facility_BaseEntity>(t => t.BindId == tNRD_Pact_DatailsEntityTmp.Id);
                    //foreach (TNRD_Facility_BaseEntity item in tNRD_Facility_BaseList)
                    //{
                    //    item.Create();
                    //    item.BindId = tNRD_Pact_DatailsEntityTmp.Id;
                    //    db.Insert(item);
                    //}
                }
                else
                {
                    entity.Create();
                    db.Insert(entity);
                    //foreach (TNRD_Facility_BaseEntity item in tNRD_Facility_BaseList)
                    //{
                    //    item.Create();
                    //    item.BindId = entity.Id;
                    //    db.Insert(item);
                    //}
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, TNRD_Pact_DatailsEntity entity)
 {
     try
     {
         wizsen_TNRD_PactService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }