/// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, TNRD_Pay_DatailsEntity entity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             entity.Modify(keyValue);
             this.BaseRepository().Update(entity);
         }
         else
         {
             entity.Create();
             //if (entity.bookedAmount == 0)
             //{
             //    var strSql = new StringBuilder();
             //    strSql.Append(" select * from TNRD_Pay_Datails ");
             //    strSql.Append(" where bindid = '" + entity.BindId + "' ");
             //    strSql.Append(" and hangAmount >0   order by CreateDate");
             //    var data = this.BaseRepository().FindTable(strSql.ToString());
             //    TNRD_Pay_DatailsEntity payentity = new TNRD_Pay_DatailsEntity();
             //    var hang = entity.PayAmount;
             //    Decimal hangAmount = 0;
             //    string id = "";
             //    for (int i = 0; i < data.Rows.Count; i++)
             //    {
             //        hangAmount = data.Rows[i]["hangAmount"].ToDecimal();
             //        id = data.Rows[i]["Id"].ToString();
             //        if (hang <= hangAmount)
             //        {
             //            payentity.hangAmount = hangAmount - hang;
             //            payentity.Modify(id);
             //            this.BaseRepository().Update(payentity);
             //            break;
             //        }
             //        else
             //        {
             //            payentity.hangAmount = 0;
             //            payentity.Modify(id);
             //            this.BaseRepository().Update(payentity);
             //            hang = hang - hangAmount;
             //        }
             //    }
             //}
             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 SaveEntity(string keyValue, TNRD_Pay_DatailsEntity entity)
 {
     try
     {
         payDatailsService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }