Esempio n. 1
0
        /// <summary>
        /// 验证门店设备信息
        /// </summary>
        /// <param name="deviceStoreType"></param>
        /// <param name="storeId"></param>
        /// <param name="deviceId"></param>
        /// <param name="segment"></param>
        /// <param name="mcuId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static bool checkStoreDeviceInfo(XCGameManaDeviceStoreType deviceStoreType, string storeId, string deviceId, out string segment, out string mcuId, out string xcGameDBName, out int deviceIdentityId, out string storePassword, out string storeName, out string errMsg)
        {
            errMsg           = string.Empty;
            segment          = string.Empty;
            storeName        = string.Empty;
            mcuId            = string.Empty;
            xcGameDBName     = string.Empty;
            deviceIdentityId = 0;
            storePassword    = string.Empty;
            if (deviceStoreType == XCGameManaDeviceStoreType.Store)
            {
                StoreBusiness   store      = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    errMsg = "门店不存在";
                    return(false);
                }
                storePassword = storeModel.StorePassword;
                xcGameDBName  = storeModel.StoreDBName;
                storeName     = storeModel.StoreName;

                XCCloudService.BLL.IBLL.XCGame.IDeviceService xcGameDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(xcGameDBName);
                var xcGameDeviceModel = xcGameDeviceService.GetModels(p => p.MCUID.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>();
                if (xcGameDeviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (xcGameDeviceModel.state != "启用")
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        segment          = xcGameDeviceModel.segment;
                        mcuId            = xcGameDeviceModel.MCUID;
                        deviceIdentityId = (int)(xcGameDeviceModel.id);
                        return(true);
                    }
                }
            }
            else if (deviceStoreType == XCGameManaDeviceStoreType.Merch)
            {
                XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService>();
                var deviceModel = deviceService.GetModels(p => p.SN.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.Base_DeviceInfo>();
                if (deviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (deviceModel.Status != 1)
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        mcuId            = deviceModel.SN;
                        deviceIdentityId = deviceModel.ID;
                        return(true);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 验证门店设备信息
        /// </summary>
        /// <param name="deviceStoreType"></param>
        /// <param name="storeId"></param>
        /// <param name="deviceId"></param>
        /// <param name="segment"></param>
        /// <param name="mcuId"></param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public static bool checkStoreGameDeviceInfo(XCGameManaDeviceStoreType deviceStoreType, string storeId, string deviceId, out string segment, out string mcuId, out string headId, out string gameId, out string xcGameDBName, out string storePassword, out string storeName, out string errMsg)
        {
            errMsg        = string.Empty;
            segment       = string.Empty;
            storeName     = string.Empty;
            mcuId         = string.Empty;
            headId        = string.Empty;
            gameId        = string.Empty;
            xcGameDBName  = string.Empty;
            storePassword = string.Empty;

            if (deviceStoreType == XCGameManaDeviceStoreType.Store)
            {
                StoreBusiness   store      = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!store.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    errMsg = "门店不存在";
                    return(false);
                }
                storePassword = storeModel.StorePassword;
                xcGameDBName  = storeModel.StoreDBName;
                storeName     = storeModel.StoreName;

                //验证头信息
                XCCloudService.BLL.IBLL.XCGame.IHeadService headService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IHeadService>(xcGameDBName);
                var headModel = headService.GetModels(p => p.MCUID.Equals(deviceId) && p.State.Equals("1")).FirstOrDefault <XCCloudService.Model.XCGame.t_head>();
                if (headModel == null)
                {
                    errMsg = "设备门店头部信息不存在";
                    return(false);
                }
                //验证游戏机信息
                XCCloudService.BLL.IBLL.XCGame.IGameService gameService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameService>(xcGameDBName);
                var gameModel = gameService.GetModels(p => p.GameID.Equals(headModel.GameID) && p.State.Equals("1")).FirstOrDefault <XCCloudService.Model.XCGame.t_game>();
                if (gameModel == null)
                {
                    errMsg = "设备门店头部信息不存在";
                    return(false);
                }

                segment = headModel.Segment;
                mcuId   = headModel.MCUID;
                headId  = headModel.HeadID;
                gameId  = headModel.GameID;
                return(true);
            }
            else if (deviceStoreType == XCGameManaDeviceStoreType.Merch)
            {
                XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService deviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IBase_DeviceInfoService>();
                var deviceModel = deviceService.GetModels(p => p.SN.Equals(deviceId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.Base_DeviceInfo>();
                if (deviceModel == null)
                {
                    errMsg = "设备不存在";
                    return(false);
                }
                else
                {
                    if (deviceModel.Status != 1)
                    {
                        errMsg = "设备未启用";
                        return(false);
                    }
                    else
                    {
                        mcuId = deviceModel.SN;
                        //deviceIdentityId = deviceModel.ID;
                        return(true);
                    }
                }
            }
            else
            {
                return(false);
            }
        }