/// <summary>
        /// 数据适配器工厂
        /// </summary>
        /// <param name="mode">数据源模式(1:SQLITE、2:SQL SERVER)</param>
        /// <param name="storeId">门店Id</param>
        /// <param name="machineSn">设备编号</param>
        /// <returns>数据适配器对象</returns>
        public static IDataAdapter Factory(DataAdapterMode mode, string storeId, string machineSn, int companyId, string deviceSn)
        {
            IDataAdapter dataAdapter = new MemoryCacheDataAdapter()
            {
                MachineSN = machineSn, StoreId = storeId, CompanyId = companyId, DeviceSn = deviceSn
            };

            dataAdapter.IsSalesclerkTest = false;
            var machineInfo = Salesclerk.GetMachineInfo(storeId, machineSn, companyId, deviceSn);

            if (machineInfo != null && machineInfo.InTestMode)
            {
                dataAdapter.IsSalesclerkTest = true;
            }
            return(dataAdapter);
        }
        internal static IDataAdapter DbFactory(DataAdapterMode mode, string storeId, string machineSn, int companyId, string deviceSn)
        {
            IDataAdapter dataAdapter = null;

            switch (mode)
            {
                //case DataAdapterMode.SQLITE:
                //    //dataAdapter = new SqliteDataAdapter() { MachineSN = machineSn, StoreId = storeId };
                //    break;
#if (Local != true)
            case DataAdapterMode.SQLSERVER:
                dataAdapter = new SqlServerDataAdapter()
                {
                    MachineSN = machineSn, StoreId = storeId, CompanyId = companyId, DeviceSn = deviceSn
                };
                break;
#endif
#if (Local == true)
            case DataAdapterMode.SQLSERVERCE:
                dataAdapter = new SqlServerCEDataAdapter()
                {
                    MachineSN = machineSn, StoreId = storeId, CompanyId = companyId, DeviceSn = deviceSn
                };
                break;
#endif
            default:
                throw new PosException("未知数据源!");
            }
            if (dataAdapter == null)
            {
                throw new PosException("数据源不可用!");
            }
            dataAdapter.IsSalesclerkTest = false;
            var machineInfo = Salesclerk.GetMachineInfo(storeId, machineSn, companyId, deviceSn);
            if (machineInfo != null && machineInfo.InTestMode)
            {
                dataAdapter.IsSalesclerkTest = true;
            }
            return(dataAdapter);
        }