Exemplo n.º 1
0
        public int CheckDeviceNo(string merchantCode, string deviceNo, out string message)
        {
            var rep = DMRepository.Get<EVehicle>();

            List<ETenant> list = new List<ETenant>();
            DeviceModel dm = new DeviceModel();
            dm.GetParentMerchantByRecursion(merchantCode, list);
            string merchantCodes = string.Join(",", list.Select(p => p.TenantCode).ToArray());

            var device = rep.Get(p => p.MerchantCode.In(merchantCodes) && p.DeviceNo == deviceNo);
            if (device != null)
            {
                if (!string.IsNullOrEmpty(device.TenantCode) && device.TenantCode != "0")
                {
                    message = "该设备号已经与其它设备关联!";
                    return 0;
                }

                var gpsTypeEntity = DACFacade.Gps.GpsTypeDAC.Select(device.GPSTypeID);
                if (gpsTypeEntity == null)
                {
                    message = "设备类型";
                    return 0;
                }
                else
                {
                    message = gpsTypeEntity.TypeName;
                    return 1;

                }
            }
            message = "没有找到该设备号!";
            return 0;
        }