예제 #1
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, XM_Pact_AssortEntity 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);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity(string keyValue, XM_Pay_DatailsEntity entity)
        {
            try
            {
                IRepository db = new RepositoryFactory().BaseRepository();
                if (!string.IsNullOrEmpty(keyValue))
                {
                    entity.Modify(keyValue);
                    db.Update(entity);
                }
                else
                {
                    entity.Create();
                    db.Insert(entity);
                }
                XM_Pact_AssortEntity PactEntity = pactAssortIBLL.GetEntity(entity.BindId);
                XM_Pact_AssortEntity AssEntity  = new XM_Pact_AssortEntity();

                //已付金额
                decimal?pAmount = PactEntity.PaidAmount + entity.PayAmount;
                //未付金额
                decimal?unpAmount = PactEntity.Amount - pAmount;
                AssEntity.PaidAmount   = pAmount;
                AssEntity.UnPaidAmount = unpAmount;
                AssEntity.Id           = entity.BindId;
                db.Update(AssEntity);

                try
                {
                    db.Commit();
                }
                catch (Exception)
                {
                    db.Rollback();
                    throw;
                }
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
예제 #3
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, XM_Pact_AssortEntity entity)
 {
     try
     {
         pactAssortService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }