예제 #1
0
        public ActionResult Tempmode12chs(int page = 1)
        {
            string deviceType = "12路温度仪";

            ViewBag.Pagination = new Pagination {
                TotalCount = deviceRepository.Count(), CurrentPage = page
            };
            List <int> areaIds = CurrentAvailableAreas.Select(area => area.Id).ToList();
            IEnumerable <DeviceModel> devices = deviceRepository.
                                                FindAll(device => areaIds.Contains(device.AreaId) && (device.DeviceMeta == null ? true : device.DeviceMeta.DeviceType == deviceType),
                                                        new PagingOptions <Device>(page, Pagination.DefaultPageSize, "Name"))
                                                .Select(device =>
                                                        new DeviceModel
            {
                Id              = device.Id,
                Name            = device.Name,
                Description     = device.Description,
                IMEI            = device.IMEI,
                SimNumber       = device.SimNumber,
                AreaName        = areaRepository.Get(device.AreaId).Name,
                Battery         = device.Battery,
                DataDttm        = device.DataDttm,
                PowerMode       = device.PowerMode,
                TransportPlanId = device.TransportPlanId,
                TransportPlan   = device.TransportPlan
            });

            DeviceMeta metaData = deviceMetaRepository.Find(p => p.DeviceType == deviceType);

            if (metaData == null || string.IsNullOrEmpty(metaData.MetaContent))
            {
                return(this.HttpNotFound());
            }

            string[] chnInfos = metaData.MetaContent.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            var val = chnInfos.Select(p => new DeviceUnitMode {
                Ch   = p.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0],
                Unit = deviceUnitRepository.Get(Convert.ToInt32(p.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[1]))
            });

            ViewBag.chInfos = val;
            return(View(devices));
        }
예제 #2
0
        public int Count(string name, string macAddress, Guid?processInstanceId)
        {
            int count = _deviceRepository.Count(name, macAddress, processInstanceId);

            return(count);
        }