using System;
using PushPlatform.Data;
using System.Collections.Generic;
using System.Data;
using MySql.Data.MySqlClient;
using PushPlatform.Common.Util;

namespace PushPlatform.Data.Bll
{
    public partial class BllMappushUserRole
    {

        #region Service Bll
        /// <summary>
        /// 事务处理保存和更新明细表
        /// </summary>
        /// <param name="dataList">主表</param>
        /// <param name="QaDetailList">明细表</param>
        /// <returns></returns>
        public int SaveOrUpdateTran(List<MappushUserRole> dataList)
        {
            int result = 0;
            using (IDbConnection connection = new MySqlConnection(PushPlatformContext.connString))
            {
                connection.Open();
                IDbTransaction transaction = connection.BeginTransaction();
                try
                {
                    result += CurrentDao.SaveOrUpdateWithTran(dataList, connection, transaction);
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    LogHelper.Error(ex);
                    transaction.Rollback();
                    throw new Exception(ex.Message);
                }
            }
            return result;
        }
        #endregion
    }
}