public bool UpdateVehicleInfoByPid(string pid, DataTable table, string level, string vehicleLevel)
        {
            var isSuccess = true;

            try
            {
                dbManagerReadOnly.Execute(conn =>
                {
                    var resultList = DalProductVehicleInfo.GetAllProductVehicleTypeConfigInfoByPid(conn, pid, level, vehicleLevel);
                    if (level.Contains("二级"))
                    {
                        for (int i = table.Rows.Count - 1; i >= 0; i--)
                        {
                            var vehicleId = table.Rows[i][1].ToString();
                            //var nian = table.Rows[i][4].ToString();
                            //var paiLiang = table.Rows[i][5].ToString();
                            if (resultList.Exists(item => item.VehicleID == vehicleId))
                            {
                                table.Rows.Remove(table.Rows[i]);//找到重复的就删掉不更新
                                continue;
                            }
                        }
                    }
                    else if (level.Contains("四级"))
                    {
                        for (int i = table.Rows.Count - 1; i >= 0; i--)
                        {
                            var vehicleId = table.Rows[i][1].ToString();
                            var nian      = table.Rows[i][4].ToString();
                            var paiLiang  = table.Rows[i][5].ToString();
                            if (resultList.Exists(item => item.VehicleID == vehicleId && item.Nian == nian && item.PaiLiang == paiLiang))
                            {
                                table.Rows.Remove(table.Rows[i]);
                                continue;
                            }
                        }
                    }
                    else if (level.Contains("五级"))
                    {
                        for (int i = table.Rows.Count - 1; i >= 0; i--)
                        {
                            //var tid = table.Rows[i][6].ToString();
                            var vehicleId = table.Rows[i][1].ToString();
                            var paiLiang  = table.Rows[i][5].ToString();
                            var nian      = table.Rows[i][4].ToString();
                            var salesName = table.Rows[i][7].ToString();
                            if (resultList.Exists(item => item.VehicleID == vehicleId && item.PaiLiang == paiLiang && item.Nian == nian && item.SalesName == salesName))
                            {
                                //如果已存在相同数据则去重
                                table.Rows.Remove(table.Rows[i]);
                                continue;
                            }
                        }
                    }
                    else
                    {
                    }
                    //isSuccess = DalProductVehicleInfo.BulkSaveVehicleInfoByPid(conn, table, level, cpremark);
                });

                Func <SqlConnection, bool> action = (connection) => DalProductVehicleInfo.BulkSaveVehicleInfoByPid(connection, table, level, vehicleLevel);
                dbManager.Execute(action);
            }
            catch (Exception e)
            {
                isSuccess = false;
                Monitor.ExceptionMonitor.AddNewMonitor("编辑页保存车型配置数据异常", e, "保存异常", MonitorLevel.Critial, MonitorModule.Other);
            }

            //try
            //{
            //    //var count = table.Rows.Count;
            //    //先去重,去数据库捞一把防止重复数据插入
            //    if (level.Contains("二级"))
            //    {
            //        Func<SqlConnection, List<ProductVehicleTypeConfigDb>> actionOne = (connection) => DalProductVehicleInfo.GetAllProductVehicleTypeConfigInfoByPid(connection, pid, level, cpremark);
            //        var resultList = dbManager.Execute(actionOne);
            //        try
            //        {
            //            for (int i = table.Rows.Count - 1; i >= 0; i--)
            //            {
            //                var vehicleId = table.Rows[i][1].ToString();
            //                //var nian = table.Rows[i][4].ToString();
            //                //var paiLiang = table.Rows[i][5].ToString();
            //                if (resultList.Exists(item => item.VehicleID == vehicleId))
            //                {
            //                    table.Rows.Remove(table.Rows[i]);//找到重复的就删掉不更新
            //                    //table.Rows[i].Delete();
            //                    continue;
            //                }
            //            }
            //            //table.AcceptChanges();
            //        }
            //        catch (Exception ex)
            //        {
            //            isSuccess = false;
            //        }

            //    }
            //    else if (level.Contains("四级"))
            //    {
            //        Func<SqlConnection, List<ProductVehicleTypeConfigDb>> actionTwo = (connection) => DalProductVehicleInfo.GetAllProductVehicleTypeConfigInfoByPid(connection, pid, level, cpremark);
            //        var resultList = dbManager.Execute(actionTwo);
            //        try
            //        {
            //            for (int i = table.Rows.Count - 1; i >= 0; i--)
            //            {
            //                var vehicleId = table.Rows[i][1].ToString();
            //                var nian = table.Rows[i][4].ToString();
            //                var paiLiang = table.Rows[i][5].ToString();
            //                if (resultList.Exists(item => item.VehicleID == vehicleId && item.Nian == nian && item.PaiLiang == paiLiang))
            //                {
            //                    table.Rows.Remove(table.Rows[i]);
            //                    continue;
            //                }

            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            isSuccess = false;
            //        }
            //    }
            //    else if (level.Contains("五级"))
            //    {
            //        Func<SqlConnection, List<ProductVehicleTypeConfigDb>> actionThree = (connection) => DalProductVehicleInfo.GetAllProductVehicleTypeConfigInfoByPid(connection, pid, level, cpremark);
            //        var resultList = dbManager.Execute(actionThree);
            //        try
            //        {
            //            for (int i = table.Rows.Count - 1; i >= 0; i--)
            //            {
            //                var tid = table.Rows[i][6].ToString();

            //                if (resultList.Exists(item => item.TID == tid))
            //                {
            //                    //如果已存在相同数据则去重
            //                    table.Rows.Remove(table.Rows[i]);
            //                    continue;
            //                }
            //            }
            //        }
            //        catch (Exception ex)
            //        {
            //            isSuccess = false;
            //        }
            //    }

            //    Func<SqlConnection, bool> action = (connection) => DalProductVehicleInfo.BulkSaveVehicleInfoByPid(connection, table, level, cpremark);
            //    dbManager.Execute(action);
            //}
            //catch (Exception e)
            //{
            //    isSuccess = false;
            //}

            return(isSuccess);
        }
        /// <summary>
        /// 添加或更新车型配置信息
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="table"></param>
        /// <param name="fileName"></param>
        /// <param name="cpremark"></param>
        /// <returns></returns>
        public bool InsertOrUpdateVehicleInfoByPID(string pid, DataTable table, string fileName, string cpremark)
        {
            var result              = true;
            var vehicleIdList       = new List <string>();
            var insertTidList       = new List <string>();
            var updateTidList       = new List <string>();
            var deleteVehicleIdList = new List <string>();
            var deleteTidList       = new List <string>();
            var batchCount          = 1000;

            try
            {
                dbManager.CreateTransaction(conn =>
                {
                    var pidInfo = DalProductVehicleInfo.GetAllProductVehicleTypeConfigInfoByPid(conn, pid, fileName, cpremark);
                    VerifyAndConvertData(pidInfo, table, fileName, cpremark, out vehicleIdList, out insertTidList, out updateTidList, out deleteVehicleIdList, out deleteTidList);
                    if (deleteVehicleIdList.Any())//删除的二级车型信息
                    {
                        while (deleteVehicleIdList.Any())
                        {
                            if (deleteVehicleIdList.Count() < batchCount)
                            {
                                batchCount = deleteVehicleIdList.Count();
                            }
                            DalProductVehicleInfo.BatchDeleteSecondVehicleTypeConfig(conn, deleteVehicleIdList.GetRange(0, batchCount), pid);
                            deleteVehicleIdList.RemoveRange(0, batchCount);
                        }
                    }
                    if (deleteTidList.Any())//删除的五级车型信息
                    {
                        while (deleteTidList.Any())
                        {
                            if (deleteTidList.Count() < batchCount)
                            {
                                batchCount = deleteTidList.Count();
                            }
                            DalProductVehicleInfo.BatchDeleteFiveVehicleTypeConfig(conn, deleteTidList.GetRange(0, batchCount), pid);
                            deleteTidList.RemoveRange(0, batchCount);
                        }
                    }
                    if (vehicleIdList.Any())//增加的二级车型信息
                    {
                        while (vehicleIdList.Any())
                        {
                            if (vehicleIdList.Count() < batchCount)
                            {
                                batchCount = vehicleIdList.Count();
                            }
                            DalProductVehicleInfo.BatchInsertSecondVehicleTypeConfig(conn, vehicleIdList.GetRange(0, batchCount), pid);
                            vehicleIdList.RemoveRange(0, batchCount);
                        }
                    }
                    if (insertTidList.Any())//增加的五级车型信息
                    {
                        while (insertTidList.Any())
                        {
                            if (insertTidList.Count() < batchCount)
                            {
                                batchCount = insertTidList.Count();
                            }
                            DalProductVehicleInfo.BatchInsertFiveVehicleTypeConfig(conn, insertTidList.GetRange(0, batchCount), pid);
                            insertTidList.RemoveRange(0, batchCount);
                        }
                    }
                    if (updateTidList.Any())//需要更新的五级车型信息
                    {
                        while (updateTidList.Any())
                        {
                            if (updateTidList.Count() < batchCount)
                            {
                                batchCount = updateTidList.Count();
                            }
                            DalProductVehicleInfo.BatchUpdateFiveVehicleTypeConfig(conn, updateTidList.GetRange(0, batchCount), pid);
                            updateTidList.RemoveRange(0, batchCount);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                result = false;
                logger.Error(ex);
            }

            return(result);
        }