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
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.AllStatistics = WXStoreHelper.GetAllStatistics();
         this.Devices       = WXStoreHelper.GetAllDevices();
         this.AllStores     = WXStoreHelper.GetAllPoiList();
     }
 }
Ejemplo n.º 3
0
        private DataGridViewModel <WXStoreHelper.SearchStatistics> GetDataList(HttpContext context)
        {
            DataGridViewModel <WXStoreHelper.SearchStatistics> dataGridViewModel = new DataGridViewModel <WXStoreHelper.SearchStatistics>();
            string calendarDate = string.Empty;
            string empty        = string.Empty;

            empty = context.Request["calendarDate"];
            if (!string.IsNullOrEmpty(empty))
            {
                calendarDate = empty;
            }
            List <WXStoreHelper.DataItemForDate> list = this.AllStatistics;

            if (calendarDate.ToDateTime() >= (DateTime?)DateTime.Now.Date)
            {
                throw new HidistroAshxException("请选择小于当天的日期");
            }
            this.AllStatistics = WXStoreHelper.GetAllStatistics();
            this.Devices       = WXStoreHelper.GetAllDevices();
            this.AllStores     = WXStoreHelper.GetAllPoiList();
            if (!string.IsNullOrEmpty(calendarDate))
            {
                list = (from c in list
                        where c.CurrentDate == calendarDate
                        select c).ToList();
            }
            if (list != null)
            {
                dataGridViewModel.total = list.Count;
                int count = (base.CurrentPageIndex - 1) * base.CurrentPageSize;
                list = list.Skip(count).Take(base.CurrentPageSize).ToList();
                dataGridViewModel.rows = (from c in list
                                          select new WXStoreHelper.SearchStatistics
                {
                    device_id = c.device_id,
                    shake_pv = c.shake_pv,
                    shake_uv = c.shake_uv,
                    click_pv = c.click_pv,
                    click_uv = c.click_uv,
                    StoreName = this.GetStoreName(c.device_id),
                    Remark = this.GetRemark(c.device_id),
                    CurrentDate = c.CurrentDate
                }).ToList();
            }
            return(dataGridViewModel);
        }
Ejemplo n.º 4
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);
        }