Beispiel #1
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, XM_Project_DatailsEntity entity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             entity.Modify(keyValue);
             this.BaseRepository().Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository().Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity2(string keyValue, XM_Project_DatailsEntity entity, List <XM_Project_Details_EstimateEntity> xM_Project_Details_EstimateList)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                if (!string.IsNullOrEmpty(keyValue))
                {
                    var xM_Project_DatailsEntityTmp = GetXM_Project_DatailsEntity(keyValue);
                    entity.Modify(keyValue);
                    db.Update(entity);
                    db.Delete <XM_Project_Details_EstimateEntity>(t => t.BindId == xM_Project_DatailsEntityTmp.Id);
                    foreach (XM_Project_Details_EstimateEntity item in xM_Project_Details_EstimateList)
                    {
                        item.Create();
                        item.BindId = xM_Project_DatailsEntityTmp.Id;
                        db.Insert(item);
                    }
                }
                else
                {
                    entity.Create();
                    db.Insert(entity);
                    foreach (XM_Project_Details_EstimateEntity item in xM_Project_Details_EstimateList)
                    {
                        item.Create();
                        item.BindId = entity.Id;
                        item.Code   = entity.Code;
                        item.Name   = entity.Name;
                        db.Insert(item);
                    }
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity2(string keyValue, XM_Project_DatailsEntity entity, List <XM_Project_Details_EstimateEntity> xM_Project_Details_EstimateList)
 {
     try
     {
         projectDatailsService.SaveEntity2(keyValue, entity, xM_Project_Details_EstimateList);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, XM_Project_DatailsEntity entity)
 {
     try
     {
         projectDatailsService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, XM_Project_State_LogEntity entity)
 {
     try
     {
         XM_Project_DatailsEntity dentity = new XM_Project_DatailsEntity();
         dentity.ProjectState = entity.State;
         projectDatailsIBLL.SaveEntity(entity.BindId, dentity);
         projectStateService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }