Example #1
0
        public void JudgeDeviceOrItem(string id)
        {
            BLL.BLLManDevice device = new BLL.BLLManDevice();
            int deviceCount         = device.GetDeviceCount(id);

            int    areaCount = device.GetItemCount(id);
            string info      = "";

            if (areaCount > 0)
            {
                info = "device";
            }
            else if (deviceCount > 0)
            {
                info = "item";
            }
            else if (deviceCount == 0 && areaCount == 0)
            {
                info = "device";
            }
            object obj = new
            {
                info = info
            };

            string result = JsonConvert.SerializeObject(obj);

            Response.Write(result);
            Response.End();
        }
Example #2
0
        public void JudgeAreaOrDevice(string id)
        {
            BLL.BLLManDevice device = new BLL.BLLManDevice();
            int deviceCount = device.GetDeviceCount(id);
            BLLManArea area = new BLLManArea();
            int areaCount = area.GetAreaCount(id);
            string info = "";
            if (areaCount > 0)
            {
                info = "area";
            }
            else if (deviceCount > 0)
            {
                info = "device";
            }
            else if (deviceCount == 0 && areaCount == 0)
            {
                info = "area";
            }
            object obj = new
            {
                info = info
            };

            string result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }
Example #3
0
        /// <summary>
        /// 初始化点检项信息
        /// </summary>
        /// <param name="id">父类ID</param>
        /// <param name="page">第几页数</param>
        /// <param name="rows">每页数据量</param>
        private void GetLoadItem(string id, int page, int rows)
        {
            BLLManDevice device = new BLLManDevice();
            count = device.GetItemCount(id);
            dt = device.GetItemDt(id, (page - 1) * rows + 1, page * rows);

            IList<Hashtable> list = new List<Hashtable>();
            object obj = null;
            if (count != 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Hashtable ht = new Hashtable();
                    ht.Add("ID", row["ID"].ToString());
                    ht.Add("T_ITEMID", row["T_ITEMID"].ToString());
                    ht.Add("T_ITEMPOSITION", row["T_ITEMPOSITION"].ToString());
                    ht.Add("T_ITEMDESC", row["T_ITEMDESC"].ToString());
                    ht.Add("T_CONTENT", row["T_CONTENT"].ToString());
                    ht.Add("T_TYPE", row["T_TYPE"].ToString());
                    ht.Add("T_OBSERVE", row["T_OBSERVE"].ToString());
                    ht.Add("T_UNIT", row["T_UNIT"].ToString());
                    ht.Add("F_LOWER", row["F_LOWER"].ToString());
                    ht.Add("F_UPPER", row["F_UPPER"].ToString());
                    ht.Add("T_STARTTIME", row["T_STARTTIME"].ToString());
                    ht.Add("T_PERIODVALUE", row["T_PERIODVALUE"].ToString());
                    ht.Add("T_STATUS", row["T_STATUS"].ToString());
                    ht.Add("T_PERIODTYPE", row["T_STATUS"].ToString());
                    list.Add(ht);
                }
                obj = new
                {
                    total = count,
                    rows = list
                };
            }
            else
            {
                obj = new
                {
                    total = 0,
                    rows = list
                };
            }

            string result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }
Example #4
0
        /// <summary>
        /// 初始化设备信息
        /// </summary>
        /// <param name="id">父类ID</param>
        /// <param name="page">第几页数</param>
        /// <param name="rows">每页数据量</param>
        private void GetLoadDevice(string id, int page, int rows)
        {
            BLLManDevice device = new BLLManDevice();
            count = device.GetDeviceCount(id);
            dt = device.GetDeviceDt(id, (page - 1) * rows + 1, page * rows);

            IList<Hashtable> list = new List<Hashtable>();
            object obj = null;
            if (count != 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    Hashtable ht = new Hashtable();
                    ht.Add("ID", row["ID"].ToString());
                    ht.Add("DeviceID", row["DeviceID"].ToString());
                    ht.Add("DeviceName", row["DeviceName"].ToString());
                    ht.Add("T_PARENTID", row["T_PARENTID"].ToString());
                    ht.Add("T_SWERK", row["T_PARENTID"].ToString());
                    ht.Add("T_IWERK", row["T_PARENTID"].ToString());
                    ht.Add("T_KOSTL", row["T_PARENTID"].ToString());

                    list.Add(ht);
                }
                obj = new
                {
                    total = count,
                    rows = list
                };
            }
            else
            {
                obj = new
                {
                    total = 0,
                    rows = list
                };
            }

            string result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }