/// <summary>
 /// 绑定订单
 /// </summary>
 /// <param name="user_id"></param>
 /// <param name="OrderSn"></param>
 public void BindOrder(int user_id, string appid, string OrderSn)
 {
     try
     {
         dm_orderEntity dm_OrderEntity = BaseRepository("dm_data").FindEntity <dm_orderEntity>(t => t.sub_order_sn == OrderSn && t.appid == appid);
         if (dm_OrderEntity.IsEmpty())
         {
             throw new Exception("该订单未同步到,请稍后重试!");
         }
         else if (!dm_OrderEntity.userid.IsEmpty())
         {
             if (dm_OrderEntity.userid == user_id)
             {
                 throw new Exception("该订单已在您的账号下,无需重新绑定!");
             }
             else
             {
                 throw new Exception("该订单已被其他人绑定,请勿将订单号泄露给他人!");
             }
         }
         else
         {
             dm_OrderEntity.userid = user_id;
             BaseRepository("dm_data").Update(dm_OrderEntity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         throw ExceptionEx.ThrowServiceException(ex);
     }
 }
Exemple #2
0
 public void SaveEntity(string keyValue, dm_orderEntity entity)
 {
     try
     {
         dM_OrderService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         throw ExceptionEx.ThrowBusinessException(ex);
     }
 }
 public void SaveEntity(string keyValue, dm_orderEntity entity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             entity.Modify(keyValue);
             BaseRepository("dm_data").Update(entity);
         }
         else
         {
             entity.Create();
             BaseRepository("dm_data").Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         throw ExceptionEx.ThrowServiceException(ex);
     }
 }