Ejemplo n.º 1
0
        private DataGridViewModel <SearchDevices> GetDataList(HttpContext context)
        {
            int  num         = 1;
            int  num2        = 10;
            long EquipmentId = 0L;
            int  Status      = 0;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            if (!string.IsNullOrEmpty(context.Request["Status"]))
            {
                Status = context.Request["Status"].ToInt(0);
            }
            DataGridViewModel <SearchDevices> dataGridViewModel = new DataGridViewModel <SearchDevices>();

            EquipmentId  = context.Request["EquipmentId"].ToLong(0);
            this.Devices = (from c in WXStoreHelper.GetAllDevices()
                            orderby c.status descending
                            select c).ToList();
            this.ConfigurationPages = WXStoreHelper.GetAllDevicesConfigurationPageNumber();
            int count = (num - 1) * num2;
            List <WXStoreHelper.Device> source = this.Devices;

            if (Status > -1)
            {
                source = (from c in source
                          where c.status == Status
                          select c).ToList();
            }
            if (EquipmentId > 0)
            {
                source = (from c in source
                          where c.device_id == EquipmentId
                          select c).ToList();
            }
            dataGridViewModel.total = source.Count();
            source = source.Skip(count).Take(num2).ToList();
            dataGridViewModel.rows = (from c in source
                                      select new SearchDevices
            {
                device_id = c.device_id,
                StoreName = c.poi_id.ToString(),
                LastTime = this.SetLastTime(c.last_active_time),
                Remark = c.comment,
                ConfigurationPageNumber = this.SetConfigurationPageNumber(c.device_id),
                WXDeviceStatusText = ((c.status == 1) ? "已激活" : "未激活"),
                major = c.major,
                minor = c.minor,
                uuid = c.uuid
            }).ToList();
            return(dataGridViewModel);
        }
Ejemplo n.º 2
0
        private DataGridViewModel <SearchDevices> GetDataList(HttpContext context)
        {
            DataGridViewModel <SearchDevices> dataGridViewModel = new DataGridViewModel <SearchDevices>();
            int  num  = 1;
            int  num2 = 10;
            long num3 = 0L;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            num3           = context.Request["page_id"].ToLong(0);
            this.AllStores = WXStoreHelper.GetAllPoiList();
            this.Devices   = (from c in WXStoreHelper.GetAllDevices()
                              orderby c.status descending
                              select c).ToList();
            this.ConfigurationPages = WXStoreHelper.GetAllDevicesConfigurationPageNumber();
            int begin = (num - 1) * num2;
            SearchPageResultJson searchPageResultJson = WXStoreHelper.SearchDevicesByPageId(num3, begin, num2);

            if (searchPageResultJson.errcode.Equals(ReturnCode.请求成功))
            {
                dataGridViewModel.rows = (from c in searchPageResultJson.data.relations
                                          select new SearchDevices
                {
                    device_id = c.device_id,
                    StoreName = this.SetStoreName(c.device_id),
                    Remark = c.comment,
                    EquipmentExistsNumber = this.SetConfigurationPageNumber(c.device_id)
                }).ToList();
                dataGridViewModel.total = searchPageResultJson.data.total_count;
            }
            return(dataGridViewModel);
        }