using GigaTech.CMS.Kernel.DataAccess;
using GigaTech.CMS.Web.Common.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace GigaTech.CMS.Web.Apps.IOTDeviceSystem
{
    
    public partial class DeviceList : PageBase
    {

        protected string iot_list="";
        protected void Page_Load(object sender, EventArgs e)
        {
            UsingExtjs = true;

            var NameField = "Name_" + System.Web.Configuration.WebConfigurationManager.AppSettings["OEM_Company"].ToString().ToUpper();

            using (var dr = SqlHelper.ExecuteReader("Select * From iot_system_device_main Where Code<>'300' Order By Code,SubCode"))
            {
                while (dr.Read())
                {
                    if (iot_list != "") iot_list = iot_list + ",";

                    iot_list = iot_list + "{ \"abbr\": \"" + dr["Code"] + "-" + dr["SubCode"] + "\", \"name\": \"" + dr[NameField] + "\" }";
                }
            }

        }
    }
}